Widow – Diff between revs 2 and 4

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 2 Rev 4
1 # This installs two files, app.exe and logo.ico, creates a start menu shortcut, builds an uninstaller, and 1 # This installs two files, app.exe and logo.ico, creates a start menu shortcut, builds an uninstaller, and
2 # adds uninstall information to the registry for Add/Remove Programs 2 # adds uninstall information to the registry for Add/Remove Programs
3 3
4 # To get started, put this script into a folder with the two files (app.exe, logo.ico, and license.rtf - 4 # To get started, put this script into a folder with the two files (app.exe, logo.ico, and license.rtf -
5 # You'll have to create these yourself) and run makensis on it 5 # You'll have to create these yourself) and run makensis on it
6 6
7 # If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they 7 # If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they
8 # show up in a few places. 8 # show up in a few places.
9 # All the other settings can be tweaked by editing the !defines at the top of this script 9 # All the other settings can be tweaked by editing the !defines at the top of this script
10 !define APPNAME "Widow" 10 !define APPNAME "Widow"
11 !define COMPANYNAME "Wizardry and Steamworks" 11 !define COMPANYNAME "Wizardry and Steamworks"
12 !define DESCRIPTION "Control computer power state after an user-configurable timeout." 12 !define DESCRIPTION "Control computer power state after an user-configurable timeout."
13 # These will be displayed by the "Click here for support information" link in "Add/Remove Programs" 13 # These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
14 # It is possible to use "mailto:" links in here to open the email client 14 # It is possible to use "mailto:" links in here to open the email client
15 !define HELPURL "http://widow.grimore.org/" # "Support Information" link 15 !define HELPURL "http://widow.grimore.org/" # "Support Information" link
16 !define UPDATEURL "http://widow.grimore.org/download/" # "Product Updates" link 16 !define UPDATEURL "http://widow.grimore.org/download/" # "Product Updates" link
17 !define ABOUTURL "http://grimore.org/" # "Publisher" link 17 !define ABOUTURL "http://grimore.org/" # "Publisher" link
18 # This is the size (in kB) of all the files copied into "Program Files" 18 # This is the size (in kB) of all the files copied into "Program Files"
19 #!define INSTALLSIZE 7233 19 #!define INSTALLSIZE 7233
20   20  
21 #### General Use Functions 21 #### General Use Functions
22   22  
23 ## Get version of an exe file. 23 ## Get version of an exe file.
24 Function GetFileVersion 24 Function GetFileVersion
25 !define GetFileVersion `!insertmacro GetFileVersionCall` 25 !define GetFileVersion `!insertmacro GetFileVersionCall`
26 26
27 !macro GetFileVersionCall _FILE _RESULT 27 !macro GetFileVersionCall _FILE _RESULT
28 Push `${_FILE}` 28 Push `${_FILE}`
29 Call GetFileVersion 29 Call GetFileVersion
30 Pop ${_RESULT} 30 Pop ${_RESULT}
31 !macroend 31 !macroend
32 32
33 Exch $0 33 Exch $0
34 Push $1 34 Push $1
35 Push $2 35 Push $2
36 Push $3 36 Push $3
37 Push $4 37 Push $4
38 Push $5 38 Push $5
39 Push $6 39 Push $6
40 ClearErrors 40 ClearErrors
41 41
42 GetDllVersion '$0' $1 $2 42 GetDllVersion '$0' $1 $2
43 IfErrors error 43 IfErrors error
44 IntOp $3 $1 >> 16 44 IntOp $3 $1 >> 16
45 IntOp $3 $3 & 0x0000FFFF 45 IntOp $3 $3 & 0x0000FFFF
46 IntOp $4 $1 & 0x0000FFFF 46 IntOp $4 $1 & 0x0000FFFF
47 IntOp $5 $2 >> 16 47 IntOp $5 $2 >> 16
48 IntOp $5 $5 & 0x0000FFFF 48 IntOp $5 $5 & 0x0000FFFF
49 IntOp $6 $2 & 0x0000FFFF 49 IntOp $6 $2 & 0x0000FFFF
50 StrCpy $0 '$3.$4.$5.$6' 50 StrCpy $0 '$3.$4.$5.$6'
51 goto end 51 goto end
52 52
53 error: 53 error:
54 SetErrors 54 SetErrors
55 StrCpy $0 '' 55 StrCpy $0 ''
56 56
57 end: 57 end:
58 Pop $6 58 Pop $6
59 Pop $5 59 Pop $5
60 Pop $4 60 Pop $4
61 Pop $3 61 Pop $3
62 Pop $2 62 Pop $2
63 Pop $1 63 Pop $1
64 Exch $0 64 Exch $0
65 FunctionEnd 65 FunctionEnd
66   66  
67 ## Explode 67 ## Explode
68 !include "LogicLib.nsh" 68 !include "LogicLib.nsh"
69 !define Explode "!insertmacro Explode" 69 !define Explode "!insertmacro Explode"
70   70  
71 Function Explode 71 Function Explode
72   72  
73 !macro Explode Length Separator String 73 !macro Explode Length Separator String
74 Push `${Separator}` 74 Push `${Separator}`
75 Push `${String}` 75 Push `${String}`
76 Call Explode 76 Call Explode
77 Pop `${Length}` 77 Pop `${Length}`
78 !macroend 78 !macroend
79   79  
80 ; Initialize variables 80 ; Initialize variables
81 Var /GLOBAL explString 81 Var /GLOBAL explString
82 Var /GLOBAL explSeparator 82 Var /GLOBAL explSeparator
83 Var /GLOBAL explStrLen 83 Var /GLOBAL explStrLen
84 Var /GLOBAL explSepLen 84 Var /GLOBAL explSepLen
85 Var /GLOBAL explOffset 85 Var /GLOBAL explOffset
86 Var /GLOBAL explTmp 86 Var /GLOBAL explTmp
87 Var /GLOBAL explTmp2 87 Var /GLOBAL explTmp2
88 Var /GLOBAL explTmp3 88 Var /GLOBAL explTmp3
89 Var /GLOBAL explArrCount 89 Var /GLOBAL explArrCount
90 Var /GLOBAL DirectXSetupError -  
91 90
92 ; Get input from user 91 ; Get input from user
93 Pop $explString 92 Pop $explString
94 Pop $explSeparator 93 Pop $explSeparator
95 94
96 ; Calculates initial values 95 ; Calculates initial values
97 StrLen $explStrLen $explString 96 StrLen $explStrLen $explString
98 StrLen $explSepLen $explSeparator 97 StrLen $explSepLen $explSeparator
99 StrCpy $explArrCount 1 98 StrCpy $explArrCount 1
100 99
101 ${If} $explStrLen <= 1 ; If we got a single character 100 ${If} $explStrLen <= 1 ; If we got a single character
102 ${OrIf} $explSepLen > $explStrLen ; or separator is larger than the string, 101 ${OrIf} $explSepLen > $explStrLen ; or separator is larger than the string,
103 Push $explString ; then we return initial string with no change 102 Push $explString ; then we return initial string with no change
104 Push 1 ; and set array's length to 1 103 Push 1 ; and set array's length to 1
105 Return 104 Return
106 ${EndIf} 105 ${EndIf}
107 106
108 ; Set offset to the last symbol of the string 107 ; Set offset to the last symbol of the string
109 StrCpy $explOffset $explStrLen 108 StrCpy $explOffset $explStrLen
110 IntOp $explOffset $explOffset - 1 109 IntOp $explOffset $explOffset - 1
111 110
112 ; Clear temp string to exclude the possibility of appearance of occasional data 111 ; Clear temp string to exclude the possibility of appearance of occasional data
113 StrCpy $explTmp "" 112 StrCpy $explTmp ""
114 StrCpy $explTmp2 "" 113 StrCpy $explTmp2 ""
115 StrCpy $explTmp3 "" 114 StrCpy $explTmp3 ""
116 115
117 ; Loop until the offset becomes negative 116 ; Loop until the offset becomes negative
118 ${Do} 117 ${Do}
119 ; If offset becomes negative, it is time to leave the function 118 ; If offset becomes negative, it is time to leave the function
120 ${IfThen} $explOffset == -1 ${|} ${ExitDo} ${|} 119 ${IfThen} $explOffset == -1 ${|} ${ExitDo} ${|}
121 120
122 ; Remove everything before and after the searched part ("TempStr") 121 ; Remove everything before and after the searched part ("TempStr")
123 StrCpy $explTmp $explString $explSepLen $explOffset 122 StrCpy $explTmp $explString $explSepLen $explOffset
124 123
125 ${If} $explTmp == $explSeparator 124 ${If} $explTmp == $explSeparator
126 ; Calculating offset to start copy from 125 ; Calculating offset to start copy from
127 IntOp $explTmp2 $explOffset + $explSepLen ; Offset equals to the current offset plus length of separator 126 IntOp $explTmp2 $explOffset + $explSepLen ; Offset equals to the current offset plus length of separator
128 StrCpy $explTmp3 $explString "" $explTmp2 127 StrCpy $explTmp3 $explString "" $explTmp2
129 128
130 Push $explTmp3 ; Throwing array item to the stack 129 Push $explTmp3 ; Throwing array item to the stack
131 IntOp $explArrCount $explArrCount + 1 ; Increasing array's counter 130 IntOp $explArrCount $explArrCount + 1 ; Increasing array's counter
132 131
133 StrCpy $explString $explString $explOffset 0 ; Cutting all characters beginning with the separator entry 132 StrCpy $explString $explString $explOffset 0 ; Cutting all characters beginning with the separator entry
134 StrLen $explStrLen $explString 133 StrLen $explStrLen $explString
135 ${EndIf} 134 ${EndIf}
136 135
137 ${If} $explOffset = 0 ; If the beginning of the line met and there is no separator, 136 ${If} $explOffset = 0 ; If the beginning of the line met and there is no separator,
138 ; copying the rest of the string 137 ; copying the rest of the string
139 ${If} $explSeparator == "" ; Fix for the empty separator 138 ${If} $explSeparator == "" ; Fix for the empty separator
140 IntOp $explArrCount $explArrCount - 1 139 IntOp $explArrCount $explArrCount - 1
141 ${Else} 140 ${Else}
142 Push $explString 141 Push $explString
143 ${EndIf} 142 ${EndIf}
144 ${EndIf} 143 ${EndIf}
145 144
146 IntOp $explOffset $explOffset - 1 145 IntOp $explOffset $explOffset - 1
147 ${Loop} 146 ${Loop}
148 147
149 Push $explArrCount 148 Push $explArrCount
150 FunctionEnd 149 FunctionEnd
151   150  
152 Function GetAppVersion 151 Function GetAppVersion
153 ; Create global variables. 152 ; Create global variables.
154 Var /GLOBAL VERSIONMAJOR 153 Var /GLOBAL VERSIONMAJOR
155 Var /GLOBAL VERSIONMINOR 154 Var /GLOBAL VERSIONMINOR
156 Var /GLOBAL VERSIONBUILD 155 Var /GLOBAL VERSIONBUILD
157   156  
158 ; Initialize global variables. 157 ; Initialize global variables.
159 StrCpy $VERSIONMAJOR 1 158 StrCpy $VERSIONMAJOR 1
160 StrCpy $VERSIONMINOR 0 159 StrCpy $VERSIONMINOR 0
161 StrCpy $VERSIONBUILD 0 160 StrCpy $VERSIONBUILD 0
162   161  
163 ; Retrieve executable version. 162 ; Retrieve executable version.
164 ${GetFileVersion} "${APPNAME}.exe" $R0 163 ${GetFileVersion} "${APPNAME}.exe" $R0
165 ${Explode} $0 "." $R0 164 ${Explode} $0 "." $R0
166 Pop $0 165 Pop $0
167 Pop $VERSIONMAJOR 166 Pop $VERSIONMAJOR
168 Pop $VERSIONMINOR 167 Pop $VERSIONMINOR
169 Pop $VERSIONBUILD 168 Pop $VERSIONBUILD
170 FunctionEnd 169 FunctionEnd
171 170
172 RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on) 171 RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
173 172
174 InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}" 173 InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
175 174
176 # rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n) 175 # rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
177 LicenseData "LICENSE.txt" 176 LicenseData "LICENSE.txt"
178 # This will be in the installer/uninstaller's title bar 177 # This will be in the installer/uninstaller's title bar
179 Name "${APPNAME}" 178 Name "${APPNAME}"
180 Icon "${APPNAME}.ico" 179 Icon "${APPNAME}.ico"
181 # Set the output file. 180 # Set the output file.
182 outFile "${APPNAME}.exe" 181 outFile "${APPNAME}.exe"
183   182  
184 !include LogicLib.nsh 183 !include LogicLib.nsh
185 !include nsDialogs.nsh 184 !include nsDialogs.nsh
186 185
187 # Just three pages - license agreement, install location, and installation 186 # Just three pages - license agreement, install location, and installation
188 page custom nsDialogsImage 187 page custom nsDialogsImage
189 page license 188 page license
190 page directory 189 page directory
191 Page instfiles 190 Page instfiles
192 191
193 !macro VerifyUserIsAdmin 192 !macro VerifyUserIsAdmin
194 UserInfo::GetAccountType 193 UserInfo::GetAccountType
195 pop $0 194 pop $0
196 ${If} $0 != "admin" ;Require admin rights on NT4+ 195 ${If} $0 != "admin" ;Require admin rights on NT4+
197 messageBox mb_iconstop "Administrator rights required!" 196 messageBox mb_iconstop "Administrator rights required!"
198 setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED 197 setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
199 quit 198 quit
200 ${EndIf} 199 ${EndIf}
201 !macroend 200 !macroend
202 201
203 function .onInit 202 function .onInit
204 InitPluginsDir 203 InitPluginsDir
205 setShellVarContext all 204 setShellVarContext all
206 !insertmacro VerifyUserIsAdmin 205 !insertmacro VerifyUserIsAdmin
207 File /oname=$PLUGINSDIR\image.bmp "wasinstallerlogo.bmp" 206 File /oname=$PLUGINSDIR\image.bmp "wasinstallerlogo.bmp"
208 # Get the application version. 207 # Get the application version.
209 Call GetAppVersion 208 Call GetAppVersion
210 functionEnd 209 functionEnd
211   210  
212 Var Dialog 211 Var Dialog
213 Var Image 212 Var Image
214 Var ImageHandle 213 Var ImageHandle
215   214  
216 Function nsDialogsImage 215 Function nsDialogsImage
217 nsDialogs::Create 1018 216 nsDialogs::Create 1018
218 Pop $Dialog 217 Pop $Dialog
219   218  
220 ${If} $Dialog == error 219 ${If} $Dialog == error
221 Abort 220 Abort
222 ${EndIf} 221 ${EndIf}
223   222  
224 ${NSD_CreateBitmap} 0 0 100% 100% "" 223 ${NSD_CreateBitmap} 0 0 100% 100% ""
225 Pop $Image 224 Pop $Image
226 ${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $ImageHandle 225 ${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $ImageHandle
227   226  
228 nsDialogs::Show 227 nsDialogs::Show
229   228  
230 ${NSD_FreeImage} $ImageHandle 229 ${NSD_FreeImage} $ImageHandle
231 FunctionEnd 230 FunctionEnd
232 231
233 section "install" 232 section "install"
234 # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file) 233 # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
235 setOutPath $INSTDIR 234 setOutPath $INSTDIR
236 # Files added here should be removed by the uninstaller (see section "uninstall") 235 # Files added here should be removed by the uninstaller (see section "uninstall")
237 file /r "bin\Release\*.*" 236 file /r "bin\Release\*.*"
238 file "${APPNAME}.ico" 237 file "${APPNAME}.ico"
239 # Add any other files for the install directory (license files, app data, etc) here 238 # Add any other files for the install directory (license files, app data, etc) here
240 239
241 # Uninstaller - See function un.onInit and section "uninstall" for configuration 240 # Uninstaller - See function un.onInit and section "uninstall" for configuration
242 writeUninstaller "$INSTDIR\uninstall.exe" 241 writeUninstaller "$INSTDIR\uninstall.exe"
243   242  
244 # Create start-menu items 243 # Create start-menu items
245 CreateDirectory "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}" 244 CreateDirectory "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}"
246 CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 245 CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
247 CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" "$INSTDIR\${APPNAME}.ico" 246 CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" "$INSTDIR\${APPNAME}.ico"
248   247  
249 # Create desktop shortcut 248 # Create desktop shortcut
250 CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" 249 CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" ""
251 250
252 # Registry information for add/remove programs 251 # Registry information for add/remove programs
253 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}" 252 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
254 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" 253 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
255 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" 254 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
256 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" 255 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
257 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${APPNAME}.ico$\"" 256 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${APPNAME}.ico$\""
258 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\"" 257 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
259 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\"" 258 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
260 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\"" 259 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
261 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\"" 260 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
262 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD$\"" 261 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD$\""
263 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" $VERSIONMAJOR 262 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" $VERSIONMAJOR
264 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" $VERSIONMINOR 263 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" $VERSIONMINOR
265 # There is no option for modifying or repairing the install 264 # There is no option for modifying or repairing the install
266 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 265 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
267 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 266 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
268 # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size 267 # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
269 #WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE} 268 #WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
270   -  
271 DetailPrint "Running DirectX Setup..." -  
272 ExecWait '"$EXEDIR\DirectX\DXSETUP.exe" /silent' $DirectXSetupError -  
273 DetailPrint "Finished DirectX Setup" -  
274 sectionEnd 269 sectionEnd
275 270
276 # Uninstaller 271 # Uninstaller
277   272  
278 function un.onInit 273 function un.onInit
279 SetShellVarContext all 274 SetShellVarContext all
280 275
281 #Verify the uninstaller - last chance to back out 276 #Verify the uninstaller - last chance to back out
282 MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next 277 MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
283 Abort 278 Abort
284 next: 279 next:
285 !insertmacro VerifyUserIsAdmin 280 !insertmacro VerifyUserIsAdmin
286 functionEnd 281 functionEnd
287 282
288 section "uninstall" 283 section "uninstall"
289 284
290 # Remove desktop shortcut 285 # Remove desktop shortcut
291 delete "$DESKTOP\${APPNAME}.lnk" 286 delete "$DESKTOP\${APPNAME}.lnk"
292 # Remove Start Menu items 287 # Remove Start Menu items
293 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\uninstall.lnk" 288 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\uninstall.lnk"
294 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk" 289 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk"
295 # Try to remove the Start Menu folder for the program. 290 # Try to remove the Start Menu folder for the program.
296 # NB: This will only happen if it is empty 291 # NB: This will only happen if it is empty
297 rmDir "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}" 292 rmDir "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}"
298 # Try to remove the Start Menu folder for the company. 293 # Try to remove the Start Menu folder for the company.
299 rmDir "$SMPROGRAMS\${COMPANYNAME}" 294 rmDir "$SMPROGRAMS\${COMPANYNAME}"
300 295
301 # Remove files 296 # Remove files
302 rmDir /r "$INSTDIR\*.*" 297 rmDir /r "$INSTDIR\*.*"
303 298
304 # Always delete uninstaller as the last action 299 # Always delete uninstaller as the last action
305 delete $INSTDIR\uninstall.exe 300 delete $INSTDIR\uninstall.exe
306 301
307 # Try to remove the install directory - this will only happen if it is empty 302 # Try to remove the install directory - this will only happen if it is empty
308 rmDir $INSTDIR 303 rmDir $INSTDIR
309 304
310 # Remove uninstaller information from the registry 305 # Remove uninstaller information from the registry
311 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" 306 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
312 sectionEnd 307 sectionEnd
313   308