1 | ; $Id: VBoxGuestAdditions.nsi 96697 2022-09-12 10:43:04Z vboxsync $
|
---|
2 | ; @file
|
---|
3 | ; VBoxGuestAdditions.nsi - Main file for Windows Guest Additions installation.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2012-2022 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | ;
|
---|
27 |
|
---|
28 | !if $%KBUILD_TYPE% == "debug"
|
---|
29 | !define _DEBUG ; Turn this on to get extra output
|
---|
30 | !endif
|
---|
31 |
|
---|
32 | !ifdef _DEBUG
|
---|
33 | ; Scratch directory for plugin tests
|
---|
34 | !addincludedir .\PluginTest
|
---|
35 | !addplugindir .\PluginTest
|
---|
36 | !endif
|
---|
37 |
|
---|
38 | !if $%VBOX_WITH_GUEST_INSTALLER_UNICODE% == "1"
|
---|
39 | ; Whether to use the Unicode version of NSIS
|
---|
40 | ; Note: Using Unicode will result in the installer not working on a Windows 95/98/ME guest
|
---|
41 | Unicode true
|
---|
42 | !endif
|
---|
43 |
|
---|
44 | ; Defines for special functions
|
---|
45 | !define WFP_FILE_EXCEPTION ; Enables setting a temporary file exception for WFP proctected files
|
---|
46 |
|
---|
47 | !define VENDOR_ROOT_KEY "SOFTWARE\$%VBOX_VENDOR_SHORT%"
|
---|
48 |
|
---|
49 | ; Product defines
|
---|
50 | !define PRODUCT_NAME "$%VBOX_PRODUCT% Guest Additions"
|
---|
51 | !define PRODUCT_DESC "$%VBOX_PRODUCT% Guest Additions"
|
---|
52 | !define PRODUCT_VERSION "$%VBOX_VERSION_MAJOR%.$%VBOX_VERSION_MINOR%.$%VBOX_VERSION_BUILD%.$%VBOX_SVN_REV%"
|
---|
53 | !define PRODUCT_PUBLISHER "$%VBOX_VENDOR%"
|
---|
54 | !define PRODUCT_COPYRIGHT "(C) $%VBOX_C_YEAR% $%VBOX_VENDOR%"
|
---|
55 | !define PRODUCT_OUTPUT "VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%.exe"
|
---|
56 | !define PRODUCT_WEB_SITE "http://www.virtualbox.org"
|
---|
57 | !define PRODUCT_INSTALL_KEY "${VENDOR_ROOT_KEY}\VirtualBox Guest Additions"
|
---|
58 | !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
---|
59 | !define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
---|
60 |
|
---|
61 | !define LICENSE_FILE_RTF "license.rtf"
|
---|
62 |
|
---|
63 | ; Needed for InstallLib macro: Install libraries in every case
|
---|
64 | !define LIBRARY_IGNORE_VERSION
|
---|
65 |
|
---|
66 | VIProductVersion "${PRODUCT_VERSION}"
|
---|
67 | VIAddVersionKey "FileVersion" "$%VBOX_VERSION_STRING%"
|
---|
68 | VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
|
---|
69 | VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
|
---|
70 | VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
|
---|
71 | VIAddVersionKey "FileDescription" "${PRODUCT_DESC}"
|
---|
72 | VIAddVersionKey "LegalCopyright" "${PRODUCT_COPYRIGHT}"
|
---|
73 | VIAddVersionKey "InternalName" "${PRODUCT_OUTPUT}"
|
---|
74 |
|
---|
75 | ; This registry key will hold the mouse driver path before install (NT4 only)
|
---|
76 | !define ORG_MOUSE_PATH "MousePath"
|
---|
77 |
|
---|
78 | ; If we have our guest install helper DLL, add the
|
---|
79 | ; plugin path so that NSIS can find it when compiling the installer
|
---|
80 | ; Note: NSIS plugins *always* have to be compiled in 32-bit!
|
---|
81 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
82 | !addplugindir "$%PATH_TARGET_X86%\VBoxGuestInstallHelper"
|
---|
83 | !endif
|
---|
84 |
|
---|
85 | !include "LogicLib.nsh"
|
---|
86 | !include "FileFunc.nsh"
|
---|
87 | !insertmacro GetParameters
|
---|
88 | !insertmacro GetOptions
|
---|
89 | !include "WordFunc.nsh"
|
---|
90 | !insertmacro WordFind
|
---|
91 | !insertmacro StrFilter
|
---|
92 |
|
---|
93 | !include "nsProcess.nsh"
|
---|
94 | !include "Library.nsh"
|
---|
95 | !include "Sections.nsh"
|
---|
96 | !include "strstr.nsh" ; Function "strstr"
|
---|
97 | !if $%KBUILD_TARGET_ARCH% == "x86" ; Only needed for NT4 SP6 recommendation.
|
---|
98 | !include "servicepack.nsh" ; Function "GetServicePack"
|
---|
99 | !endif
|
---|
100 | !include "winver.nsh" ; Function for determining Windows version
|
---|
101 | !define REPLACEDLL_NOREGISTER ; Replace in use DLL function
|
---|
102 | !include "ReplaceDLL.nsh"
|
---|
103 |
|
---|
104 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
105 | !include "x64.nsh"
|
---|
106 | !endif
|
---|
107 |
|
---|
108 | ; Set Modern UI (MUI) as default
|
---|
109 | !define USE_MUI
|
---|
110 |
|
---|
111 | !ifdef USE_MUI
|
---|
112 | ; Use modern UI, version 2
|
---|
113 | !include "MUI2.nsh"
|
---|
114 |
|
---|
115 | ; MUI Settings
|
---|
116 | !define MUI_WELCOMEFINISHPAGE_BITMAP "$%VBOX_BRAND_WIN_ADD_INST_DLGBMP%"
|
---|
117 | !define MUI_ABORTWARNING
|
---|
118 | !define MUI_WELCOMEPAGE_TITLE_3LINES "Welcome to the ${PRODUCT_NAME} Additions Setup"
|
---|
119 |
|
---|
120 | ; API defines
|
---|
121 | !define SM_CLEANBOOT 67
|
---|
122 |
|
---|
123 | ; Icons
|
---|
124 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
125 | !define MUI_ICON "$%VBOX_NSIS_ICON_FILE%"
|
---|
126 | !define MUI_UNICON "$%VBOX_NSIS_ICON_FILE%"
|
---|
127 | !else ; 64-bit
|
---|
128 | !define MUI_ICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
|
---|
129 | !define MUI_UNICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
|
---|
130 | !endif
|
---|
131 |
|
---|
132 | ; Welcome page
|
---|
133 | !insertmacro MUI_PAGE_WELCOME
|
---|
134 | !ifdef VBOX_WITH_LICENSE_DISPLAY
|
---|
135 | ; License page
|
---|
136 | !insertmacro MUI_PAGE_LICENSE "$(VBOX_LICENSE)"
|
---|
137 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
---|
138 | !endif
|
---|
139 | ; Directory page
|
---|
140 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
141 | ; Components Page
|
---|
142 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
143 | ; Instfiles page
|
---|
144 | !insertmacro MUI_PAGE_INSTFILES
|
---|
145 |
|
---|
146 | !ifndef _DEBUG
|
---|
147 | !define MUI_FINISHPAGE_TITLE_3LINES ; Have a bit more vertical space for text
|
---|
148 | !insertmacro MUI_PAGE_FINISH ; Only show in release mode - useful information for debugging!
|
---|
149 | !endif
|
---|
150 |
|
---|
151 | ; Uninstaller pages
|
---|
152 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
153 |
|
---|
154 | ; Define languages we will use
|
---|
155 | !insertmacro MUI_LANGUAGE "English"
|
---|
156 | !insertmacro MUI_LANGUAGE "French"
|
---|
157 | !insertmacro MUI_LANGUAGE "German"
|
---|
158 |
|
---|
159 | ; Set branding text which appears on the horizontal line at the bottom
|
---|
160 | !ifdef _DEBUG
|
---|
161 | BrandingText "VirtualBox Windows Additions $%VBOX_VERSION_STRING% (r$%VBOX_SVN_REV%) - Debug Build"
|
---|
162 | !else
|
---|
163 | BrandingText "VirtualBox Windows Additions $%VBOX_VERSION_STRING% r$%VBOX_SVN_REV%"
|
---|
164 | !endif
|
---|
165 |
|
---|
166 | !ifdef VBOX_WITH_LICENSE_DISPLAY
|
---|
167 | ; Set license language
|
---|
168 | LicenseLangString VBOX_LICENSE ${LANG_ENGLISH} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
169 |
|
---|
170 | ; If license files not available (OSE / PUEL) build, then use the English one as default
|
---|
171 | !ifdef VBOX_BRAND_fr_FR_LICENSE_RTF
|
---|
172 | LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_fr_FR_LICENSE_RTF%"
|
---|
173 | !else
|
---|
174 | LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
175 | !endif
|
---|
176 | !ifdef VBOX_BRAND_de_DE_LICENSE_RTF
|
---|
177 | LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_de_DE_LICENSE_RTF%"
|
---|
178 | !else
|
---|
179 | LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
180 | !endif
|
---|
181 | !endif
|
---|
182 |
|
---|
183 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
---|
184 | !else ; !USE_MUI
|
---|
185 | XPStyle on
|
---|
186 | !ifdef VBOX_WITH_LICENSE_DISPLAY
|
---|
187 | Page license
|
---|
188 | !endif
|
---|
189 | Page components
|
---|
190 | Page directory
|
---|
191 | Page instfiles
|
---|
192 | !endif ; !USE_MUI
|
---|
193 |
|
---|
194 | ; Must come after MUI includes to have certain defines set for DumpLog
|
---|
195 | !include "dumplog.nsh" ; Dump log to file function
|
---|
196 |
|
---|
197 | ; Language files
|
---|
198 | !include "Languages\English.nsh"
|
---|
199 | !include "Languages\French.nsh"
|
---|
200 | !include "Languages\German.nsh"
|
---|
201 |
|
---|
202 | ; Variables and output files
|
---|
203 | Name "${PRODUCT_NAME} $%VBOX_VERSION_STRING%"
|
---|
204 | !ifdef UNINSTALLER_ONLY
|
---|
205 | !echo "Uninstaller only!"
|
---|
206 | OutFile "$%PATH_TARGET%\VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%-uninst.exe"
|
---|
207 | !else
|
---|
208 | OutFile "VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%.exe"
|
---|
209 | !endif ; UNINSTALLER_ONLY
|
---|
210 |
|
---|
211 | ; Define default installation directory
|
---|
212 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
213 | InstallDir "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
|
---|
214 | !else ; 64-bit
|
---|
215 | InstallDir "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
|
---|
216 | !endif
|
---|
217 |
|
---|
218 | InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
---|
219 | ShowInstDetails show
|
---|
220 | ShowUnInstDetails show
|
---|
221 | RequestExecutionLevel highest
|
---|
222 |
|
---|
223 | ; Internal parameters
|
---|
224 | Var g_iSystemMode ; Current system mode (0 = Normal boot, 1 = Fail-safe boot, 2 = Fail-safe with network boot)
|
---|
225 | Var g_strSystemDir ; Windows system directory
|
---|
226 | Var g_strSysWow64 ; The SysWow64 directory on 64-bit systems
|
---|
227 | Var g_strCurUser ; Current user using the system
|
---|
228 | Var g_strAddVerMaj ; Installed Guest Additions: Major version
|
---|
229 | Var g_strAddVerMin ; Installed Guest Additions: Minor version
|
---|
230 | Var g_strAddVerBuild ; Installed Guest Additions: Build number
|
---|
231 | Var g_strAddVerRev ; Installed Guest Additions: SVN revision
|
---|
232 | Var g_strWinVersion ; Current Windows version we're running on
|
---|
233 | Var g_bLogEnable ; Do logging when installing? "true" or "false"
|
---|
234 | Var g_bCapDllCache ; Capability: Does the (Windows) guest have have a DLL cache which needs to be taken care of?
|
---|
235 | Var g_bCapXPDM ; Capability: Is the guest able to handle/use our XPDM driver?
|
---|
236 | Var g_bCapWDDM ; Capability: Is the guest able to handle/use our WDDM driver?
|
---|
237 |
|
---|
238 | ; Command line parameters - these can be set/modified
|
---|
239 | ; on the command line
|
---|
240 | Var g_bForceInstall ; Cmd line: Force installation on unknown Windows OS version
|
---|
241 | Var g_bUninstall ; Cmd line: Just uninstall any previous Guest Additions and exit
|
---|
242 | Var g_bRebootOnExit ; Cmd line: Auto-Reboot on successful installation. Good for unattended installations ("/reboot")
|
---|
243 | Var g_iScreenBpp ; Cmd line: Screen depth ("/depth=X")
|
---|
244 | Var g_iScreenX ; Cmd line: Screen resolution X ("/resx=X")
|
---|
245 | Var g_iScreenY ; Cmd line: Screen resolution Y ("/resy=Y")
|
---|
246 | Var g_iSfOrder ; Cmd line: Order of Shared Folders network provider (0=first, 1=second, ...)
|
---|
247 | Var g_bIgnoreUnknownOpts ; Cmd line: Ignore unknown options (don't display the help)
|
---|
248 | Var g_bNoVBoxServiceExit ; Cmd line: Do not quit VBoxService before updating - install on next reboot
|
---|
249 | Var g_bNoVBoxTrayExit ; Cmd line: Do not quit VBoxTray before updating - install on next reboot
|
---|
250 | Var g_bNoVideoDrv ; Cmd line: Do not install the VBoxVideo driver
|
---|
251 | Var g_bNoGuestDrv ; Cmd line: Do not install the VBoxGuest driver
|
---|
252 | Var g_bNoMouseDrv ; Cmd line: Do not install the VBoxMouse driver
|
---|
253 | Var g_bNoStartMenuEntries ; Cmd line: Do not create start menu entries
|
---|
254 | Var g_bWithAutoLogon ; Cmd line: Install VBoxGINA / VBoxCredProv for auto logon support
|
---|
255 | Var g_bWithWDDM ; Cmd line: Install the WDDM graphics driver instead of the XPDM one
|
---|
256 | Var g_bOnlyExtract ; Cmd line: Only extract all files, do *not* install them. Only valid with param "/D" (target directory)
|
---|
257 | Var g_bPostInstallStatus ; Cmd line: Post the overall installation status to some external program (VBoxTray)
|
---|
258 | Var g_bInstallTimestampCA ; Cmd line: Force installing the timestamp CA on the system
|
---|
259 |
|
---|
260 | ; Platform parts of this installer
|
---|
261 | !include "VBoxGuestAdditionsLog.nsh"
|
---|
262 | !include "VBoxGuestAdditionsExternal.nsh"
|
---|
263 | !include "VBoxGuestAdditionsCommon.nsh"
|
---|
264 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only
|
---|
265 | !include "VBoxGuestAdditionsNT4.nsh"
|
---|
266 | !endif
|
---|
267 | !include "VBoxGuestAdditionsW2KXP.nsh"
|
---|
268 | !include "VBoxGuestAdditionsVista.nsh"
|
---|
269 | !include "VBoxGuestAdditionsUninstall.nsh" ; Product uninstallation
|
---|
270 | !ifndef UNINSTALLER_ONLY
|
---|
271 | !include "VBoxGuestAdditionsUninstallOld.nsh" ; Uninstallation of deprecated versions which must be removed first
|
---|
272 | !endif
|
---|
273 |
|
---|
274 | Function HandleCommandLine
|
---|
275 |
|
---|
276 | Push $0 ; Command line (without process name)
|
---|
277 | Push $1 ; Number of parameters
|
---|
278 | Push $2 ; Current parameter index
|
---|
279 | Push $3 ; Current parameter pair (name=value)
|
---|
280 | Push $4 ; Current parameter name
|
---|
281 | Push $5 ; Current parameter value (if present)
|
---|
282 |
|
---|
283 | StrCpy $1 "0" ; Init param counter
|
---|
284 | StrCpy $2 "1" ; Init current param counter
|
---|
285 |
|
---|
286 | ${GetParameters} $0 ; Extract command line
|
---|
287 | ${If} $0 == "" ; If no parameters at all exit
|
---|
288 | Goto exit
|
---|
289 | ${EndIf}
|
---|
290 |
|
---|
291 | ; Enable for debugging
|
---|
292 | ;MessageBox MB_OK "CmdLine: $0"
|
---|
293 |
|
---|
294 | ${WordFind} $0 " " "#" $1 ; Get number of parameters in cmd line
|
---|
295 | ${If} $0 == $1 ; If result matches the input then
|
---|
296 | StrCpy $1 "1" ; no delimiter was found. Correct to 1 word total
|
---|
297 | ${EndIf}
|
---|
298 |
|
---|
299 | ${While} $2 <= $1 ; Loop through all params
|
---|
300 |
|
---|
301 | ${WordFind} $0 " " "+$2" $3 ; Get current name=value pair
|
---|
302 | ${WordFind} $3 "=" "+1" $4 ; Get current param name
|
---|
303 | ${WordFind} $3 "=" "+2" $5 ; Get current param value
|
---|
304 |
|
---|
305 | ${StrFilter} $4 "-" "" "" $4 ; Transfer param name to lowercase
|
---|
306 |
|
---|
307 | ; Enable for debugging
|
---|
308 | ;MessageBox MB_OK "#$2 of #$1, param='$3', name=$4, val=$5"
|
---|
309 |
|
---|
310 | ${Switch} $4
|
---|
311 |
|
---|
312 | ${Case} '/d' ; NSIS: /D=<instdir> switch, skip
|
---|
313 | ${Break}
|
---|
314 |
|
---|
315 | ${Case} '/depth'
|
---|
316 | ${Case} 'depth'
|
---|
317 | StrCpy $g_iScreenBpp $5
|
---|
318 | ${Break}
|
---|
319 |
|
---|
320 | ${Case} '/extract'
|
---|
321 | StrCpy $g_bOnlyExtract "true"
|
---|
322 | ${Break}
|
---|
323 |
|
---|
324 | ${Case} '/force'
|
---|
325 | StrCpy $g_bForceInstall "true"
|
---|
326 | ${Break}
|
---|
327 |
|
---|
328 | ${Case} '/help'
|
---|
329 | ${Case} '/H'
|
---|
330 | ${Case} '/h'
|
---|
331 | ${Case} '/?'
|
---|
332 | Goto usage
|
---|
333 | ${Break}
|
---|
334 |
|
---|
335 | ${Case} '/ignore_unknownopts' ; Not officially documented
|
---|
336 | StrCpy $g_bIgnoreUnknownOpts "true"
|
---|
337 | ${Break}
|
---|
338 |
|
---|
339 | ${Case} '/l'
|
---|
340 | ${Case} '/log'
|
---|
341 | ${Case} '/logging'
|
---|
342 | StrCpy $g_bLogEnable "true"
|
---|
343 | ${Break}
|
---|
344 |
|
---|
345 | ${Case} '/ncrc' ; NSIS: /NCRC switch, skip
|
---|
346 | ${Break}
|
---|
347 |
|
---|
348 | ${Case} '/no_vboxservice_exit' ; Not officially documented
|
---|
349 | StrCpy $g_bNoVBoxServiceExit "true"
|
---|
350 | ${Break}
|
---|
351 |
|
---|
352 | ${Case} '/no_vboxtray_exit' ; Not officially documented
|
---|
353 | StrCpy $g_bNoVBoxTrayExit "true"
|
---|
354 | ${Break}
|
---|
355 |
|
---|
356 | ${Case} '/no_videodrv' ; Not officially documented
|
---|
357 | StrCpy $g_bNoVideoDrv "true"
|
---|
358 | ${Break}
|
---|
359 |
|
---|
360 | ${Case} '/no_guestdrv' ; Not officially documented
|
---|
361 | StrCpy $g_bNoGuestDrv "true"
|
---|
362 | ${Break}
|
---|
363 |
|
---|
364 | ${Case} '/no_mousedrv' ; Not officially documented
|
---|
365 | StrCpy $g_bNoMouseDrv "true"
|
---|
366 | ${Break}
|
---|
367 |
|
---|
368 | ${Case} '/no_startmenuentries' ; Not officially documented
|
---|
369 | StrCpy $g_bNoStartMenuEntries "true"
|
---|
370 | ${Break}
|
---|
371 |
|
---|
372 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
373 | ; This switch tells our installer that it
|
---|
374 | ; - should not quit VBoxTray during the update, because ...
|
---|
375 | ; - ... it should show the overall installation status
|
---|
376 | ; using VBoxTray's balloon message feature (since VBox 4.0)
|
---|
377 | ${Case} '/post_installstatus' ; Not officially documented
|
---|
378 | StrCpy $g_bNoVBoxTrayExit "true"
|
---|
379 | StrCpy $g_bPostInstallStatus "true"
|
---|
380 | ${Break}
|
---|
381 | !endif
|
---|
382 |
|
---|
383 | ${Case} '/install_timestamp_ca' ; Not officially documented
|
---|
384 | StrCpy $g_bInstallTimestampCA "true"
|
---|
385 | ${Break}
|
---|
386 |
|
---|
387 | ${Case} '/no_install_timestamp_ca' ; Ditto
|
---|
388 | StrCpy $g_bInstallTimestampCA "false"
|
---|
389 | ${Break}
|
---|
390 |
|
---|
391 | ${Case} '/reboot'
|
---|
392 | StrCpy $g_bRebootOnExit "true"
|
---|
393 | ${Break}
|
---|
394 |
|
---|
395 | ${Case} '/s' ; NSIS: /S switch, skip
|
---|
396 | ${Break}
|
---|
397 |
|
---|
398 | ${Case} '/sforder'
|
---|
399 | ${Case} 'sforder'
|
---|
400 | StrCpy $g_iSfOrder $5
|
---|
401 | ${Break}
|
---|
402 |
|
---|
403 | ${Case} '/uninstall'
|
---|
404 | StrCpy $g_bUninstall "true"
|
---|
405 | ${Break}
|
---|
406 |
|
---|
407 | ${Case} '/with_autologon'
|
---|
408 | StrCpy $g_bWithAutoLogon "true"
|
---|
409 | ${Break}
|
---|
410 |
|
---|
411 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
412 | ${Case} '/with_wddm'
|
---|
413 | StrCpy $g_bWithWDDM "true"
|
---|
414 | ${Break}
|
---|
415 | !endif
|
---|
416 |
|
---|
417 | ${Case} '/xres'
|
---|
418 | ${Case} 'xres'
|
---|
419 | StrCpy $g_iScreenX $5
|
---|
420 | ${Break}
|
---|
421 |
|
---|
422 | ${Case} '/yres'
|
---|
423 | ${Case} 'yres'
|
---|
424 | StrCpy $g_iScreenY $5
|
---|
425 | ${Break}
|
---|
426 |
|
---|
427 | ${Default} ; Unknown parameter, print usage message
|
---|
428 | ; Prevent popping up usage message on (yet) unknown parameters
|
---|
429 | ; in silent mode, just skip
|
---|
430 | IfSilent +1 +2
|
---|
431 | ${Break}
|
---|
432 | goto usage
|
---|
433 | ${Break}
|
---|
434 |
|
---|
435 | ${EndSwitch}
|
---|
436 |
|
---|
437 | next_param:
|
---|
438 |
|
---|
439 | IntOp $2 $2 + 1
|
---|
440 |
|
---|
441 | ${EndWhile}
|
---|
442 | Goto exit
|
---|
443 |
|
---|
444 | usage:
|
---|
445 |
|
---|
446 | ; If we were told to ignore unknown (invalid) options, just return to
|
---|
447 | ; the parsing loop ...
|
---|
448 | ${If} $g_bIgnoreUnknownOpts == "true"
|
---|
449 | Goto next_param
|
---|
450 | ${EndIf}
|
---|
451 | MessageBox MB_OK "${PRODUCT_NAME} Installer$\r$\n$\r$\n \
|
---|
452 | Usage: VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH% [OPTIONS] [/l] [/S] [/D=<PATH>]$\r$\n$\r$\n \
|
---|
453 | Options:$\r$\n \
|
---|
454 | /depth=BPP$\tSets the guest's display color depth (bits per pixel)$\r$\n \
|
---|
455 | /extract$\t$\tOnly extract installation files$\r$\n \
|
---|
456 | /force$\t$\tForce installation on unknown/undetected Windows versions$\r$\n \
|
---|
457 | /uninstall$\t$\tJust uninstalls the Guest Additions and exits$\r$\n \
|
---|
458 | /with_autologon$\tInstalls auto-logon support$\r$\n \
|
---|
459 | /with_d3d$\tInstalls D3D support$\r$\n \
|
---|
460 | /with_wddm$\tInstalls the WDDM instead of the XPDM graphics driver$\r$\n \
|
---|
461 | /xres=X$\t$\tSets the guest's display resolution (width in pixels)$\r$\n \
|
---|
462 | /yres=Y$\t$\tSets the guest's display resolution (height in pixels)$\r$\n \
|
---|
463 | $\r$\n \
|
---|
464 | Installer parameters:$\r$\n \
|
---|
465 | /l$\t$\tEnables logging$\r$\n \
|
---|
466 | /S$\t$\tSilent install$\r$\n \
|
---|
467 | /D=<PATH>$\tSets the default install path$\r$\n \
|
---|
468 | $\r$\n \
|
---|
469 | Note: Order of options and installer parameters is fixed, options first." /SD IDOK
|
---|
470 |
|
---|
471 | ; No stack restore needed, we're about to quit
|
---|
472 | Quit
|
---|
473 |
|
---|
474 | !ifdef UNUSED_CODE
|
---|
475 | done:
|
---|
476 |
|
---|
477 | !ifdef _DEBUG
|
---|
478 | ${LogVerbose} "Property: XRes: $g_iScreenX"
|
---|
479 | ${LogVerbose} "Property: YRes: $g_iScreenY"
|
---|
480 | ${LogVerbose} "Property: BPP: $g_iScreenBpp"
|
---|
481 | ${LogVerbose} "Property: Logging enabled: $g_bLogEnable"
|
---|
482 | !endif
|
---|
483 | !endif ;UNUSED_CODE
|
---|
484 |
|
---|
485 | exit:
|
---|
486 |
|
---|
487 | Pop $5
|
---|
488 | Pop $4
|
---|
489 | Pop $3
|
---|
490 | Pop $2
|
---|
491 | Pop $1
|
---|
492 | Pop $0
|
---|
493 |
|
---|
494 | FunctionEnd
|
---|
495 |
|
---|
496 | !ifndef UNINSTALLER_ONLY
|
---|
497 |
|
---|
498 | Function CheckForOldGuestAdditions
|
---|
499 |
|
---|
500 | Push $0
|
---|
501 | Push $1
|
---|
502 | Push $2
|
---|
503 |
|
---|
504 | ${LogVerbose} "Checking for old Guest Additions ..."
|
---|
505 |
|
---|
506 | ; Check for old "Sun VirtualBox Guest Additions"
|
---|
507 | ; - before rebranding to Oracle
|
---|
508 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun VirtualBox Guest Additions" "UninstallString"
|
---|
509 | StrCmp $0 "" sun_xvm_check ; If string is empty, Sun additions are probably not installed (anymore)
|
---|
510 |
|
---|
511 | MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_uninstall
|
---|
512 | Pop $2
|
---|
513 | Pop $1
|
---|
514 | Pop $0
|
---|
515 | MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
|
---|
516 | Quit
|
---|
517 |
|
---|
518 | sun_uninstall:
|
---|
519 |
|
---|
520 | Call Uninstall_Sun
|
---|
521 | Goto success
|
---|
522 |
|
---|
523 | sun_xvm_check:
|
---|
524 |
|
---|
525 | ; Check for old "Sun xVM VirtualBox Guest Additions"
|
---|
526 | ; - before getting rid of the "xVM" namespace
|
---|
527 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun xVM VirtualBox Guest Additions" "UninstallString"
|
---|
528 | StrCmp $0 "" innotek_check ; If string is empty, Sun xVM additions are probably not installed (anymore)
|
---|
529 |
|
---|
530 | MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_xvm_uninstall
|
---|
531 | Pop $2
|
---|
532 | Pop $1
|
---|
533 | Pop $0
|
---|
534 | MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
|
---|
535 | Quit
|
---|
536 |
|
---|
537 | sun_xvm_uninstall:
|
---|
538 |
|
---|
539 | Call Uninstall_SunXVM
|
---|
540 | Goto success
|
---|
541 |
|
---|
542 | innotek_check:
|
---|
543 |
|
---|
544 | ; Check for old "innotek" Guest Additions" before rebranding to "Sun"
|
---|
545 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\innotek VirtualBox Guest Additions" "UninstallString"
|
---|
546 | StrCmp $0 "" exit ; If string is empty, innotek Guest Additions are probably not installed (anymore)
|
---|
547 |
|
---|
548 | MessageBox MB_YESNO $(VBOX_INNOTEK_FOUND) /SD IDYES IDYES innotek_uninstall
|
---|
549 | Pop $2
|
---|
550 | Pop $1
|
---|
551 | Pop $0
|
---|
552 | MessageBox MB_ICONSTOP $(VBOX_INNOTEK_ABORTED) /SD IDOK
|
---|
553 | Quit
|
---|
554 |
|
---|
555 | innotek_uninstall:
|
---|
556 |
|
---|
557 | Call Uninstall_Innotek
|
---|
558 | Goto success
|
---|
559 |
|
---|
560 | success:
|
---|
561 |
|
---|
562 | ; Nothing to do here yet
|
---|
563 |
|
---|
564 | exit:
|
---|
565 |
|
---|
566 | Pop $2
|
---|
567 | Pop $1
|
---|
568 | Pop $0
|
---|
569 |
|
---|
570 | FunctionEnd
|
---|
571 |
|
---|
572 | Function CheckForInstalledComponents
|
---|
573 |
|
---|
574 | Push $0
|
---|
575 | Push $1
|
---|
576 |
|
---|
577 | ${LogVerbose} "Checking for installed components ..."
|
---|
578 | StrCpy $1 ""
|
---|
579 |
|
---|
580 | Call SetAppMode64
|
---|
581 |
|
---|
582 | ; VBoxGINA already installed? So we need to update the installed version as well,
|
---|
583 | ; regardless whether the user used "/with_autologon" or not
|
---|
584 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
|
---|
585 | ${If} $0 == "VBoxGINA.dll"
|
---|
586 | StrCpy $1 "GINA"
|
---|
587 | ${Else}
|
---|
588 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" ""
|
---|
589 | ${If} $0 == "VBoxCredProv"
|
---|
590 | StrCpy $1 "Credential Provider"
|
---|
591 | ${EndIf}
|
---|
592 | ${EndIf}
|
---|
593 |
|
---|
594 | !ifdef _DEBUG
|
---|
595 | ${LogVerbose} "Auto-logon module: $0"
|
---|
596 | !endif
|
---|
597 |
|
---|
598 | ${IfNot} $1 == ""
|
---|
599 | ${LogVerbose} "Auto-logon support ($1) was installed previously"
|
---|
600 | StrCpy $g_bWithAutoLogon "true" ; Force update
|
---|
601 | ${Else}
|
---|
602 | ${LogVerbose} "Auto-logon support was not installed previously"
|
---|
603 | ${EndIf}
|
---|
604 |
|
---|
605 | Pop $1
|
---|
606 | Pop $0
|
---|
607 |
|
---|
608 | FunctionEnd
|
---|
609 |
|
---|
610 | !endif ; UNINSTALLER_ONLY
|
---|
611 |
|
---|
612 | ;
|
---|
613 | ; Main Files
|
---|
614 | ;
|
---|
615 | Section $(VBOX_COMPONENT_MAIN) SEC01
|
---|
616 |
|
---|
617 | SectionIn RO ; Section cannot be unselected (read-only)
|
---|
618 | ${If} $g_bPostInstallStatus == "true"
|
---|
619 | ${LogToVBoxTray} "0" "${PRODUCT_NAME} update started, please wait ..."
|
---|
620 | ${EndIf}
|
---|
621 |
|
---|
622 | IfSilent +1 +2
|
---|
623 | StrCpy $g_bLogEnable "true" ; Force logging in silent mode
|
---|
624 |
|
---|
625 | ${LogEnable} "$g_bLogEnable"
|
---|
626 | IfSilent +1 +2 ; NSIS will expand ${LogVerbose} before doing relative jumps!
|
---|
627 | LogText "Installer runs in silent mode"
|
---|
628 |
|
---|
629 | SetOutPath "$INSTDIR"
|
---|
630 | SetOverwrite on
|
---|
631 |
|
---|
632 | Call SetAppMode64
|
---|
633 |
|
---|
634 | StrCpy $g_strSystemDir "$SYSDIR"
|
---|
635 |
|
---|
636 | ${LogVerbose} "Version: $%VBOX_VERSION_STRING% (Rev $%VBOX_SVN_REV%)"
|
---|
637 | ${If} $g_strAddVerMaj != ""
|
---|
638 | ${LogVerbose} "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
|
---|
639 | ${Else}
|
---|
640 | ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected"
|
---|
641 | ${EndIf}
|
---|
642 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
643 | ${LogVerbose} "Detected OS: Windows $g_strWinVersion (64-bit)"
|
---|
644 | !else
|
---|
645 | ${LogVerbose} "Detected OS: Windows $g_strWinVersion (32-bit)"
|
---|
646 | !endif
|
---|
647 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
648 |
|
---|
649 | !ifdef _DEBUG
|
---|
650 | ${LogVerbose} "Installer runs in debug mode"
|
---|
651 | !endif
|
---|
652 |
|
---|
653 | ;
|
---|
654 | ; Here starts the main dispatcher (based on guest OS)
|
---|
655 | ;
|
---|
656 |
|
---|
657 | ; Which OS are we using?
|
---|
658 | ; @todo Use logic lib here
|
---|
659 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
660 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
661 | !endif
|
---|
662 | StrCmp $g_strWinVersion "2000" w2k_xp_w2k3 ; Windows 2000
|
---|
663 | StrCmp $g_strWinVersion "XP" w2k_xp_w2k3 ; Windows XP
|
---|
664 | StrCmp $g_strWinVersion "2003" w2k_xp_w2k3 ; Windows 2003 Server
|
---|
665 | StrCmp $g_strWinVersion "Vista" vista_and_later ; Windows Vista
|
---|
666 | StrCmp $g_strWinVersion "7" vista_and_later ; Windows 7
|
---|
667 | StrCmp $g_strWinVersion "8" vista_and_later ; Windows 8
|
---|
668 | StrCmp $g_strWinVersion "8_1" vista_and_later ; Windows 8.1 / Windows 2012 Server R2
|
---|
669 | StrCmp $g_strWinVersion "10" vista_and_later ; Windows 10
|
---|
670 |
|
---|
671 | ${If} $g_bForceInstall == "true"
|
---|
672 | Goto vista_and_later ; Assume newer OS than we know of ...
|
---|
673 | ${EndIf}
|
---|
674 |
|
---|
675 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
676 | goto exit
|
---|
677 |
|
---|
678 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
679 | nt4: ; Windows NT4
|
---|
680 |
|
---|
681 | Call GetServicePack
|
---|
682 | Pop $R0 ; Major version
|
---|
683 | Pop $R1 ; Minor version
|
---|
684 |
|
---|
685 | ; At least Service Pack 6 installed?
|
---|
686 | ${If} $R0 <> "6"
|
---|
687 | MessageBox MB_YESNO $(VBOX_NT4_NO_SP6) /SD IDYES IDYES +2
|
---|
688 | Quit
|
---|
689 | ${EndIf}
|
---|
690 |
|
---|
691 | ; Copy some common files ...
|
---|
692 | Call Common_CopyFiles
|
---|
693 |
|
---|
694 | Call NT4_Main
|
---|
695 | goto success
|
---|
696 | !endif
|
---|
697 |
|
---|
698 | ;
|
---|
699 | ; Windows 2000, XP and Windows Server 2003 / XP64
|
---|
700 | ;
|
---|
701 | w2k_xp_w2k3:
|
---|
702 |
|
---|
703 | ; Copy some common files ...
|
---|
704 | Call Common_CopyFiles
|
---|
705 |
|
---|
706 | Call W2K_Main
|
---|
707 | goto success
|
---|
708 |
|
---|
709 | ;
|
---|
710 | ; Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 and related server products.
|
---|
711 | ;
|
---|
712 | vista_and_later:
|
---|
713 |
|
---|
714 | ; Check requirments; this function can abort the installation if necessary!
|
---|
715 | Call Vista_CheckForRequirements
|
---|
716 |
|
---|
717 | ; Copy some common files ...
|
---|
718 | Call Common_CopyFiles
|
---|
719 |
|
---|
720 | Call W2K_Main ; First install stuff for Windows 2000, XP, W2K3/XP64 ...
|
---|
721 | Call Vista_Main ; ... and some specific stuff for Vista and later.
|
---|
722 | goto success
|
---|
723 |
|
---|
724 | success:
|
---|
725 |
|
---|
726 | ; Write a registry key with version and installation path for later lookup
|
---|
727 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Version" "$%VBOX_VERSION_STRING_RAW%"
|
---|
728 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "VersionExt" "$%VBOX_VERSION_STRING%"
|
---|
729 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Revision" "$%VBOX_SVN_REV%"
|
---|
730 | WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "InstallDir" "$INSTDIR"
|
---|
731 |
|
---|
732 | ; Set the reboot flag to tell the finish page that is should
|
---|
733 | ; default to the "reboot now" entry
|
---|
734 | SetRebootFlag true
|
---|
735 |
|
---|
736 | exit:
|
---|
737 |
|
---|
738 | SectionEnd
|
---|
739 |
|
---|
740 | ;;
|
---|
741 | ; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch)
|
---|
742 | ;
|
---|
743 | Section /o -$(VBOX_COMPONENT_AUTOLOGON) SEC02
|
---|
744 |
|
---|
745 | Call SetAppMode64
|
---|
746 |
|
---|
747 | Call GetWindowsVersion
|
---|
748 | Pop $R0 ; Windows Version
|
---|
749 |
|
---|
750 | ${LogVerbose} "Installing auto-logon support ..."
|
---|
751 |
|
---|
752 | ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
|
---|
753 | ; whether to replace it with the VirtualBox one or not
|
---|
754 | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
|
---|
755 | ${If} $0 != ""
|
---|
756 | ${If} $0 != "VBoxGINA.dll"
|
---|
757 | ${LogVerbose} "Found another already installed GINA module: $0"
|
---|
758 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
|
---|
759 | ${LogVerbose} "Skipping GINA installation, keeping: $0"
|
---|
760 | goto skip
|
---|
761 | ${EndIf}
|
---|
762 | ${EndIf}
|
---|
763 |
|
---|
764 | install:
|
---|
765 |
|
---|
766 | ; Do we need VBoxCredProv or VBoxGINA?
|
---|
767 | ${If} $R0 == 'Vista' ; Windows Vista.
|
---|
768 | ${OrIf} $R0 == '7' ; Windows 7.
|
---|
769 | ${OrIf} $R0 == '8' ; Windows 8.
|
---|
770 | ${OrIf} $R0 == '8_1' ; Windows 8.1 / Windows Server 2012 R2.
|
---|
771 | ${OrIf} $R0 == '10' ; Windows 10.
|
---|
772 | ; Use VBoxCredProv on Vista and up.
|
---|
773 | ${LogVerbose} "Installing VirtualBox credential provider ..."
|
---|
774 | !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
|
---|
775 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
|
---|
776 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
|
---|
777 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
|
---|
778 | WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
|
---|
779 | ${Else} ; Use VBoxGINA on older Windows OSes (< Vista)
|
---|
780 | ${LogVerbose} "Installing VirtualBox GINA ..."
|
---|
781 | !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
|
---|
782 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
|
---|
783 | ; Add Windows notification package callbacks for VBoxGINA
|
---|
784 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "DLLName" "VBoxGINA.dll"
|
---|
785 | WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "Impersonate" 0
|
---|
786 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "StopScreenSaver" "WnpScreenSaverStop"
|
---|
787 | ${EndIf}
|
---|
788 |
|
---|
789 | skip:
|
---|
790 |
|
---|
791 | SectionEnd
|
---|
792 |
|
---|
793 | ; Direct3D support
|
---|
794 | Section /o $(VBOX_COMPONENT_D3D) SEC03
|
---|
795 |
|
---|
796 | ; Nothing to do in here right now.
|
---|
797 |
|
---|
798 | SectionEnd
|
---|
799 |
|
---|
800 | ; Start menu entries. Enabled by default and can be disabled by the user.
|
---|
801 | Section /o $(VBOX_COMPONENT_STARTMENU) SEC04
|
---|
802 |
|
---|
803 | CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
|
---|
804 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
|
---|
805 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
|
---|
806 |
|
---|
807 | SectionEnd
|
---|
808 |
|
---|
809 | !ifdef USE_MUI
|
---|
810 | ;Assign language strings to sections
|
---|
811 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
812 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
|
---|
813 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
|
---|
814 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
|
---|
815 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(VBOX_COMPONENT_STARTMENU_DESC)
|
---|
816 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
817 | !endif ; USE_MUI
|
---|
818 |
|
---|
819 | Section -Content
|
---|
820 |
|
---|
821 | WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
---|
822 |
|
---|
823 | SectionEnd
|
---|
824 |
|
---|
825 | ; This section is called after all the files are in place
|
---|
826 | Section -Post
|
---|
827 |
|
---|
828 | !ifdef _DEBUG
|
---|
829 | ${LogVerbose} "Doing post install ..."
|
---|
830 | !endif
|
---|
831 |
|
---|
832 | !ifdef EXTERNAL_UNINSTALLER
|
---|
833 | SetOutPath "$INSTDIR"
|
---|
834 | FILE "$%PATH_TARGET%\uninst.exe"
|
---|
835 | !else
|
---|
836 | WriteUninstaller "$INSTDIR\uninst.exe"
|
---|
837 | !endif
|
---|
838 |
|
---|
839 | ; Write uninstaller in "Add / Remove programs"
|
---|
840 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
---|
841 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
|
---|
842 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
---|
843 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
---|
844 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
---|
845 |
|
---|
846 | ; Tune TcpWindowSize for a better network throughput
|
---|
847 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
|
---|
848 |
|
---|
849 | !ifdef _DEBUG
|
---|
850 | ${LogVerbose} "Enable Backdoor logging for debug build."
|
---|
851 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "LoggingEnabled" 255
|
---|
852 | !endif
|
---|
853 |
|
---|
854 | ; Add Sun Ray client info keys
|
---|
855 | ; Note: We only need 32-bit keys (HKLM\Software / HKLM\Software\Wow6432Node)
|
---|
856 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
857 | WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
|
---|
858 | WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
|
---|
859 | !else
|
---|
860 | WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
|
---|
861 | WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
|
---|
862 | !endif
|
---|
863 |
|
---|
864 | ${LogVerbose} "Installation completed."
|
---|
865 |
|
---|
866 | ;
|
---|
867 | ; Dump UI log to on success too. Only works with non-silent installs.
|
---|
868 | ; (This has to be done here rather than in .onInstSuccess, because by
|
---|
869 | ; then the log is no longer visible in the UI.)
|
---|
870 | ;
|
---|
871 | ${IfNot} ${Silent}
|
---|
872 | StrCpy $0 "$INSTDIR\install_ui.log"
|
---|
873 | Push $0
|
---|
874 | Call DumpLog
|
---|
875 | ${EndIf}
|
---|
876 |
|
---|
877 | SectionEnd
|
---|
878 |
|
---|
879 | ;;
|
---|
880 | ; !!! NOTE: This function *has* to be right under the last section; otherwise it does
|
---|
881 | ; *not* get called! Don't ask me why ... !!!
|
---|
882 | Function .onSelChange
|
---|
883 |
|
---|
884 | Push $0
|
---|
885 |
|
---|
886 | ; Handle selection of WDDM component
|
---|
887 | SectionGetFlags ${SEC03} $0
|
---|
888 | ${If} $0 == ${SF_SELECTED}
|
---|
889 |
|
---|
890 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
891 | ; If we're able to use the WDDM driver just use it.
|
---|
892 | ${If} $g_bCapWDDM == "true"
|
---|
893 | StrCpy $g_bWithWDDM "true"
|
---|
894 | ${EndIf}
|
---|
895 |
|
---|
896 | !endif ; $%VBOX_WITH_WDDM% == "1"
|
---|
897 |
|
---|
898 | ${Else} ; WDDM unselected again
|
---|
899 |
|
---|
900 | ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory
|
---|
901 | ${AndIf} $g_strWinVersion != "8_1" ; ... also on Windows 8.1 / Windows 2012 Server R2
|
---|
902 | ${AndIf} $g_strWinVersion != "10" ; ... also on Windows 10
|
---|
903 | StrCpy $g_bWithWDDM "false"
|
---|
904 | ${EndIf}
|
---|
905 |
|
---|
906 | ${EndIf}
|
---|
907 |
|
---|
908 | Pop $0
|
---|
909 |
|
---|
910 | FunctionEnd
|
---|
911 |
|
---|
912 | ;;
|
---|
913 | ; This function is called when a critical error occurred, caused by
|
---|
914 | ; the Abort command
|
---|
915 | ;
|
---|
916 | Function .onInstFailed
|
---|
917 |
|
---|
918 | ${LogVerbose} "$(VBOX_ERROR_INST_FAILED)"
|
---|
919 | MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
|
---|
920 |
|
---|
921 | ${If} $g_bPostInstallStatus == "true"
|
---|
922 | ${LogToVBoxTray} "2" "Error while installing ${PRODUCT_NAME}!"
|
---|
923 | ${EndIf}
|
---|
924 |
|
---|
925 | ; Dump UI log to see what happend. Only works with non-silent installs.
|
---|
926 | ${IfNot} ${Silent}
|
---|
927 | StrCpy $0 "$INSTDIR\install_ui.log"
|
---|
928 | Push $0
|
---|
929 | Call DumpLog
|
---|
930 | ${EndIf}
|
---|
931 |
|
---|
932 | ; Set overall exit code
|
---|
933 | SetErrorLevel 1
|
---|
934 |
|
---|
935 | FunctionEnd
|
---|
936 |
|
---|
937 | ;;
|
---|
938 | ; This function is called when installation was successful!
|
---|
939 | ;
|
---|
940 | Function .onInstSuccess
|
---|
941 |
|
---|
942 | ${LogVerbose} "${PRODUCT_NAME} successfully installed"
|
---|
943 |
|
---|
944 | ${If} $g_bPostInstallStatus == "true"
|
---|
945 | ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
|
---|
946 | ${EndIf}
|
---|
947 |
|
---|
948 | SetErrorLevel 0
|
---|
949 |
|
---|
950 | FunctionEnd
|
---|
951 |
|
---|
952 | ;;
|
---|
953 | ; This function is called at the very beginning of installer execution
|
---|
954 | ;
|
---|
955 | Function .onInit
|
---|
956 |
|
---|
957 | Push $0
|
---|
958 |
|
---|
959 | ; Init values
|
---|
960 | StrCpy $g_iSystemMode "0"
|
---|
961 | StrCpy $g_strCurUser "<None>"
|
---|
962 | StrCpy $g_strAddVerMaj "0"
|
---|
963 | StrCpy $g_strAddVerMin "0"
|
---|
964 | StrCpy $g_strAddVerBuild "0"
|
---|
965 | StrCpy $g_strAddVerRev "0"
|
---|
966 |
|
---|
967 | StrCpy $g_bIgnoreUnknownOpts "false"
|
---|
968 | StrCpy $g_bLogEnable "false"
|
---|
969 | StrCpy $g_bForceInstall "false"
|
---|
970 | StrCpy $g_bUninstall "false"
|
---|
971 | StrCpy $g_bRebootOnExit "false"
|
---|
972 | StrCpy $g_iScreenX "0"
|
---|
973 | StrCpy $g_iScreenY "0"
|
---|
974 | StrCpy $g_iScreenBpp "0"
|
---|
975 | StrCpy $g_iSfOrder "0"
|
---|
976 | StrCpy $g_bNoVBoxServiceExit "false"
|
---|
977 | StrCpy $g_bNoVBoxTrayExit "false"
|
---|
978 | StrCpy $g_bNoVideoDrv "false"
|
---|
979 | StrCpy $g_bNoGuestDrv "false"
|
---|
980 | StrCpy $g_bNoMouseDrv "false"
|
---|
981 | StrCpy $g_bNoStartMenuEntries "false"
|
---|
982 | StrCpy $g_bWithAutoLogon "false"
|
---|
983 | StrCpy $g_bOnlyExtract "false"
|
---|
984 | StrCpy $g_bWithWDDM "false"
|
---|
985 | StrCpy $g_bCapDllCache "false"
|
---|
986 | StrCpy $g_bCapXPDM "false"
|
---|
987 | StrCpy $g_bCapWDDM "false"
|
---|
988 | StrCpy $g_bPostInstallStatus "false"
|
---|
989 | StrCpy $g_bInstallTimestampCA "unset" ; Tri-state: "unset", "true" and "false"
|
---|
990 |
|
---|
991 | ; We need a special directory set to SysWOW64 because some
|
---|
992 | ; shell operations don't support file redirection (yet)
|
---|
993 | StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
|
---|
994 |
|
---|
995 | SetErrorLevel 0
|
---|
996 | ClearErrors
|
---|
997 |
|
---|
998 | !ifdef UNINSTALLER_ONLY
|
---|
999 |
|
---|
1000 | ;
|
---|
1001 | ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
|
---|
1002 | ; so we can sign it
|
---|
1003 | ;
|
---|
1004 | ; Note that the Quit causes the exit status to be 2 instead of 0
|
---|
1005 | ;
|
---|
1006 | WriteUninstaller "$%PATH_TARGET%\uninst.exe"
|
---|
1007 | Quit
|
---|
1008 |
|
---|
1009 | !else
|
---|
1010 |
|
---|
1011 | ; Handle command line
|
---|
1012 | Call HandleCommandLine
|
---|
1013 |
|
---|
1014 | ; Check if there's already another instance of the installer is running -
|
---|
1015 | ; important for preventing NT4 to spawn the installer twice
|
---|
1016 | System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
|
---|
1017 | Pop $0
|
---|
1018 | ${If} $0 != 0
|
---|
1019 | Quit
|
---|
1020 | ${EndIf}
|
---|
1021 |
|
---|
1022 | ; Retrieve Windows version and store result in $g_strWinVersion
|
---|
1023 | Call GetWindowsVersionEx
|
---|
1024 | Pop $g_strWinVersion
|
---|
1025 |
|
---|
1026 | ; Retrieve capabilities
|
---|
1027 | Call CheckForCapabilities
|
---|
1028 |
|
---|
1029 | ; Get user Name
|
---|
1030 | AccessControl::GetCurrentUserName
|
---|
1031 | Pop $g_strCurUser
|
---|
1032 | ${LogVerbose} "Current user: $g_strCurUser"
|
---|
1033 |
|
---|
1034 | ; Only extract files? This action can be called even from non-Admin users
|
---|
1035 | ; and non-compatible architectures
|
---|
1036 | ${If} $g_bOnlyExtract == "true"
|
---|
1037 | Call ExtractFiles
|
---|
1038 | MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
|
---|
1039 | Quit
|
---|
1040 | ${EndIf}
|
---|
1041 |
|
---|
1042 | ; Check for correct architecture
|
---|
1043 | Call CheckArchitecture
|
---|
1044 | Pop $0
|
---|
1045 | ${If} $0 <> 0 ; Wrong architecture? Tell the world
|
---|
1046 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
1047 | MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
|
---|
1048 | !else
|
---|
1049 | MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
|
---|
1050 | !endif
|
---|
1051 | Abort "$(VBOX_NOTICE_ARCH_AMD64)"
|
---|
1052 | ${EndIf}
|
---|
1053 |
|
---|
1054 | ; Has the user who calls us admin rights?
|
---|
1055 | UserInfo::GetAccountType
|
---|
1056 | Pop $0
|
---|
1057 | ${If} $0 != "Admin"
|
---|
1058 | MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
|
---|
1059 | Abort
|
---|
1060 | ${EndIf}
|
---|
1061 |
|
---|
1062 | ; Only uninstall?
|
---|
1063 | ${If} $g_bUninstall == "true"
|
---|
1064 | Call Uninstall_Innotek
|
---|
1065 | Call Uninstall
|
---|
1066 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
|
---|
1067 | Quit
|
---|
1068 | ${EndIf}
|
---|
1069 |
|
---|
1070 | Call CheckForInstalledComponents
|
---|
1071 |
|
---|
1072 | ;
|
---|
1073 | ; Section 02
|
---|
1074 | ;
|
---|
1075 | ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
|
---|
1076 | !insertmacro SelectSection ${SEC02}
|
---|
1077 | ${EndIf}
|
---|
1078 |
|
---|
1079 | ;
|
---|
1080 | ; Section 03
|
---|
1081 | ;
|
---|
1082 | ${If} $g_bWithWDDM == "true" ; D3D / WDDM support
|
---|
1083 | !insertmacro SelectSection ${SEC03}
|
---|
1084 | ${EndIf}
|
---|
1085 | ; On Windows 8 / 8.1 / Windows Server 2012 R2 and newer we always select the 3D
|
---|
1086 | ; section and disable it so that it cannot be deselected again
|
---|
1087 | ${If} $g_strWinVersion == "8"
|
---|
1088 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
1089 | ${OrIf} $g_strWinVersion == "10"
|
---|
1090 | IntOp $0 ${SF_SELECTED} | ${SF_RO}
|
---|
1091 | SectionSetFlags ${SEC03} $0
|
---|
1092 | ${EndIf}
|
---|
1093 | ; If the guest is not able to handle/use our WDDM driver, then 3D is not available
|
---|
1094 | ${If} $g_bCapWDDM != "true"
|
---|
1095 | SectionSetFlags ${SEC03} ${SF_RO}
|
---|
1096 | ${EndIf}
|
---|
1097 |
|
---|
1098 | ;
|
---|
1099 | ; Section 04
|
---|
1100 | ;
|
---|
1101 | ${If} $g_bNoStartMenuEntries == "false" ; Start menu entries
|
---|
1102 | !insertmacro SelectSection ${SEC04}
|
---|
1103 | ${EndIf}
|
---|
1104 |
|
---|
1105 | !ifdef USE_MUI
|
---|
1106 | ; Display language selection dialog (will be hidden in silent mode!)
|
---|
1107 | !ifdef VBOX_INSTALLER_ADD_LANGUAGES
|
---|
1108 | !insertmacro MUI_LANGDLL_DISPLAY
|
---|
1109 | !endif
|
---|
1110 | !endif
|
---|
1111 |
|
---|
1112 | Call SetAppMode64
|
---|
1113 |
|
---|
1114 | ; Check for old additions
|
---|
1115 | Call CheckForOldGuestAdditions
|
---|
1116 | Call GetAdditionsVersion
|
---|
1117 |
|
---|
1118 | ; Due to some bug in NSIS the license page won't be displayed if we're in
|
---|
1119 | ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
|
---|
1120 | ; mode for now
|
---|
1121 | Call SetAppMode32
|
---|
1122 |
|
---|
1123 | !endif ; UNINSTALLER_ONLY
|
---|
1124 |
|
---|
1125 | Pop $0
|
---|
1126 |
|
---|
1127 | FunctionEnd
|
---|
1128 |
|
---|
1129 | ;
|
---|
1130 | ; The uninstaller is built separately when doing code signing
|
---|
1131 | ;
|
---|
1132 | ; When building the non-uninstaller part, we get a 6020 warning because NSIS
|
---|
1133 | ; detects uninstaller related _code_ (un.xxxx) being present. It would take
|
---|
1134 | ; some effort to eliminate that one.
|
---|
1135 | ;
|
---|
1136 | !ifndef EXTERNAL_UNINSTALLER
|
---|
1137 |
|
---|
1138 | Function un.onUninstSuccess
|
---|
1139 |
|
---|
1140 | HideWindow
|
---|
1141 | MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
|
---|
1142 |
|
---|
1143 | FunctionEnd
|
---|
1144 |
|
---|
1145 | Function un.onInit
|
---|
1146 |
|
---|
1147 | ; Has the user who calls us admin rights?
|
---|
1148 | UserInfo::GetAccountType
|
---|
1149 | Pop $0
|
---|
1150 | ${If} $0 != "Admin"
|
---|
1151 | MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
|
---|
1152 | Abort
|
---|
1153 | ${EndIf}
|
---|
1154 |
|
---|
1155 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
|
---|
1156 | Quit
|
---|
1157 |
|
---|
1158 | proceed:
|
---|
1159 |
|
---|
1160 | Call un.SetAppMode64
|
---|
1161 |
|
---|
1162 | ; Set system directory
|
---|
1163 | StrCpy $g_strSystemDir "$SYSDIR"
|
---|
1164 |
|
---|
1165 | ; We need a special directory set to SysWOW64 because some
|
---|
1166 | ; shell operations don't support file redirection (yet)
|
---|
1167 | StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
|
---|
1168 |
|
---|
1169 | ; Retrieve Windows version we're running on and store it in $g_strWinVersion
|
---|
1170 | Call un.GetWindowsVersionEx
|
---|
1171 | Pop $g_strWinVersion
|
---|
1172 |
|
---|
1173 | ; Retrieve capabilities
|
---|
1174 | Call un.CheckForCapabilities
|
---|
1175 |
|
---|
1176 | FunctionEnd
|
---|
1177 |
|
---|
1178 | Section Uninstall
|
---|
1179 |
|
---|
1180 | !ifdef _DEBUG
|
---|
1181 | ${LogEnable} "true"
|
---|
1182 | !endif
|
---|
1183 |
|
---|
1184 | Call un.SetAppMode64
|
---|
1185 |
|
---|
1186 | ; Call the uninstall main function
|
---|
1187 | Call un.Uninstall
|
---|
1188 |
|
---|
1189 | ; ... and remove the local install directory
|
---|
1190 | Call un.UninstallInstDir
|
---|
1191 |
|
---|
1192 | !ifndef _DEBUG
|
---|
1193 | SetAutoClose true
|
---|
1194 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
|
---|
1195 | StrCmp $g_bRebootOnExit "true" restart
|
---|
1196 | !endif
|
---|
1197 |
|
---|
1198 | Goto exit
|
---|
1199 |
|
---|
1200 | !ifndef _DEBUG
|
---|
1201 | restart:
|
---|
1202 | !endif
|
---|
1203 |
|
---|
1204 | ${LogVerbose} "Rebooting ..."
|
---|
1205 | Reboot
|
---|
1206 |
|
---|
1207 | exit:
|
---|
1208 |
|
---|
1209 | SectionEnd
|
---|
1210 |
|
---|
1211 | !endif ; !EXTERNAL_UNINSTALLER
|
---|
1212 |
|
---|
1213 | ;Direct the output to our bin dir
|
---|
1214 | !cd "$%PATH_OUT%\bin\additions"
|
---|