-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMPUI_Common.nsh
154 lines (125 loc) · 4.32 KB
/
MPUI_Common.nsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
; ///////////////////////////////////////////////////////////////////////////////
; // MPlayer for Windows - Install Script
; // Copyright (C) 2004-2024 LoRd_MuldeR <[email protected]>
; //
; // This program is free software; you can redistribute it and/or modify
; // it under the terms of the GNU General Public License as published by
; // the Free Software Foundation; either version 2 of the License, or
; // (at your option) any later version.
; //
; // This program is distributed in the hope that it will be useful,
; // but WITHOUT ANY WARRANTY; without even the implied warranty of
; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; // GNU General Public License for more details.
; //
; // You should have received a copy of the GNU General Public License along
; // with this program; if not, write to the Free Software Foundation, Inc.,
; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; //
; // http://www.gnu.org/licenses/gpl-2.0.txt
; ///////////////////////////////////////////////////////////////////////////////
!define PrintProgress "!insertmacro _PrintProgress"
!define PrintStatus "!insertmacro _PrintStatus"
!macro _PrintProgress Text
SetDetailsPrint textonly
DetailPrint '${Text}, $(MPLAYER_LANG_STATUS_WAIT)...'
SetDetailsPrint listonly
DetailPrint '--- ${Text} ---'
Sleep 333
!macroend
!macro _PrintStatus Text
SetDetailsPrint textonly
DetailPrint '${Text}.'
SetDetailsPrint listonly
DetailPrint '--- ${Text} ---'
Sleep 333
!macroend
; ----------------------------------------------------------------------------
!define ExtractSubDir "!insertmacro _ExtractSubDir"
!macro _ExtractSubDir BaseDir SubDir
SetOutPath "$INSTDIR\${SubDir}"
File /r "${BaseDir}\${SubDir}\*.*"
!macroend
; ----------------------------------------------------------------------------
!define CreateWebLink "!insertmacro _CreateWebLink"
!macro _CreateWebLink ShortcutFile TargetURL
Push $0
Push $1
StrCpy $0 "${ShortcutFile}"
StrCpy $1 "${TargetURL}"
Call _Imp_CreateWebLink
Pop $1
Pop $0
!macroend
Function _Imp_CreateWebLink
FlushINI "$0"
SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
DeleteINISec "$0" "DEFAULT"
DeleteINISec "$0" "InternetShortcut"
WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
WriteINIStr "$0" "InternetShortcut" "URL" "$1"
WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
FlushINI "$0"
SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
FunctionEnd
!macro DisableNextButton TmpVar
GetDlgItem ${TmpVar} $HWNDPARENT 1
EnableWindow ${TmpVar} 0
!macroend
; ----------------------------------------------------------------------------
!define PackAll "!insertmacro _PackAll"
!macro _PackAll path filter
Push "${filter}"
Push "${path}"
Call _Imp_PackAll
!macroend
Function _Imp_PackAll
Exch $0
Exch
Exch $1
Push $2
ClearErrors
FindFirst $1 $2 "$0\$1"
${IfNot} ${Errors}
${DoUntil} ${Errors}
${IfNot} "$2" == "Uninstall.exe"
${AndIfNot} "$2" == "Updater.exe"
DetailPrint "$(MPLAYER_LANG_COMPRESSING): $2"
NsExec::Exec '"$PLUGINSDIR\UPX.exe" --compress-icons=0 "$0\$2"'
${EndIf}
FindNext $1 $2
${Loop}
FindClose $1
${EndIf}
Pop $2
Pop $1
Pop $0
FunctionEnd
; ----------------------------------------------------------------------------
!define MakeFilePublic "!insertmacro _MakeFilePublic"
!define MakePathPublic "!insertmacro _MakePathPublic"
!macro _MakeFilePublic filename
${IfNot} ${FileExists} "${filename}"
Push $R0
FileOpen $R0 "${filename}" w
FileClose $R0
Pop $R0
${EndIf}
AccessControl::GrantOnFile "${filename}" "(BU)" "FullAccess"
!macroend
!macro _MakePathPublic path
AccessControl::GrantOnFile "${path}" "(BU)" "GenericRead + GenericWrite"
!macroend
; ----------------------------------------------------------------------------
!define GetVirtualStorePath "!insertmacro _GetVirtualStorePath"
!macro _GetVirtualStorePath out path
StrCpy ${out} '${path}' "" 3
StrCpy ${out} '$LOCALAPPDATA\VirtualStore\${out}'
!macroend
; ----------------------------------------------------------------------------
!define RegisterFileExtCapability "!insertmacro _RegisterFileExtCapability"
!macro _RegisterFileExtCapability ext
WriteRegStr HKLM "${MPlayerRegPath}\Capabilities\FileAssociations" ".${ext}" "MPlayerForWindowsV2.File"
!macroend