1 |
|
---|
2 | !if $%BUILD_TYPE% == "debug"
|
---|
3 | !define _DEBUG ; Turn this on to get extra output
|
---|
4 | !endif
|
---|
5 |
|
---|
6 | ; Defines for special functions
|
---|
7 | !define WHQL_FAKE ; Turns on the faking of non WHQL signed / approved drivers.
|
---|
8 | ; Needs the VBoxWHQLFake.exe in the additions output directory!
|
---|
9 |
|
---|
10 | !define VENDOR_ROOT_KEY "SOFTWARE\$%VBOX_VENDOR_SHORT%"
|
---|
11 |
|
---|
12 | !define PRODUCT_NAME "$%VBOX_PRODUCT% Guest Additions"
|
---|
13 | !define PRODUCT_DESC "$%VBOX_PRODUCT% Guest Additions"
|
---|
14 | !define PRODUCT_VERSION "$%VBOX_VERSION_MAJOR%.$%VBOX_VERSION_MINOR%.$%VBOX_VERSION_BUILD%.0"
|
---|
15 | !define PRODUCT_PUBLISHER " $%VBOX_VENDOR%"
|
---|
16 | !define PRODUCT_COPYRIGHT "(C) $%VBOX_C_YEAR% $%VBOX_VENDOR%"
|
---|
17 | !define PRODUCT_OUTPUT "VBoxWindowsAdditions-$%BUILD_TARGET_ARCH%.exe"
|
---|
18 | !define PRODUCT_WEB_SITE "http://www.virtualbox.org"
|
---|
19 | !define PRODUCT_INSTALL_KEY "${VENDOR_ROOT_KEY}\VirtualBox Guest Additions"
|
---|
20 | !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
---|
21 | !define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
---|
22 |
|
---|
23 | VIProductVersion "${PRODUCT_VERSION}"
|
---|
24 | VIAddVersionKey "FileVersion" "$%VBOX_VERSION_STRING%"
|
---|
25 | VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
|
---|
26 | VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
|
---|
27 | VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
|
---|
28 | VIAddVersionKey "FileDescription" "${PRODUCT_DESC}"
|
---|
29 | VIAddVersionKey "LegalCopyright" "${PRODUCT_COPYRIGHT}"
|
---|
30 | VIAddVersionKey "InternalName" "${PRODUCT_OUTPUT}"
|
---|
31 |
|
---|
32 | ; This registry key will hold the mouse driver path before install (NT4 only)
|
---|
33 | !define ORG_MOUSE_PATH "MousePath"
|
---|
34 |
|
---|
35 | !include "LogicLib.nsh"
|
---|
36 | !include "FileFunc.nsh"
|
---|
37 | !insertmacro GetParameters
|
---|
38 | !insertmacro GetOptions
|
---|
39 | !include "WordFunc.nsh"
|
---|
40 | !insertmacro WordFind
|
---|
41 | !insertmacro StrFilter
|
---|
42 |
|
---|
43 | !include "nsProcess.nsh"
|
---|
44 | !include "Library.nsh"
|
---|
45 | !include "strstr.nsh" ; Function "strstr"
|
---|
46 | !include "servicepack.nsh" ; Function "GetServicePack"
|
---|
47 | !include "winver.nsh" ; Function for determining Windows version
|
---|
48 | !define REPLACEDLL_NOREGISTER ; Replace in use DLL function
|
---|
49 | !include "ReplaceDLL.nsh"
|
---|
50 | !include "dumplog.nsh" ; Dump log to file function
|
---|
51 |
|
---|
52 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
53 | !include "x64.nsh"
|
---|
54 | !endif
|
---|
55 |
|
---|
56 | ; Use modern UI (MUI)
|
---|
57 | !include "MUI.nsh"
|
---|
58 |
|
---|
59 | ; MUI Settings
|
---|
60 | !define MUI_WELCOMEFINISHPAGE_BITMAP "$%VBOX_BRAND_WIN_ADD_INST_DLGBMP%"
|
---|
61 | !define MUI_ABORTWARNING
|
---|
62 | !define MUI_WELCOMEPAGE_TITLE_3LINES "Welcome to the ${PRODUCT_NAME} Additions Setup"
|
---|
63 |
|
---|
64 | ; API defines
|
---|
65 | !define SM_CLEANBOOT 67
|
---|
66 |
|
---|
67 | ; Icons
|
---|
68 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
69 | !define MUI_ICON "$%VBOX_NSIS_ICON_FILE%"
|
---|
70 | !define MUI_UNICON "$%VBOX_NSIS_ICON_FILE%"
|
---|
71 | !else ; 64-bit
|
---|
72 | !define MUI_ICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
|
---|
73 | !define MUI_UNICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
|
---|
74 | !endif
|
---|
75 |
|
---|
76 | ; Welcome page
|
---|
77 | !insertmacro MUI_PAGE_WELCOME
|
---|
78 | ; License page
|
---|
79 | !insertmacro MUI_PAGE_LICENSE "$(VBOX_LICENSE)"
|
---|
80 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
---|
81 | ; Directory page
|
---|
82 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
83 | ; Components Page
|
---|
84 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
85 | ; Instfiles page
|
---|
86 | !insertmacro MUI_PAGE_INSTFILES
|
---|
87 |
|
---|
88 | !ifndef _DEBUG
|
---|
89 | !define MUI_FINISHPAGE_TITLE_3LINES ; Have a bit more vertical space for text
|
---|
90 | !insertmacro MUI_PAGE_FINISH ; Only show in release mode - useful information for debugging!
|
---|
91 | !endif
|
---|
92 |
|
---|
93 | ; Uninstaller pages
|
---|
94 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
95 |
|
---|
96 | ; Define languages we will use
|
---|
97 | !insertmacro MUI_LANGUAGE "English"
|
---|
98 | !insertmacro MUI_LANGUAGE "French"
|
---|
99 | !insertmacro MUI_LANGUAGE "German"
|
---|
100 |
|
---|
101 | ; Set branding text which appears on the horizontal line at the bottom
|
---|
102 | BrandingText "VirtualBox Windows Additions"
|
---|
103 |
|
---|
104 | ; Set license language
|
---|
105 | LicenseLangString VBOX_LICENSE ${LANG_ENGLISH} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
106 |
|
---|
107 | ; If license files not available (OSE / PUEL) build, then use the English one as default.
|
---|
108 | !ifdef VBOX_BRAND_fr_FR_LICENSE_RTF
|
---|
109 | LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_fr_FR_LICENSE_RTF%"
|
---|
110 | !else
|
---|
111 | LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
112 | !endif
|
---|
113 | !ifdef VBOX_BRAND_de_DE_LICENSE_RTF
|
---|
114 | LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_de_DE_LICENSE_RTF%"
|
---|
115 | !else
|
---|
116 | LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
117 | !endif
|
---|
118 |
|
---|
119 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
---|
120 | ; MUI end ------
|
---|
121 |
|
---|
122 | ; Language files
|
---|
123 | !include "Languages\English.nsh"
|
---|
124 | !include "Languages\French.nsh"
|
---|
125 | !include "Languages\German.nsh"
|
---|
126 |
|
---|
127 | ; Variables and output files
|
---|
128 | Name "${PRODUCT_NAME} $%VBOX_VERSION_STRING%"
|
---|
129 | !ifdef UNINSTALLER_ONLY
|
---|
130 | !echo "Uninstaller only!"
|
---|
131 | OutFile "$%PATH_TARGET%\VBoxWindowsAdditions-$%BUILD_TARGET_ARCH%-uninst.exe"
|
---|
132 | !else
|
---|
133 | OutFile "VBoxWindowsAdditions-$%BUILD_TARGET_ARCH%.exe"
|
---|
134 | !endif
|
---|
135 |
|
---|
136 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
137 | InstallDir "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
|
---|
138 | !else ; 64-bit
|
---|
139 | InstallDir "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
|
---|
140 | !endif
|
---|
141 |
|
---|
142 | InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
---|
143 | ShowInstDetails show
|
---|
144 | ShowUnInstDetails show
|
---|
145 | RequestExecutionLevel highest
|
---|
146 |
|
---|
147 | Var g_iSystemMode ; Current system mode (0 = Normal boot, 1 = Fail-safe boot, 2 = Fail-safe with network boot)
|
---|
148 | Var g_strSystemDir ; Windows system directory
|
---|
149 | Var g_strCurUser ; Current user using the system
|
---|
150 | Var g_strAddVerMaj ; Installed Guest Additions: Major version
|
---|
151 | Var g_strAddVerMin ; Installed Guest Additions: Minor version
|
---|
152 | Var g_strAddVerBuild ; Installed Guest Additions: Build number
|
---|
153 | Var g_strAddVerRev ; Installed Guest Additions: SVN revision
|
---|
154 | Var g_strWinVersion ; Current Windows version we're running on
|
---|
155 | Var g_bLogEnable ; Do logging when installing? "true" or "false"
|
---|
156 | Var g_bFakeWHQL ; Cmd line: Fake Windows to install non WHQL certificated drivers (only for W2K and XP currently!!) ("/unsig_drv")
|
---|
157 | Var g_bUninstall ; Cmd line: Just uninstall any previous Guest Additions and exit
|
---|
158 | Var g_bRebootOnExit ; Cmd line: Auto-Reboot on successful installation. Good for unattended installations ("/reboot")
|
---|
159 | Var g_iScreenBpp ; Cmd line: Screen depth ("/depth=X")
|
---|
160 | Var g_iScreenX ; Cmd line: Screen resolution X ("/resx=X")
|
---|
161 | Var g_iScreenY ; Cmd line: Screen resolution Y ("/resy=Y")
|
---|
162 | Var g_iSfOrder ; Cmd line: Order of Shared Folders network provider (0=first, 1=second, ...)
|
---|
163 | Var g_bNoVideoDrv ; Cmd line: Do not install the VBoxVideo driver
|
---|
164 | Var g_bNoGuestDrv ; Cmd line: Do not install the VBoxGuest driver
|
---|
165 | Var g_bNoMouseDrv ; Cmd line: Do not install the VBoxMouse driver
|
---|
166 | Var g_bWithAutoLogon ; Cmd line: Install VBoxGINA / VBoxCredProv for auto logon support
|
---|
167 | Var g_bWithD3D ; Cmd line: Install Direct3D support
|
---|
168 | Var g_bOnlyExtract ; Cmd line: Only extract all files, do *not* install them. Only valid with param "/D" (target directory)
|
---|
169 |
|
---|
170 | ; Platform parts of this installer
|
---|
171 | !include "VBoxGuestAdditionsCommon.nsh"
|
---|
172 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit only
|
---|
173 | !include "VBoxGuestAdditionsNT4.nsh"
|
---|
174 | !endif
|
---|
175 | !include "VBoxGuestAdditionsW2KXP.nsh"
|
---|
176 | !include "VBoxGuestAdditionsVista.nsh"
|
---|
177 | !include "VBoxGuestAdditionsUninstall.nsh" ; Product uninstallation
|
---|
178 | !include "VBoxGuestAdditionsUninstallOld.nsh" ; Uninstallation of deprecated versions which must be removed first
|
---|
179 |
|
---|
180 | Function HandleCommandLine
|
---|
181 |
|
---|
182 | Push $0 ; Command line (without process name)
|
---|
183 | Push $1 ; Number of parameters
|
---|
184 | Push $2 ; Current parameter index
|
---|
185 | Push $3 ; Current parameter pair (name=value)
|
---|
186 | Push $4 ; Current parameter name
|
---|
187 | Push $5 ; Current parameter value (if present)
|
---|
188 |
|
---|
189 | StrCpy $1 "0" ; Init param counter
|
---|
190 | StrCpy $2 "1" ; Init current param counter
|
---|
191 |
|
---|
192 | ${GetParameters} $0 ; Extract command line
|
---|
193 | ${If} $0 == "" ; If no parameters at all exit
|
---|
194 | Goto exit
|
---|
195 | ${EndIf}
|
---|
196 |
|
---|
197 | ; Enable for debugging
|
---|
198 | ;MessageBox MB_OK "CmdLine: $0"
|
---|
199 |
|
---|
200 | ${WordFind} $0 " " "#" $1 ; Get number of parameters in cmd line
|
---|
201 | ${If} $0 == $1 ; If result matches the input then
|
---|
202 | StrCpy $1 "1" ; no delimeter was found. Correct to 1 word total.
|
---|
203 | ${EndIf}
|
---|
204 |
|
---|
205 | ${While} $2 <= $1 ; Loop through all params
|
---|
206 |
|
---|
207 | ${WordFind} $0 " " "+$2" $3 ; Get current name=value pair
|
---|
208 | ${WordFind} $3 "=" "+1" $4 ; Get current param name
|
---|
209 | ${WordFind} $3 "=" "+2" $5 ; Get current param value
|
---|
210 |
|
---|
211 | ${StrFilter} $4 "-" "" "" $4 ; Transfor param name to lowercase
|
---|
212 |
|
---|
213 | ; Enable for debugging
|
---|
214 | ;MessageBox MB_OK "#$2 of #$1, param='$3', name=$4, val=$5"
|
---|
215 |
|
---|
216 | ${Switch} $4
|
---|
217 |
|
---|
218 | ${Case} '/d' ; NSIS: /D=<instdir> switch, skip
|
---|
219 | ${Break}
|
---|
220 |
|
---|
221 | ${Case} '/depth'
|
---|
222 | ${Case} 'depth'
|
---|
223 | StrCpy $g_iScreenBpp $5
|
---|
224 | ${Break}
|
---|
225 |
|
---|
226 | ${Case} '/extract'
|
---|
227 | StrCpy $g_bOnlyExtract "true"
|
---|
228 | ${Break}
|
---|
229 |
|
---|
230 | ${Case} '/help'
|
---|
231 | ${Case} '/H'
|
---|
232 | ${Case} '/h'
|
---|
233 | ${Case} '/?'
|
---|
234 | Goto usage
|
---|
235 | ${Break}
|
---|
236 |
|
---|
237 | ${Case} '/l'
|
---|
238 | ${Case} '/log'
|
---|
239 | ${Case} '/logging'
|
---|
240 | StrCpy $g_bLogEnable "true"
|
---|
241 | ${Break}
|
---|
242 |
|
---|
243 | ${Case} '/ncrc' ; NSIS: /NCRC switch, skip
|
---|
244 | ${Break}
|
---|
245 |
|
---|
246 | ${Case} '/no_videodrv'
|
---|
247 | StrCpy $g_bNoVideoDrv "true"
|
---|
248 | ${Break}
|
---|
249 |
|
---|
250 | ${Case} '/no_guestdrv'
|
---|
251 | StrCpy $g_bNoGuestDrv "true"
|
---|
252 | ${Break}
|
---|
253 |
|
---|
254 | ${Case} '/no_mousedrv'
|
---|
255 | StrCpy $g_bNoMouseDrv "true"
|
---|
256 | ${Break}
|
---|
257 |
|
---|
258 | ${Case} '/reboot'
|
---|
259 | StrCpy $g_bRebootOnExit "true"
|
---|
260 | ${Break}
|
---|
261 |
|
---|
262 | ${Case} '/s' ; NSIS: /S switch, skip
|
---|
263 | ${Break}
|
---|
264 |
|
---|
265 | ${Case} '/sforder'
|
---|
266 | ${Case} 'sforder'
|
---|
267 | StrCpy $g_iSfOrder $5
|
---|
268 | ${Break}
|
---|
269 |
|
---|
270 | !ifdef WHQL_FAKE
|
---|
271 | ${Case} '/unsig_drv'
|
---|
272 | StrCpy $g_bFakeWHQL "true"
|
---|
273 | ${Break}
|
---|
274 | !endif
|
---|
275 |
|
---|
276 | ${Case} '/uninstall'
|
---|
277 | StrCpy $g_bUninstall "true"
|
---|
278 | ${Break}
|
---|
279 |
|
---|
280 | ${Case} '/with_autologon'
|
---|
281 | StrCpy $g_bWithAutoLogon "true"
|
---|
282 | ${Break}
|
---|
283 |
|
---|
284 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
285 | ${Case} '/with_d3d'
|
---|
286 | ${Case} '/with_direct3d'
|
---|
287 | StrCpy $g_bWithD3D "true"
|
---|
288 | ${Break}
|
---|
289 | !endif
|
---|
290 |
|
---|
291 | ${Case} '/xres'
|
---|
292 | ${Case} 'xres'
|
---|
293 | StrCpy $g_iScreenX $5
|
---|
294 | ${Break}
|
---|
295 |
|
---|
296 | ${Case} '/yres'
|
---|
297 | ${Case} 'yres'
|
---|
298 | StrCpy $g_iScreenY $5
|
---|
299 | ${Break}
|
---|
300 |
|
---|
301 | ${Default} ; Unknown parameter, print usage message
|
---|
302 | goto usage
|
---|
303 | ${Break}
|
---|
304 |
|
---|
305 | ${EndSwitch}
|
---|
306 | IntOp $2 $2 + 1
|
---|
307 |
|
---|
308 | ${EndWhile}
|
---|
309 | Goto exit
|
---|
310 |
|
---|
311 | usage:
|
---|
312 |
|
---|
313 | MessageBox MB_OK "${PRODUCT_NAME} Installer$\r$\n$\r$\n \
|
---|
314 | Usage: VBoxWindowsAdditions-$%BUILD_TARGET_ARCH% [OPTIONS] [/l] [/S] [/D=<PATH>]$\r$\n$\r$\n \
|
---|
315 | Options:$\r$\n \
|
---|
316 | /depth=BPP$\tSets the guest's display color depth (bits per pixel)$\r$\n \
|
---|
317 | /extract$\t$\tOnly extract installation files$\r$\n \
|
---|
318 | /uninstall$\t$\tJust uninstalls the Guest Additions and exits$\r$\n \
|
---|
319 | /with_autologon$\tInstalls auto-logon support$\r$\n \
|
---|
320 | /with_d3d$\tInstalls D3D support$\r$\n \
|
---|
321 | /xres=X$\t$\tSets the guest's display resolution (width in pixels)$\r$\n \
|
---|
322 | /yres=Y$\t$\tSets the guest's display resolution (height in pixels)$\r$\n \
|
---|
323 | $\r$\n \
|
---|
324 | Installer parameters:$\r$\n \
|
---|
325 | /l$\t$\tEnables logging$\r$\n \
|
---|
326 | /S$\t$\tSilent install$\r$\n \
|
---|
327 | /D=<PATH>$\tSets the default install path$\r$\n \
|
---|
328 | $\r$\n \
|
---|
329 | Note: Order of options and installer parameters are mandatory."
|
---|
330 |
|
---|
331 | ; No stack restore needed, we're about to quit
|
---|
332 | Quit
|
---|
333 |
|
---|
334 | done:
|
---|
335 |
|
---|
336 | IfSilent 0 +2
|
---|
337 | LogText "Installer is in silent mode!"
|
---|
338 |
|
---|
339 | LogText "Property: XRes: $g_iScreenX"
|
---|
340 | LogText "Property: YRes: $g_iScreenY"
|
---|
341 | LogText "Property: BPP: $g_iScreenBpp"
|
---|
342 | LogText "Property: Logging enabled: $g_bLogEnable"
|
---|
343 |
|
---|
344 | exit:
|
---|
345 |
|
---|
346 | Pop $5
|
---|
347 | Pop $4
|
---|
348 | Pop $3
|
---|
349 | Pop $2
|
---|
350 | Pop $1
|
---|
351 | Pop $0
|
---|
352 |
|
---|
353 | FunctionEnd
|
---|
354 |
|
---|
355 | Function CheckForOldGuestAdditions
|
---|
356 |
|
---|
357 | Push $0
|
---|
358 | Push $1
|
---|
359 | Push $2
|
---|
360 |
|
---|
361 | begin:
|
---|
362 |
|
---|
363 | sun_check:
|
---|
364 |
|
---|
365 | ; Check for old "Sun VirtualBox Guest Additions"
|
---|
366 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun VirtualBox Guest Additions" "UninstallString"
|
---|
367 | StrCmp $0 "" sun_xvm_check ; If string is empty, Sun additions are probably not installed (anymore).
|
---|
368 |
|
---|
369 | MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_uninstall
|
---|
370 | Pop $2
|
---|
371 | Pop $1
|
---|
372 | Pop $0
|
---|
373 | MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
|
---|
374 | Quit
|
---|
375 |
|
---|
376 | sun_uninstall:
|
---|
377 |
|
---|
378 | Call Uninstall_Sun
|
---|
379 | Goto success
|
---|
380 |
|
---|
381 | sun_xvm_check:
|
---|
382 |
|
---|
383 | ; Check for old "innotek" Guest Additions" before rebranding to "Sun"
|
---|
384 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun xVM VirtualBox Guest Additions" "UninstallString"
|
---|
385 | StrCmp $0 "" innotek_check ; If string is empty, Sun xVM additions are probably not installed (anymore).
|
---|
386 |
|
---|
387 | MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_xvm_uninstall
|
---|
388 | Pop $2
|
---|
389 | Pop $1
|
---|
390 | Pop $0
|
---|
391 | MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
|
---|
392 | Quit
|
---|
393 |
|
---|
394 | sun_xvm_uninstall:
|
---|
395 |
|
---|
396 | Call Uninstall_SunXVM
|
---|
397 | Goto success
|
---|
398 |
|
---|
399 | innotek_check:
|
---|
400 |
|
---|
401 | ; Check for old "innotek" Guest Additions" before rebranding to "Sun"
|
---|
402 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\innotek VirtualBox Guest Additions" "UninstallString"
|
---|
403 | StrCmp $0 "" exit ; If string is empty, Guest Additions are probably not installed (anymore).
|
---|
404 |
|
---|
405 | MessageBox MB_YESNO $(VBOX_INNOTEK_FOUND) /SD IDYES IDYES innotek_uninstall
|
---|
406 | Pop $2
|
---|
407 | Pop $1
|
---|
408 | Pop $0
|
---|
409 | MessageBox MB_ICONSTOP $(VBOX_INNOTEK_ABORTED) /SD IDOK
|
---|
410 | Quit
|
---|
411 |
|
---|
412 | innotek_uninstall:
|
---|
413 |
|
---|
414 | Call Uninstall_Innotek
|
---|
415 | Goto success
|
---|
416 |
|
---|
417 | success:
|
---|
418 |
|
---|
419 | ; Nothing to do here yet
|
---|
420 |
|
---|
421 | exit:
|
---|
422 |
|
---|
423 | Pop $2
|
---|
424 | Pop $1
|
---|
425 | Pop $0
|
---|
426 |
|
---|
427 | FunctionEnd
|
---|
428 |
|
---|
429 | Function CheckArchitecture
|
---|
430 |
|
---|
431 | System::Call "kernel32::GetCurrentProcess() i .s"
|
---|
432 | System::Call "kernel32::IsWow64Process(i s, *i .r0)"
|
---|
433 | DetailPrint "Running on 64bit: $0"
|
---|
434 |
|
---|
435 | !if $%BUILD_TARGET_ARCH% == "amd64" ; 64-bit
|
---|
436 | IntCmp $0 0 not_32bit_platform
|
---|
437 | !else ; 32-bit
|
---|
438 | IntCmp $0 1 not_64bit_platform
|
---|
439 | !endif
|
---|
440 |
|
---|
441 | Goto exit
|
---|
442 |
|
---|
443 | not_32bit_platform:
|
---|
444 |
|
---|
445 | MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
|
---|
446 | Quit
|
---|
447 |
|
---|
448 | not_64bit_platform:
|
---|
449 |
|
---|
450 | MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
|
---|
451 | Quit
|
---|
452 |
|
---|
453 | exit:
|
---|
454 |
|
---|
455 | FunctionEnd
|
---|
456 |
|
---|
457 | Function PrepareForUpdate
|
---|
458 |
|
---|
459 | StrCmp $g_strAddVerMaj "1" v1 ; Handle major version "v1.x"
|
---|
460 | StrCmp $g_strAddVerMaj "2" v2 ; Handle major version "v2.x"
|
---|
461 | StrCmp $g_strAddVerMaj "3" v3 ; Handle major version "v3.x"
|
---|
462 | Goto exit
|
---|
463 |
|
---|
464 | v3:
|
---|
465 |
|
---|
466 | Goto exit
|
---|
467 |
|
---|
468 | v2:
|
---|
469 |
|
---|
470 | Goto exit
|
---|
471 |
|
---|
472 | v1:
|
---|
473 |
|
---|
474 | StrCmp $g_strAddVerMin "5" v1_5 ; Handle major version "v1.5.x"
|
---|
475 | StrCmp $g_strAddVerMin "6" v1_6 ; Handle major version "v1.6.x"
|
---|
476 |
|
---|
477 | v1_5:
|
---|
478 |
|
---|
479 | Goto exit
|
---|
480 |
|
---|
481 | v1_6:
|
---|
482 |
|
---|
483 | Goto exit
|
---|
484 |
|
---|
485 | exit:
|
---|
486 |
|
---|
487 | FunctionEnd
|
---|
488 |
|
---|
489 | Function Common_CopyFiles
|
---|
490 |
|
---|
491 | SetOutPath "$INSTDIR"
|
---|
492 | SetOverwrite on
|
---|
493 |
|
---|
494 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
495 |
|
---|
496 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
497 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
498 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
499 | !endif
|
---|
500 |
|
---|
501 | FILE "iexplore.ico"
|
---|
502 |
|
---|
503 | FunctionEnd
|
---|
504 |
|
---|
505 | ; Main Files
|
---|
506 | Section $(VBOX_COMPONENT_MAIN) SEC01
|
---|
507 |
|
---|
508 | SectionIn RO ; Section cannot be unselected (read-only)
|
---|
509 |
|
---|
510 | SetOutPath "$INSTDIR"
|
---|
511 | SetOverwrite on
|
---|
512 |
|
---|
513 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
514 | ; do some tricks for the Windows paths
|
---|
515 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
516 | ; Because the next two lines will crash at the license page (??) we have to re-enable that here again
|
---|
517 | ${DisableX64FSRedirection}
|
---|
518 | SetRegView 64
|
---|
519 | !endif
|
---|
520 |
|
---|
521 | StrCpy $g_strSystemDir "$SYSDIR"
|
---|
522 | DetailPrint "System Directory: $g_strSystemDir"
|
---|
523 |
|
---|
524 | Call EnableLog
|
---|
525 | Call PrepareForUpdate
|
---|
526 |
|
---|
527 | DetailPrint "Version: $%VBOX_VERSION_STRING%"
|
---|
528 | ${If} $g_strAddVerMaj != ""
|
---|
529 | DetailPrint "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
|
---|
530 | ${Else}
|
---|
531 | DetailPrint "No previous version of ${PRODUCT_NAME} detected."
|
---|
532 | ${EndIf}
|
---|
533 | DetailPrint "Handled Windows version: $g_strWinVersion"
|
---|
534 |
|
---|
535 | !ifdef _DEBUG
|
---|
536 | DetailPrint "Debug!"
|
---|
537 | !endif
|
---|
538 |
|
---|
539 | ; Which OS we are using?
|
---|
540 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
541 | StrCmp $g_strWinVersion "nt4" nt4
|
---|
542 | !endif
|
---|
543 | StrCmp $g_strWinVersion "2k" w2k
|
---|
544 | StrCmp $g_strWinVersion "vista" vista
|
---|
545 |
|
---|
546 | Goto notsupported
|
---|
547 |
|
---|
548 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
549 | nt4: ; Windows NT4
|
---|
550 |
|
---|
551 | Call GetServicePack
|
---|
552 | Pop $R0 ; Major version
|
---|
553 | Pop $R1 ; Minor version
|
---|
554 |
|
---|
555 | ; At least Service Pack 6 installed?
|
---|
556 | StrCmp $R0 "6" +3
|
---|
557 | MessageBox MB_YESNO $(VBOX_NT4_NO_SP6) /SD IDYES IDYES +2
|
---|
558 | Quit
|
---|
559 |
|
---|
560 | ; Copy some common files ...
|
---|
561 | Call Common_CopyFiles
|
---|
562 |
|
---|
563 | Call NT_Main
|
---|
564 | goto success
|
---|
565 | !endif
|
---|
566 |
|
---|
567 | vista: ; Windows Vista (fall through, needs stuff from w2k label, too)
|
---|
568 |
|
---|
569 | ; Copy some common files ...
|
---|
570 | Call Common_CopyFiles
|
---|
571 |
|
---|
572 | Call W2K_Main ; First install stuff from Windows 2000 / XP
|
---|
573 | Call Vista_Main ; ... and some specific stuff for Vista
|
---|
574 | goto success
|
---|
575 |
|
---|
576 | w2k: ; Windows 2000 and XP ...
|
---|
577 |
|
---|
578 | ; Copy some common files ...
|
---|
579 | Call Common_CopyFiles
|
---|
580 |
|
---|
581 | Call W2K_Main
|
---|
582 | goto success
|
---|
583 |
|
---|
584 | notsupported:
|
---|
585 |
|
---|
586 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
587 | goto exit
|
---|
588 |
|
---|
589 | success:
|
---|
590 |
|
---|
591 | ; Write a registry key with version and installation path for later lookup
|
---|
592 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Version" "$%VBOX_VERSION_STRING%"
|
---|
593 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Revision" "$%VBOX_SVN_REV%"
|
---|
594 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "InstallDir" "$INSTDIR"
|
---|
595 |
|
---|
596 | !ifndef _DEBUG
|
---|
597 | SetRebootFlag true ; This will show a reboot page at end of installation
|
---|
598 | !endif
|
---|
599 |
|
---|
600 | exit:
|
---|
601 |
|
---|
602 | Call WriteLogUI
|
---|
603 |
|
---|
604 | SectionEnd
|
---|
605 |
|
---|
606 | ; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch)
|
---|
607 | Section /o -$(VBOX_COMPONENT_AUTOLOGON) SEC02
|
---|
608 |
|
---|
609 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
610 | ; do some tricks for the Windows paths.
|
---|
611 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
612 | ; Because the next two lines will crash at the license page (??) we have to re-enable that here again
|
---|
613 | ${DisableX64FSRedirection}
|
---|
614 | SetRegView 64
|
---|
615 | !endif
|
---|
616 |
|
---|
617 | Call GetWindowsVersion
|
---|
618 | Pop $R0 ; Windows Version
|
---|
619 |
|
---|
620 | DetailPrint "Installing auto-logon support ..."
|
---|
621 |
|
---|
622 | ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
|
---|
623 | ; whether to replace it with the VirtualBox one or not.
|
---|
624 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
|
---|
625 | ${If} $0 != ""
|
---|
626 | ${If} $0 != "VBoxGINA.dll"
|
---|
627 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
|
---|
628 | goto exit
|
---|
629 | ${EndIf}
|
---|
630 | ${EndIf}
|
---|
631 |
|
---|
632 | install:
|
---|
633 |
|
---|
634 | ; Do we need VBoxCredProv or VBoxGINA?
|
---|
635 | ${If} $R0 == 'Vista'
|
---|
636 | ${OrIf} $R0 == '7'
|
---|
637 | !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
|
---|
638 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
|
---|
639 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
|
---|
640 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
|
---|
641 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
|
---|
642 | ${Else}
|
---|
643 | !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
|
---|
644 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
|
---|
645 | ${EndIf}
|
---|
646 |
|
---|
647 | exit:
|
---|
648 |
|
---|
649 | SectionEnd
|
---|
650 |
|
---|
651 | ; Prepares the access rights for replacing a WRP protected file
|
---|
652 | Function PrepareWRPFile
|
---|
653 |
|
---|
654 | Pop $0
|
---|
655 | IfFileExists "$g_strSystemDir\takeown.exe" 0 +2
|
---|
656 | nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"'
|
---|
657 | AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
|
---|
658 | Pop $1
|
---|
659 | DetailPrint "Setting file owner for '$0': $1"
|
---|
660 | AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
|
---|
661 | Pop $1
|
---|
662 | DetailPrint "Setting access rights for '$0': $1"
|
---|
663 |
|
---|
664 | FunctionEnd
|
---|
665 |
|
---|
666 | ; Direct3D support
|
---|
667 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
668 | Section /o $(VBOX_COMPONENT_D3D) SEC03
|
---|
669 |
|
---|
670 | Push $R0
|
---|
671 |
|
---|
672 | Call GetWindowsVersion
|
---|
673 | Pop $R0 ; Windows Version
|
---|
674 |
|
---|
675 | ; If we're not in safe mode, print a warning and do nothing here
|
---|
676 | ${If} $g_iSystemMode == '0'
|
---|
677 | DetailPrint "System is not in safe mode, D3D support will not be installed!"
|
---|
678 | Return
|
---|
679 | ${EndIf}
|
---|
680 |
|
---|
681 | ; Do not install on < XP
|
---|
682 | ${If} $R0 == 'NT 3'
|
---|
683 | ${OrIf} $R0 == 'NT 4'
|
---|
684 | ${OrIf} $R0 == '2000'
|
---|
685 | ${OrIf} $R0 == ''
|
---|
686 | DetailPrint "Direct3D guest support not available on this platform!"
|
---|
687 | Return
|
---|
688 | ${EndIf}
|
---|
689 |
|
---|
690 | !define LIBRARY_IGNORE_VERSION ; Install in every case
|
---|
691 | SetOverwrite on
|
---|
692 |
|
---|
693 | ${If} $g_strSystemDir == ''
|
---|
694 | StrCpy $g_strSystemDir "$SYSDIR"
|
---|
695 | ${EndIf}
|
---|
696 |
|
---|
697 | ; crOpenGL: Do *not* install 64-bit files - they don't work yet (use !define LIBRARY_X64 later)
|
---|
698 | ; Only 32-bit apps on 64-bit work (see next block)
|
---|
699 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
700 | SetOutPath $g_strSystemDir
|
---|
701 | DetailPrint "Installing Direct3D support ..."
|
---|
702 | FILE "$%PATH_OUT%\bin\additions\libWine.dll"
|
---|
703 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
|
---|
704 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
|
---|
705 | FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
|
---|
706 |
|
---|
707 | ; Update DLL cache
|
---|
708 | SetOutPath "$g_strSystemDir\dllcache"
|
---|
709 | IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" +1
|
---|
710 | CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d8.dll" "$g_strSystemDir\dllcache\msd3d8.dll"
|
---|
711 | IfFileExists "$g_strSystemDir\dllcache\msd3d9.dll" +1
|
---|
712 | CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d9.dll" "$g_strSystemDir\dllcache\msd3d9.dll"
|
---|
713 |
|
---|
714 | Push "$g_strSystemDir\dllcache\d3d8.dll"
|
---|
715 | Call PrepareWRPFile
|
---|
716 |
|
---|
717 | Push "$g_strSystemDir\dllcache\d3d9.dll"
|
---|
718 | Call PrepareWRPFile
|
---|
719 |
|
---|
720 | ; Exchange DLLs
|
---|
721 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
|
---|
722 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
|
---|
723 |
|
---|
724 | ; If exchange above failed, do it on reboot
|
---|
725 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
|
---|
726 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
|
---|
727 |
|
---|
728 | ; Save original DLLs ...
|
---|
729 | SetOutPath $g_strSystemDir
|
---|
730 | IfFileExists "$g_strSystemDir\msd3d8.dll" +1
|
---|
731 | CopyFiles /SILENT "$g_strSystemDir\d3d8.dll" "$g_strSystemDir\msd3d8.dll"
|
---|
732 | IfFileExists "$g_strSystemDir\msd3d8.dll" +1
|
---|
733 | CopyFiles /SILENT "$g_strSystemDir\d3d9.dll" "$g_strSystemDir\msd3d9.dll"
|
---|
734 |
|
---|
735 | Push "$g_strSystemDir\d3d8.dll"
|
---|
736 | Call PrepareWRPFile
|
---|
737 |
|
---|
738 | Push "$g_strSystemDir\d3d9.dll"
|
---|
739 | Call PrepareWRPFile
|
---|
740 |
|
---|
741 | ; Exchange DLLs
|
---|
742 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
|
---|
743 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
|
---|
744 |
|
---|
745 | ; If exchange above failed, do it on reboot
|
---|
746 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
|
---|
747 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
|
---|
748 | !endif
|
---|
749 |
|
---|
750 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
751 | ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target arch in
|
---|
752 | ; Wow64 node (32-bit sub system)
|
---|
753 | ${EnableX64FSRedirection}
|
---|
754 | SetOutPath $SYSDIR
|
---|
755 | DetailPrint "Installing Direct3D support (Wow64) ..."
|
---|
756 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll"
|
---|
757 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
|
---|
758 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
|
---|
759 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
|
---|
760 |
|
---|
761 | ; Update DLL cache
|
---|
762 | SetOutPath "$SYSDIR\dllcache"
|
---|
763 | IfFileExists "$SYSDIR\dllcache\msd3d8.dll" +1
|
---|
764 | CopyFiles /SILENT "$SYSDIR\dllcache\d3d8.dll" "$SYSDIR\dllcache\msd3d8.dll"
|
---|
765 | IfFileExists "$SYSDIR\dllcache\msd3d9.dll" +1
|
---|
766 | CopyFiles /SILENT "$SYSDIR\dllcache\d3d9.dll" "$SYSDIR\dllcache\msd3d9.dll"
|
---|
767 |
|
---|
768 | Push "$SYSDIR\dllcache\d3d8.dll"
|
---|
769 | Call PrepareWRPFile
|
---|
770 |
|
---|
771 | Push "$SYSDIR\dllcache\d3d9.dll"
|
---|
772 | Call PrepareWRPFile
|
---|
773 |
|
---|
774 | ; Exchange DLLs
|
---|
775 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "$TEMP"
|
---|
776 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "$TEMP"
|
---|
777 |
|
---|
778 | ; If exchange above failed, do it on reboot
|
---|
779 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "$TEMP"
|
---|
780 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "$TEMP"
|
---|
781 |
|
---|
782 | ; Save original DLLs ...
|
---|
783 | SetOutPath $SYSDIR
|
---|
784 | IfFileExists "$SYSDIR\dllcache\msd3d8.dll" +1
|
---|
785 | CopyFiles /SILENT "$SYSDIR\d3d8.dll" "$SYSDIR\msd3d8.dll"
|
---|
786 | IfFileExists "$SYSDIR\dllcache\msd3d9.dll" +1
|
---|
787 | CopyFiles /SILENT "$SYSDIR\d3d9.dll" "$SYSDIR\msd3d9.dll"
|
---|
788 |
|
---|
789 | Push "$SYSDIR\d3d8.dll"
|
---|
790 | Call PrepareWRPFile
|
---|
791 |
|
---|
792 | Push "$SYSDIR\d3d9.dll"
|
---|
793 | Call PrepareWRPFile
|
---|
794 |
|
---|
795 | ; Exchange DLLs
|
---|
796 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\d3d8.dll" "$TEMP"
|
---|
797 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\d3d9.dll" "$TEMP"
|
---|
798 |
|
---|
799 | ; If exchange above failed, do it on reboot
|
---|
800 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\d3d8.dll" "$TEMP"
|
---|
801 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\d3d9.dll" "$TEMP"
|
---|
802 |
|
---|
803 | ${DisableX64FSRedirection}
|
---|
804 | !endif ; amd64
|
---|
805 | Goto done
|
---|
806 |
|
---|
807 | error:
|
---|
808 | ; @todo
|
---|
809 | Goto exit
|
---|
810 |
|
---|
811 | done:
|
---|
812 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_WFP_WARN_REPLACE) /SD IDOK
|
---|
813 | Goto exit
|
---|
814 |
|
---|
815 | Pop $R0
|
---|
816 |
|
---|
817 | exit:
|
---|
818 |
|
---|
819 | SectionEnd
|
---|
820 | !endif ; VBOX_WITH_CROGL
|
---|
821 |
|
---|
822 | ;Assign language strings to sections
|
---|
823 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
824 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
|
---|
825 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
|
---|
826 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
827 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
|
---|
828 | !endif
|
---|
829 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
830 |
|
---|
831 | Section -Content
|
---|
832 |
|
---|
833 | WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
---|
834 |
|
---|
835 | SectionEnd
|
---|
836 |
|
---|
837 | Section -StartMenu
|
---|
838 |
|
---|
839 | CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
|
---|
840 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
|
---|
841 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
|
---|
842 |
|
---|
843 | SectionEnd
|
---|
844 |
|
---|
845 | ; This section is called after all the files are in place
|
---|
846 | Section -Post
|
---|
847 |
|
---|
848 | !ifdef _DEBUG
|
---|
849 | DetailPrint "Doing post install ..."
|
---|
850 | !endif
|
---|
851 |
|
---|
852 | !ifdef EXTERNAL_UNINSTALLER
|
---|
853 | SetOutPath "$INSTDIR"
|
---|
854 | FILE "$%PATH_TARGET%\uninst.exe"
|
---|
855 | !else
|
---|
856 | WriteUninstaller "$INSTDIR\uninst.exe"
|
---|
857 | !endif
|
---|
858 |
|
---|
859 | ; Write uninstaller in "Add / Remove programs"
|
---|
860 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
---|
861 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
|
---|
862 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
---|
863 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
---|
864 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
---|
865 |
|
---|
866 | ; Tune TcpWindowSize for a better network throughput
|
---|
867 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
|
---|
868 |
|
---|
869 | DetailPrint "Installation completed."
|
---|
870 |
|
---|
871 | SectionEnd
|
---|
872 |
|
---|
873 | ; This function is called when a critical error occured
|
---|
874 | Function .onInstFailed
|
---|
875 |
|
---|
876 | MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
|
---|
877 | StrCpy $g_bLogEnable "true"
|
---|
878 | Call WriteLogUI
|
---|
879 | SetErrorLevel 1
|
---|
880 |
|
---|
881 | FunctionEnd
|
---|
882 |
|
---|
883 | ; This function is called when installation was successful!
|
---|
884 | Function .onInstSuccess
|
---|
885 |
|
---|
886 | ; Nothing to do here yet ...
|
---|
887 |
|
---|
888 | FunctionEnd
|
---|
889 |
|
---|
890 | ; This function is called at the very beginning of installer execution
|
---|
891 | Function .onInit
|
---|
892 |
|
---|
893 | ; Init values
|
---|
894 | StrCpy $g_iSystemMode "0"
|
---|
895 | StrCpy $g_strAddVerMaj "0"
|
---|
896 | StrCpy $g_strAddVerMin "0"
|
---|
897 | StrCpy $g_strAddVerBuild "0"
|
---|
898 | StrCpy $g_strAddVerRev "0"
|
---|
899 |
|
---|
900 | StrCpy $g_bLogEnable "false"
|
---|
901 | StrCpy $g_bFakeWHQL "false"
|
---|
902 | StrCpy $g_bUninstall "false"
|
---|
903 | StrCpy $g_bRebootOnExit "false"
|
---|
904 | StrCpy $g_iScreenX "0"
|
---|
905 | StrCpy $g_iScreenY "0"
|
---|
906 | StrCpy $g_iScreenBpp "0"
|
---|
907 | StrCpy $g_iSfOrder "0"
|
---|
908 | StrCpy $g_bNoVideoDrv "false"
|
---|
909 | StrCpy $g_bNoGuestDrv "false"
|
---|
910 | StrCpy $g_bNoMouseDrv "false"
|
---|
911 | StrCpy $g_bWithAutoLogon "false"
|
---|
912 | StrCpy $g_bWithD3D "false"
|
---|
913 | StrCpy $g_bOnlyExtract "false"
|
---|
914 |
|
---|
915 | SetErrorLevel 0
|
---|
916 | ClearErrors
|
---|
917 |
|
---|
918 | !ifndef UNINSTALLER_ONLY
|
---|
919 |
|
---|
920 | ; Handle command line
|
---|
921 | Call HandleCommandLine
|
---|
922 |
|
---|
923 | ; Retrieve Windows version and store result in $g_strWinVersion
|
---|
924 | Call GetWindowsVer
|
---|
925 |
|
---|
926 | ; Retrieve system mode and store result in
|
---|
927 | System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
|
---|
928 | StrCpy $g_iSystemMode $0
|
---|
929 | DetailPrint "System mode: $g_iSystemMode"
|
---|
930 |
|
---|
931 | ; Get user Name
|
---|
932 | AccessControl::GetCurrentUserName
|
---|
933 | Pop $g_strCurUser
|
---|
934 | DetailPrint "Current user: $g_strCurUser"
|
---|
935 |
|
---|
936 | ; Only uninstall?
|
---|
937 | StrCmp $g_bUninstall "true" uninstall
|
---|
938 |
|
---|
939 | ; Only extract files?
|
---|
940 | StrCmp $g_bOnlyExtract "true" extract_files
|
---|
941 |
|
---|
942 | ; Set section bits
|
---|
943 | ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
|
---|
944 | SectionSetFlags ${SEC02} ${SF_SELECTED}
|
---|
945 | ${EndIf}
|
---|
946 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
947 | ${If} $g_bWithD3D == "true" ; D3D support
|
---|
948 | SectionSetFlags ${SEC03} ${SF_SELECTED}
|
---|
949 | ${EndIf}
|
---|
950 | !endif
|
---|
951 |
|
---|
952 | ; Display language selection dialog (will be hidden in silent mode!)
|
---|
953 | !ifdef VBOX_INSTALLER_ADD_LANGUAGES
|
---|
954 | !insertmacro MUI_LANGDLL_DISPLAY
|
---|
955 | !endif
|
---|
956 |
|
---|
957 | ; Do some checks before we actually start ...
|
---|
958 | Call IsUserAdmin
|
---|
959 |
|
---|
960 | ; Check if there's already another instance of the installer is running -
|
---|
961 | ; important for preventing NT4 to spawn the installer twice
|
---|
962 | System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
|
---|
963 | Pop $R0
|
---|
964 | StrCmp $R0 0 +1 exit
|
---|
965 |
|
---|
966 | ; Check for correct architecture
|
---|
967 | Call CheckArchitecture
|
---|
968 |
|
---|
969 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
970 | ; do some tricks for the Windows paths for checking for old additions
|
---|
971 | ; in block below.
|
---|
972 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
973 | ${DisableX64FSRedirection}
|
---|
974 | SetRegView 64
|
---|
975 | !endif
|
---|
976 |
|
---|
977 | ; Check for old additions
|
---|
978 | Call CheckForOldGuestAdditions
|
---|
979 | Call GetAdditionsVersion
|
---|
980 |
|
---|
981 | ; Due to some bug in NSIS the license page won't be displayed if we're in
|
---|
982 | ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
|
---|
983 | ; mode for now.
|
---|
984 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
985 | ${EnableX64FSRedirection}
|
---|
986 | SetRegView 32
|
---|
987 | !endif
|
---|
988 |
|
---|
989 | Goto done
|
---|
990 |
|
---|
991 | uninstall:
|
---|
992 |
|
---|
993 | Call Uninstall_Innotek
|
---|
994 | Call Uninstall
|
---|
995 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
|
---|
996 | Goto exit
|
---|
997 |
|
---|
998 | extract_files:
|
---|
999 |
|
---|
1000 | Call ExtractFiles
|
---|
1001 | MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
|
---|
1002 | Goto exit
|
---|
1003 |
|
---|
1004 | !else ; UNINSTALLER_ONLY
|
---|
1005 |
|
---|
1006 | ;
|
---|
1007 | ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
|
---|
1008 | ; so we can sign it.
|
---|
1009 | ;
|
---|
1010 | ; Note that the Quit causes the exit status to be 2 instead of 0.
|
---|
1011 | ;
|
---|
1012 | WriteUninstaller "$%PATH_TARGET%\uninst.exe"
|
---|
1013 | Goto exit
|
---|
1014 |
|
---|
1015 | !endif ; UNINSTALLER_ONLY
|
---|
1016 |
|
---|
1017 | exit: ; Abort installer for some reason
|
---|
1018 |
|
---|
1019 | Quit
|
---|
1020 |
|
---|
1021 | done:
|
---|
1022 |
|
---|
1023 | FunctionEnd
|
---|
1024 |
|
---|
1025 | ;
|
---|
1026 | ; The uninstaller is built separately when doing code signing.
|
---|
1027 | ; For some reason NSIS still finds the Uninstall section even
|
---|
1028 | ; when EXTERNAL_UNINSTALLER is defined. This causes a silly warning.
|
---|
1029 | ;
|
---|
1030 | !ifndef EXTERNAL_UNINSTALLER
|
---|
1031 |
|
---|
1032 | Function un.onUninstSuccess
|
---|
1033 |
|
---|
1034 | HideWindow
|
---|
1035 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
|
---|
1036 |
|
---|
1037 | FunctionEnd
|
---|
1038 |
|
---|
1039 | Function un.onInit
|
---|
1040 |
|
---|
1041 | Call un.IsUserAdmin
|
---|
1042 |
|
---|
1043 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
|
---|
1044 | Quit
|
---|
1045 |
|
---|
1046 | proceed:
|
---|
1047 |
|
---|
1048 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
1049 | ; do some tricks for the Windows paths.
|
---|
1050 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1051 | ${DisableX64FSRedirection}
|
---|
1052 | SetRegView 64
|
---|
1053 | !endif
|
---|
1054 |
|
---|
1055 | ; Set system directory.
|
---|
1056 | StrCpy $g_strSystemDir "$SYSDIR"
|
---|
1057 |
|
---|
1058 | ; Retrieve Windows version we're running on and store it in $g_strWinVersion
|
---|
1059 | Call un.GetWindowsVer
|
---|
1060 |
|
---|
1061 | FunctionEnd
|
---|
1062 |
|
---|
1063 | Function .onSelChange
|
---|
1064 |
|
---|
1065 | Push $0
|
---|
1066 |
|
---|
1067 | ; Section: D3D
|
---|
1068 | SectionGetFlags ${SEC03} $0
|
---|
1069 |
|
---|
1070 | ${If} $0 == ${SF_SELECTED}
|
---|
1071 | ; If we're not in safe mode, print a warning and don't install D3D support
|
---|
1072 | ${If} $g_iSystemMode == '0'
|
---|
1073 | IntOp $0 $0 & ${SECTION_OFF} ; Unselect section again
|
---|
1074 | SectionSetFlags ${SEC03} $0
|
---|
1075 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NO_SM) /SD IDOK
|
---|
1076 | Return
|
---|
1077 | ${EndIf}
|
---|
1078 | ${EndIf}
|
---|
1079 |
|
---|
1080 | Pop $0
|
---|
1081 |
|
---|
1082 | FunctionEnd
|
---|
1083 |
|
---|
1084 | Section Uninstall
|
---|
1085 |
|
---|
1086 | !ifdef _DEBUG
|
---|
1087 | ; Enable logging
|
---|
1088 | Call un.EnableLog
|
---|
1089 | !endif
|
---|
1090 |
|
---|
1091 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
1092 | ; do some tricks for the Windows paths.
|
---|
1093 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1094 | ; Do *not* add this line in .onInit - it will crash at the license page (??) because of a weird NSIS bug.
|
---|
1095 | ${DisableX64FSRedirection}
|
---|
1096 | SetRegView 64
|
---|
1097 | !endif
|
---|
1098 |
|
---|
1099 | ; Call the uninstall main function.
|
---|
1100 | Call un.Uninstall
|
---|
1101 |
|
---|
1102 | ; ... and remove the local install directory
|
---|
1103 | Call un.UninstallInstDir
|
---|
1104 |
|
---|
1105 | !ifndef _DEBUG
|
---|
1106 | SetAutoClose true
|
---|
1107 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
|
---|
1108 | StrCmp $g_bRebootOnExit "true" restart
|
---|
1109 | !endif
|
---|
1110 |
|
---|
1111 | Goto exit
|
---|
1112 |
|
---|
1113 | restart:
|
---|
1114 |
|
---|
1115 | DetailPrint "Rebooting ..."
|
---|
1116 | Reboot
|
---|
1117 |
|
---|
1118 | exit:
|
---|
1119 |
|
---|
1120 | SectionEnd
|
---|
1121 |
|
---|
1122 | ; !EXTERNAL_UNINSTALLER
|
---|
1123 | !endif
|
---|
1124 |
|
---|
1125 | ;Direct the output to our bin dir
|
---|
1126 | !cd "$%PATH_OUT%\bin\additions"
|
---|