Updated MPlayer binaries to r37199, which is supposed to fix a DVD playback issue.
[mplayer-setup-win32.git] / MPUI_Common.nsh
blob708c791a5dc4bbc8fea7303db5ebfba1e97e78f3
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 !define PrintProgress "!insertmacro _PrintProgress"
24 !define PrintStatus "!insertmacro _PrintStatus"
26 !macro _PrintProgress Text
27         SetDetailsPrint textonly
28         DetailPrint '${Text}, $(MPLAYER_LANG_STATUS_WAIT)...'
29         SetDetailsPrint listonly
30         DetailPrint '--- ${Text} ---'
31         Sleep 333
32 !macroend
34 !macro _PrintStatus Text
35         SetDetailsPrint textonly
36         DetailPrint '${Text}.'
37         SetDetailsPrint listonly
38         DetailPrint '--- ${Text} ---'
39         Sleep 333
40 !macroend
42 ; ----------------------------------------------------------------------------
44 !define CreateWebLink "!insertmacro _CreateWebLink"
46 !macro _CreateWebLink ShortcutFile TargetURL
47         Push $0
48         Push $1
49         StrCpy $0 "${ShortcutFile}"
50         StrCpy $1 "${TargetURL}"
51         Call _Imp_CreateWebLink
52         Pop $1
53         Pop $0
54 !macroend
56 Function _Imp_CreateWebLink
57         FlushINI "$0"
58         SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
59         DeleteINISec "$0" "DEFAULT"
60         DeleteINISec "$0" "InternetShortcut"
61         WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
62         WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
63         WriteINIStr "$0" "InternetShortcut" "URL" "$1"
64         WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
65         WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
66         FlushINI "$0"
67         SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
68 FunctionEnd
70 !macro DisableNextButton TmpVar
71         GetDlgItem ${TmpVar} $HWNDPARENT 1
72         EnableWindow ${TmpVar} 0
73 !macroend
75 ; ----------------------------------------------------------------------------
77 !define PackAll "!insertmacro _PackAll"
79 !macro _PackAll path filter
80         Push "${filter}"
81         Push "${path}"
82         Call _Imp_PackAll
83 !macroend
85 Function _Imp_PackAll
86         Exch $0
87         Exch
88         Exch $1
89         Push $2
91         ClearErrors
92         FindFirst $1 $2 "$0\$1"
94         ${DoUntil} ${Errors}
95                 DetailPrint "$(MPLAYER_LANG_COMPRESSING): $2"
96                 NsExec::Exec '"$PLUGINSDIR\UPX.exe" --compress-icons=0 "$0\$2"'
97                 FindNext $1 $2
98         ${Loop}
100         Pop $2
101         Pop $1
102         Pop $0
103 FunctionEnd
104   
105 ; ----------------------------------------------------------------------------
106   
107 !define MakeFilePublic "!insertmacro _MakeFilePublic"
109 !macro _MakeFilePublic filename
110         ${IfNot} ${FileExists} "${filename}"
111                 Push $R0
112                 FileOpen $R0 "${filename}" w
113                 FileClose $R0
114                 Pop $R0
115         ${EndIf}
116         AccessControl::GrantOnFile "${filename}" "(S-1-1-0)" "FullAccess"
117 !macroend
119 ; ----------------------------------------------------------------------------
121 !define GetVirtualStorePath "!insertmacro _GetVirtualStorePath"
123 !macro _GetVirtualStorePath out path
124         StrCpy ${out} '${path}' "" 3
125         StrCpy ${out} '$LOCALAPPDATA\VirtualStore\${out}'
126 !macroend
128 ; ----------------------------------------------------------------------------
130 !define RegisterFileExtCapability "!insertmacro _RegisterFileExtCapability"
132 !macro _RegisterFileExtCapability ext
133         WriteRegStr HKLM "${MPlayerRegPath}\Capabilities\FileAssociations" ".${ext}"  "MPlayerForWindowsV2.File"
134 !macroend