VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsW2KXP.nsh@ 96696

Last change on this file since 96696 was 96696, checked in by vboxsync, 2 years ago

Add/Nt/Installer: Simplified the $g_bInstallTimestampCA stuff. (untested)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 28.8 KB
Line 
1; $Id: VBoxGuestAdditionsW2KXP.nsh 96696 2022-09-12 10:43:02Z vboxsync $
2;; @file
3; VBoxGuestAdditionsW2KXP.nsh - Guest Additions installation for Windows 2000/XP.
4;
5
6;
7; Copyright (C) 2006-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
28Function W2K_SetVideoResolution
29
30 ; NSIS only supports global vars, even in functions -- great
31 Var /GLOBAL i
32 Var /GLOBAL tmp
33 Var /GLOBAL tmppath
34 Var /GLOBAL dev_id
35 Var /GLOBAL dev_desc
36
37 ; Check for all required parameters
38 StrCmp $g_iScreenX "0" exit
39 StrCmp $g_iScreenY "0" exit
40 StrCmp $g_iScreenBpp "0" exit
41
42 ${LogVerbose} "Setting display parameters ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
43
44 ; Enumerate all video devices (up to 32 at the moment, use key "MaxObjectNumber" key later)
45 ${For} $i 0 32
46
47 ReadRegStr $tmp HKLM "HARDWARE\DEVICEMAP\VIDEO" "\Device\Video$i"
48 StrCmp $tmp "" dev_not_found
49
50 ; Extract path to video settings
51 ; Ex: \Registry\Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
52 ; Or: \Registry\Machine\System\CurrentControlSet\Control\Video\vboxvideo\Device0
53 ; Result: Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
54 Push "$tmp" ; String
55 Push "\" ; SubString
56 Push ">" ; SearchDirection
57 Push ">" ; StrInclusionDirection
58 Push "0" ; IncludeSubString
59 Push "2" ; Loops
60 Push "0" ; CaseSensitive
61 Call StrStrAdv
62 Pop $tmppath ; $1 only contains the full path
63 StrCmp $tmppath "" dev_not_found
64
65 ; Get device description
66 ReadRegStr $dev_desc HKLM "$tmppath" "Device Description"
67!ifdef _DEBUG
68 ${LogVerbose} "Registry path: $tmppath"
69 ${LogVerbose} "Registry path to device name: $temp"
70!endif
71 ${LogVerbose} "Detected video device: $dev_desc"
72
73 ${If} $dev_desc == "VirtualBox Graphics Adapter"
74 ${LogVerbose} "VirtualBox video device found!"
75 Goto dev_found
76 ${EndIf}
77 ${Next}
78 Goto dev_not_found
79
80dev_found:
81
82 ; If we're on Windows 2000, skip the ID detection ...
83 ${If} $g_strWinVersion == "2000"
84 Goto change_res
85 ${EndIf}
86 Goto dev_found_detect_id
87
88dev_found_detect_id:
89
90 StrCpy $i 0 ; Start at index 0
91 ${LogVerbose} "Detecting device ID ..."
92
93dev_found_detect_id_loop:
94
95 ; Resolve real path to hardware instance "{GUID}"
96 EnumRegKey $dev_id HKLM "SYSTEM\CurrentControlSet\Control\Video" $i
97 StrCmp $dev_id "" dev_not_found ; No more entries? Jump out
98!ifdef _DEBUG
99 ${LogVerbose} "Got device ID: $dev_id"
100!endif
101 ReadRegStr $dev_desc HKLM "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000" "Device Description" ; Try to read device name
102 ${If} $dev_desc == "VirtualBox Graphics Adapter"
103 ${LogVerbose} "Device ID of $dev_desc: $dev_id"
104 Goto change_res
105 ${EndIf}
106
107 IntOp $i $i + 1 ; Increment index
108 goto dev_found_detect_id_loop
109
110dev_not_found:
111
112 ${LogVerbose} "No VirtualBox video device (yet) detected! No custom mode set."
113 Goto exit
114
115change_res:
116
117!ifdef _DEBUG
118 ${LogVerbose} "Device description: $dev_desc"
119 ${LogVerbose} "Device ID: $dev_id"
120!endif
121
122 Var /GLOBAL reg_path_device
123 Var /GLOBAL reg_path_monitor
124
125 ${LogVerbose} "Custom mode set: Platform is Windows $g_strWinVersion"
126 ${If} $g_strWinVersion == "2000"
127 ${OrIf} $g_strWinVersion == "Vista"
128 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0"
129 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0\Mon00000001"
130 ${ElseIf} $g_strWinVersion == "XP"
131 ${OrIf} $g_strWinVersion == "7"
132 ${OrIf} $g_strWinVersion == "8"
133 ${OrIf} $g_strWinVersion == "8_1"
134 ${OrIf} $g_strWinVersion == "10"
135 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000"
136 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\Control\VIDEO\$dev_id\0000\Mon00000001"
137 ${Else}
138 ${LogVerbose} "Custom mode set: Windows $g_strWinVersion not supported yet"
139 Goto exit
140 ${EndIf}
141
142 ; Write the new value in the adapter config (VBoxVideo.sys) using hex values in binary format
143 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomXRes REG_BIN $g_iScreenX DWORD" 'non-zero-exitcode=abort'
144 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD" 'non-zero-exitcode=abort'
145 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD" 'non-zero-exitcode=abort'
146
147 ; ... and tell Windows to use that mode on next start!
148 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.XResolution" "$g_iScreenX"
149 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.YResolution" "$g_iScreenY"
150 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
151
152 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.XResolution" "$g_iScreenX"
153 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.YResolution" "$g_iScreenY"
154 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
155
156 ${LogVerbose} "Custom mode set to $g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP on next restart."
157
158exit:
159
160FunctionEnd
161
162!ifdef VBOX_SIGN_ADDITIONS
163 !ifdef VBOX_WITH_GA_ROOT_VERISIGN_G5 | VBOX_WITH_GA_ROOT_DIGICERT_ASSURED_ID | VBOX_WITH_GA_ROOT_DIGICERT_HIGH_ASSURANCE_EV
164
165;;
166; Checks
167;
168; @param pop1 The RDN of the certificate.
169; @param pop2 Filename (cert dir) if we're shipping it (VBOX_WITH_GA_ROOT_CERTS_INCLUDED).
170; @param pop3 The direct download URL link.
171; @param pop4 The message to display if missing.
172;
173Function W2K_RootCertCheck
174 ;
175 ; Prolog: Save $0, $1, $2, $3 and move the parameters into them. Also save $4 for results.
176 ;
177 Push $0
178 Exch 4
179 Push $1
180 Exch 4
181 Push $2
182 Exch 4
183 Push $3
184 Exch 4
185 Pop $0 ; RDN
186 Pop $1 ; Filename
187 Pop $2 ; Direct URL
188 Pop $3 ; Missing message
189 Push $4
190
191 ;
192 ; Run VBoxCertUtil to check.
193 ;
194 ${LogVerbose} "Checking if $0 is installed ..."
195 ${If} ${Silent}
196 nsExec::ExecToStack "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" root-exists $\"$0$\""
197 Exch 1
198 Pop $4 ; output
199 ${LogVerbose} "$4"
200 Pop $4 ; exit code
201 ${Else}
202 nsExec::ExecToLog "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" root-exists $\"$0$\""
203 Pop $4 ; exit code
204 ${EndIf}
205 ${LogVerbose} "Exit code: $4"
206
207 ;
208 ; VBoxCertUtil terminates with exit code 10 if not found, 0 if found and something else on failure.
209 ;
210 ${If} $4 == 0
211 ${LogVerbose} "Root certificate is present."
212 ${ElseIf} $4 == 10
213 !ifdef VBOX_WITH_GA_ROOT_CERTS_INCLUDED
214 ${LogVerbose} "Root certificate is _NOT_ present. Installing it ..."
215 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" add-root $\"$INSTDIR\cert\$1$\"" 'non-zero-exitcode=abort'
216 !else
217 ${LogVerbose} "Root certificate is _NOT_ present. The certificate can be downloaded from $2 and installed using '$INSTDIR\cert\VBoxCertUtil.exe'."
218 MessageBox MB_YESNO $3 /SD IDYES IDYES l_dont_abort
219 Abort "Missing signing root certificate $0"
220l_dont_abort:
221 !endif
222 ${ElseIf} $R4 <> 0
223 ${LogVerbose} "Unable to determine whether the root certificate was present. Assuming the worst."
224 Abort "Error when checking whether signing root certificate '$0' was present: $4"
225 ${EndIf}
226
227 ;
228 ; Epilog: Restore $0-$4 (we return nothing).
229 ;
230 Pop $4
231 Pop $3
232 Pop $2
233 Pop $1
234 Pop $0
235FunctionEnd
236 !endif
237!endif
238
239Function W2K_Prepare
240 ; Save registers
241 Push $R0
242 Push $R1
243 Push $R2
244 Push $R3
245 Push $R4
246
247 ${If} $g_bNoVBoxServiceExit == "false"
248 ; Stop / kill VBoxService
249 Call StopVBoxService
250 ${EndIf}
251
252 ${If} $g_bNoVBoxTrayExit == "false"
253 ; Stop / kill VBoxTray
254 Call StopVBoxTray
255 ${EndIf}
256
257 ; Delete VBoxService from registry
258 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
259
260 ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
261 Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
262
263!ifdef VBOX_SIGN_ADDITIONS
264 ;
265 ; When installing signed GAs, we need to check whether the root certs are
266 ; present, we use VBoxCertUtil for this task. This utility is also used
267 ; for installing missing root certs we can ship, like the special timestamp
268 ; root further down.
269 ;
270 ${LogVerbose} "Installing VBoxCertUtil.exe ..."
271 SetOutPath "$INSTDIR\cert"
272 FILE "$%PATH_OUT%\bin\additions\VBoxCertUtil.exe"
273 !ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
274 FILE "$%PATH_OUT%\bin\additions\vbox-legacy-timestamp-ca.cer"
275 !endif
276 !ifdef VBOX_WITH_GA_ROOT_CERTS_INCLUDED
277 !ifdef VBOX_WITH_GA_ROOT_VERISIGN_G5
278 FILE "$%PATH_OUT%\bin\additions\root-versign-pca3-g5.cer"
279 !endif
280 !ifdef VBOX_WITH_GA_ROOT_DIGICERT_ASSURED_ID
281 FILE "$%PATH_OUT%\bin\additions\root-digicert-assured-id.cer"
282 !endif
283 !ifdef VBOX_WITH_GA_ROOT_DIGICERT_HIGH_ASSURANCE_EV
284 FILE "$%PATH_OUT%\bin\additions\root-digicert-high-assurance-ev.cer"
285 !endif
286 !endif
287
288 ; Now that the files are in place, do the checking.
289 !ifdef VBOX_WITH_GA_ROOT_VERISIGN_G5
290 Push $(VBOX_CA_CHECK_VERISIGN_G5)
291 Push "http://cacerts.digicert.com/pca3-g5.crt"
292 Push "root-versign-pca3-g5.cer"
293 Push "C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=(c) 2006 VeriSign, Inc. - For authorized use only; CN=VeriSign Class 3 Public Primary Certification Authority - G5"
294 Call W2K_RootCertCheck
295 !endif
296
297 !ifdef VBOX_WITH_GA_ROOT_DIGICERT_ASSURED_ID
298 Push $(VBOX_CA_CHECK_DIGICERT_ASSURED_ID)
299 Push "https://cacerts.digicert.com/DigiCertAssuredIDRootCA.crt"
300 Push "root-digicert-assured-id.cer"
301 Push "C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert Assured ID Root CA"
302 Call W2K_RootCertCheck
303 !endif
304
305 !ifdef VBOX_WITH_GA_ROOT_DIGICERT_HIGH_ASSURANCE_EV
306 Push $(VBOX_CA_CHECK_DIGICERT_HIGH_ASSURANCE_EV)
307 Push "https://cacerts.digicert.com/DigiCertHighAssuranceEVRootCA.crt"
308 Push "root-digicert-high-assurance-ev.cer"
309 Push "C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert High Assurance EV Root CA"
310 Call W2K_RootCertCheck
311 !endif
312
313 !ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
314 ;
315 ; Install the legacy timestamp CA if required/requested.
316 ;
317
318 ; If not explicitly specified, let the detected Windows version decide what to do.
319 ; On guest OSes < Windows 10 we always go for the PreW10 drivers and install our legacy timestamp CA.
320 ${If} $g_bInstallTimestampCA == "unset"
321 ${AndIf} $g_strWinVersion != "10"
322 StrCpy $g_bInstallTimestampCA "true"
323 ${EndIf}
324
325 ${If} $g_bInstallTimestampCA == "true"
326 ${LogVerbose} "Installing legacy timestamp CA certificate ..."
327 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" add-root $\"$INSTDIR\cert\vbox-legacy-timestamp-ca.cer$\"" 'non-zero-exitcode=log'
328 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" display-all" 'non-zero-exitcode=log'
329 ${EndIf}
330 !endif ; VBOX_WITH_VBOX_LEGACY_TS_CA
331
332!endif ; VBOX_SIGN_ADDITIONS
333
334 ; Restore registers
335 Pop $R4
336 Pop $R3
337 Pop $R2
338 Pop $R1
339 Pop $R0
340FunctionEnd
341
342Function W2K_CopyFiles
343
344 Push $0
345 SetOutPath "$INSTDIR"
346
347 ; Video driver
348 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
349 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
350
351 ; Mouse driver
352 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
353 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
354!ifdef VBOX_SIGN_ADDITIONS
355 ${If} $g_strWinVersion == "10"
356 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
357 ${Else}
358 FILE "/oname=VBoxMouse.cat" "$%PATH_OUT%\bin\additions\VBoxMouse-PreW10.cat"
359 ${EndIf}
360!endif
361
362 ; Guest driver
363 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
364 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
365!ifdef VBOX_SIGN_ADDITIONS
366 ${If} $g_strWinVersion == "10"
367 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
368 ${Else}
369 FILE "/oname=VBoxGuest.cat" "$%PATH_OUT%\bin\additions\VBoxGuest-PreW10.cat"
370 ${EndIf}
371!endif
372
373 ; Guest driver files
374 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
375 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
376
377 ; Misc
378!ifdef VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST
379 FILE "$%PATH_OUT%\bin\additions\VBoxAudioTest.exe"
380!endif
381
382 SetOutPath $g_strSystemDir
383
384 ; VBoxService
385 ${If} $g_bNoVBoxServiceExit == "false"
386 ; VBoxService has been terminated before, so just install the file
387 ; in the regular way
388 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
389 ${Else}
390 ; VBoxService is in use and wasn't terminated intentionally. So extract the
391 ; new version into a temporary location and install it on next reboot
392 Push $0
393 ClearErrors
394 GetTempFileName $0
395 IfErrors 0 +3
396 ${LogVerbose} "Error getting temp file for VBoxService.exe"
397 StrCpy "$0" "$INSTDIR\VBoxServiceTemp.exe"
398 ${LogVerbose} "VBoxService is in use, will be installed on next reboot (from '$0')"
399 File "/oname=$0" "$%PATH_OUT%\bin\additions\VBoxService.exe"
400 IfErrors 0 +2
401 ${LogVerbose} "Error copying VBoxService.exe to '$0'"
402 Rename /REBOOTOK "$0" "$g_strSystemDir\VBoxService.exe"
403 IfErrors 0 +2
404 ${LogVerbose} "Error renaming '$0' to '$g_strSystemDir\VBoxService.exe'"
405 Pop $0
406 ${EndIf}
407
408!if $%VBOX_WITH_WDDM% == "1"
409 ${If} $g_bWithWDDM == "true"
410 ; WDDM Video driver
411 SetOutPath "$INSTDIR"
412
413 !ifdef VBOX_SIGN_ADDITIONS
414 ${If} $g_strWinVersion == "10"
415 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
416 ${Else}
417 FILE "/oname=VBoxWddm.cat" "$%PATH_OUT%\bin\additions\VBoxWddm-PreW10.cat"
418 ${EndIf}
419 !endif
420 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.sys"
421 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.inf"
422
423 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
424 !if $%VBOX_WITH_WDDM_DX% == "1"
425 FILE "$%PATH_OUT%\bin\additions\VBoxDX.dll"
426 !endif
427 !if $%VBOX_WITH_MESA3D% == "1"
428 FILE "$%PATH_OUT%\bin\additions\VBoxNine.dll"
429 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA.dll"
430 FILE "$%PATH_OUT%\bin\additions\VBoxGL.dll"
431 !endif
432
433 !if $%KBUILD_TARGET_ARCH% == "amd64"
434 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
435 !if $%VBOX_WITH_WDDM_DX% == "1"
436 FILE "$%PATH_OUT%\bin\additions\VBoxDX-x86.dll"
437 !endif
438 !if $%VBOX_WITH_MESA3D% == "1"
439 FILE "$%PATH_OUT%\bin\additions\VBoxNine-x86.dll"
440 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA-x86.dll"
441 FILE "$%PATH_OUT%\bin\additions\VBoxGL-x86.dll"
442 !endif
443 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
444
445 ${EndIf}
446!endif ; $%VBOX_WITH_WDDM% == "1"
447
448 Pop $0
449
450FunctionEnd
451
452
453Function W2K_InstallFiles
454
455 ; The Shared Folder IFS goes to the system directory
456 !if $%BUILD_TARGET_ARCH% == "x86"
457 ; On x86 we have to use a different shared folder driver linked against an older RDBSS for Windows 7 and older.
458 ${If} $g_strWinVersion == "2000"
459 ${OrIf} $g_strWinVersion == "XP"
460 ${OrIf} $g_strWinVersion == "2003"
461 ${OrIf} $g_strWinVersion == "Vista"
462 ${OrIf} $g_strWinVersion == "7"
463 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSFW2K.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
464 ${Else}
465 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
466 ${EndIf}
467 !else
468 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
469 !endif
470
471 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
472 AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
473 !if $%KBUILD_TARGET_ARCH% == "amd64"
474 ; Only 64-bit installer: Copy the 32-bit DLL for 32 bit applications.
475 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll" "$g_strSysWow64\VBoxMRXNP.dll" "$INSTDIR"
476 AccessControl::GrantOnFile "$g_strSysWow64\VBoxMRXNP.dll" "(BU)" "GenericRead"
477 !endif
478
479 ; The VBoxTray hook DLL also goes to the system directory; it might be locked
480 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
481 AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
482
483 ${LogVerbose} "Installing drivers ..."
484
485 Push $0 ; For fetching results
486
487 SetOutPath "$INSTDIR"
488
489 ${If} $g_bNoGuestDrv == "false"
490 ${LogVerbose} "Installing guest driver ..."
491 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxGuest.inf$\" $\"$INSTDIR\install_drivers.log$\"" 'non-zero-exitcode=abort'
492 ${Else}
493 ${LogVerbose} "Guest driver installation skipped!"
494 ${EndIf}
495
496 ${If} $g_bNoVideoDrv == "false"
497 ${If} $g_bWithWDDM == "true"
498 ${LogVerbose} "Installing WDDM video driver..."
499 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxWddm.inf$\" $\"$INSTDIR\install_drivers.log$\"" 'non-zero-exitcode=abort'
500 ${Else}
501 ${LogVerbose} "Installing video driver ..."
502 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideo.inf$\" $\"$INSTDIR\install_drivers.log$\"" 'non-zero-exitcode=abort'
503 ${EndIf}
504 ${Else}
505 ${LogVerbose} "Video driver installation skipped!"
506 ${EndIf}
507
508 ;
509 ; Mouse driver.
510 ;
511 ${If} $g_bNoMouseDrv == "false"
512 ${LogVerbose} "Installing mouse driver ..."
513 ; The mouse filter does not contain any device IDs but a "DefaultInstall" section;
514 ; so this .INF file needs to be installed using "InstallHinfSection" which is implemented
515 ; with VBoxDrvInst's "driver executeinf" routine
516 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxMouse.inf$\"" 'non-zero-exitcode=abort'
517 ${Else}
518 ${LogVerbose} "Mouse driver installation skipped!"
519 ${EndIf}
520
521 ;
522 ; Create the VBoxService service
523 ; No need to stop/remove the service here! Do this only on uninstallation!
524 ;
525 ${LogVerbose} "Installing VirtualBox service ..."
526 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"%SystemRoot%\System32\VBoxService.exe$\" $\"Base$\"" 'non-zero-exitcode=abort'
527
528 ; Set service description
529 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
530
531
532 ;
533 ; Shared folders.
534 ;
535 ${LogVerbose} "Installing Shared Folders service ..."
536
537 ; Create the Shared Folders service ...
538 ; No need to stop/remove the service here! Do this only on uninstallation!
539 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxSF$\" $\"VirtualBox Shared Folders$\" 2 1 $\"\SystemRoot\System32\drivers\VBoxSF.sys$\" $\"NetworkProvider$\"" 'non-zero-exitcode=abort'
540
541 ; ... and the link to the network provider
542 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
543 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
544 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
545
546 ; Add default network providers (if not present or corrupted)
547 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add WebClient" 'non-zero-exitcode=abort'
548 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add LanmanWorkstation" 'non-zero-exitcode=abort'
549 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add RDPNP" 'non-zero-exitcode=abort'
550
551 ; Add the shared folders network provider
552 ${LogVerbose} "Adding network provider (Order = $g_iSfOrder) ..."
553 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF $g_iSfOrder" 'non-zero-exitcode=abort'
554
555
556 Pop $0
557
558FunctionEnd
559
560Function W2K_Main
561
562 SetOutPath "$INSTDIR"
563 SetOverwrite on
564
565 Call W2K_Prepare
566 Call W2K_CopyFiles
567 Call W2K_InstallFiles
568 Call W2K_SetVideoResolution
569
570FunctionEnd
571
572!macro W2K_UninstallInstDir un
573Function ${un}W2K_UninstallInstDir
574
575 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
576 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
577 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
578 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
579
580 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
581 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
582 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
583
584 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
585
586 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
587 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
588 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
589
590 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll" ; Deprecated, does not get installed anymore
591 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
592 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; Deprecated, does not get installed anymore
593
594!if $%VBOX_WITH_WDDM% == "1"
595 Delete /REBOOTOK "$INSTDIR\VBoxWddm.cat"
596 Delete /REBOOTOK "$INSTDIR\VBoxWddm.sys"
597 Delete /REBOOTOK "$INSTDIR\VBoxWddm.inf"
598 ; Obsolete files begin
599 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.cat"
600 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.sys"
601 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.inf"
602 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.cat"
603 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.sys"
604 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.inf"
605 ; Obsolete files end
606 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D.dll"
607 !if $%VBOX_WITH_WDDM_DX% == "1"
608 Delete /REBOOTOK "$INSTDIR\VBoxDX.dll"
609 !endif
610 !if $%VBOX_WITH_MESA3D% == "1"
611 Delete /REBOOTOK "$INSTDIR\VBoxNine.dll"
612 Delete /REBOOTOK "$INSTDIR\VBoxSVGA.dll"
613 Delete /REBOOTOK "$INSTDIR\VBoxICD.dll"
614 Delete /REBOOTOK "$INSTDIR\VBoxGL.dll"
615 !endif
616
617 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm.dll"
618 Delete /REBOOTOK "$INSTDIR\wined3dwddm.dll"
619 ; Try to delete libWine in case it is there from old installation
620 Delete /REBOOTOK "$INSTDIR\libWine.dll"
621
622 !if $%KBUILD_TARGET_ARCH% == "amd64"
623 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D-x86.dll"
624 !if $%VBOX_WITH_WDDM_DX% == "1"
625 Delete /REBOOTOK "$INSTDIR\VBoxDX-x86.dll"
626 !endif
627 !if $%VBOX_WITH_MESA3D% == "1"
628 Delete /REBOOTOK "$INSTDIR\VBoxNine-x86.dll"
629 Delete /REBOOTOK "$INSTDIR\VBoxSVGA-x86.dll"
630 Delete /REBOOTOK "$INSTDIR\VBoxICD-x86.dll"
631 Delete /REBOOTOK "$INSTDIR\VBoxGL-x86.dll"
632 !endif
633
634 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm-x86.dll"
635 Delete /REBOOTOK "$INSTDIR\wined3dwddm-x86.dll"
636 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
637!endif ; $%VBOX_WITH_WDDM% == "1"
638
639 ; Log file
640 Delete /REBOOTOK "$INSTDIR\install.log"
641 Delete /REBOOTOK "$INSTDIR\install_ui.log"
642
643FunctionEnd
644!macroend
645;!insertmacro W2K_UninstallInstDir "" - only .un version used
646!insertmacro W2K_UninstallInstDir "un."
647
648!macro W2K_Uninstall un
649Function ${un}W2K_Uninstall
650
651 Push $0
652
653 ; Remove VirtualBox video driver
654 ${LogVerbose} "Uninstalling video driver ..."
655 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideo.inf$\"" 'non-zero-exitcode=log'
656 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" 'non-zero-exitcode=log'
657 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
658 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
659
660 ; Remove video driver
661!if $%VBOX_WITH_WDDM% == "1"
662
663 ${LogVerbose} "Uninstalling WDDM video driver..."
664 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxWddm.inf$\"" 'non-zero-exitcode=log'
665 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxWddm" 'non-zero-exitcode=log'
666 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
667 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
668 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxWddm.sys"
669
670 ; Obsolete files begin
671 ${LogVerbose} "Uninstalling WDDM video driver for Windows 8..."
672 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoW8.inf$\"" 'non-zero-exitcode=log'
673 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoW8" 'non-zero-exitcode=log'
674 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
675 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
676 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoW8.sys"
677
678 ${LogVerbose} "Uninstalling WDDM video driver for Windows Vista and 7..."
679 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoWddm.inf$\"" 'non-zero-exitcode=log'
680 ; Always try to remove both VBoxVideoWddm & VBoxVideo services no matter what is installed currently
681 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoWddm" 'non-zero-exitcode=log'
682 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
683 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
684 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
685 ; Obsolete files end
686
687 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
688 !if $%KBUILD_TARGET_ARCH% == "amd64"
689 Delete /REBOOTOK "$g_strSysWow64\VBoxDispD3D-x86.dll"
690 !endif
691
692 !if $%VBOX_WITH_WDDM_DX% == "1"
693 Delete /REBOOTOK "$g_strSystemDir\VBoxDX.dll"
694 !if $%KBUILD_TARGET_ARCH% == "amd64"
695 Delete /REBOOTOK "$g_strSysWow64\VBoxDX-x86.dll"
696 !endif
697 !endif
698
699 !if $%VBOX_WITH_MESA3D% == "1"
700 Delete /REBOOTOK "$g_strSystemDir\VBoxNine.dll"
701 Delete /REBOOTOK "$g_strSystemDir\VBoxSVGA.dll"
702 Delete /REBOOTOK "$g_strSystemDir\VBoxICD.dll"
703 Delete /REBOOTOK "$g_strSystemDir\VBoxGL.dll"
704
705 !if $%KBUILD_TARGET_ARCH% == "amd64"
706 Delete /REBOOTOK "$g_strSysWow64\VBoxNine-x86.dll"
707 Delete /REBOOTOK "$g_strSysWow64\VBoxSVGA-x86.dll"
708 Delete /REBOOTOK "$g_strSysWow64\VBoxICD-x86.dll"
709 Delete /REBOOTOK "$g_strSysWow64\VBoxGL-x86.dll"
710 !endif
711 !endif
712!endif ; $%VBOX_WITH_WDDM% == "1"
713
714 ; Remove mouse driver
715 ${LogVerbose} "Removing mouse driver ..."
716 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxMouse" 'non-zero-exitcode=log'
717 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
718 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry delmultisz $\"SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}$\" $\"UpperFilters$\" $\"VBoxMouse$\"" 'non-zero-exitcode=log'
719
720 ; Delete the VBoxService service
721 Call ${un}StopVBoxService
722 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" 'non-zero-exitcode=log'
723 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
724 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
725
726 ; VBoxGINA
727 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
728 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
729 ${If} $0 == "VBoxGINA.dll"
730 ${LogVerbose} "Removing auto-logon support ..."
731 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
732 ${EndIf}
733 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
734
735 ; Delete VBoxTray
736 Call ${un}StopVBoxTray
737 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
738
739 ; Remove guest driver
740 ${LogVerbose} "Removing guest driver ..."
741 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxGuest.inf$\"" 'non-zero-exitcode=log'
742
743 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" 'non-zero-exitcode=log'
744 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
745 Delete /REBOOTOK "$g_strSystemDir\VBCoInst.dll" ; Deprecated, does not get installed anymore
746 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
747 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
748 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
749 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
750
751 ; Remove shared folders driver
752 ${LogVerbose} "Removing shared folders driver ..."
753 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider remove VBoxSF" 'non-zero-exitcode=log'
754 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxSF" 'non-zero-exitcode=log'
755 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
756 !if $%KBUILD_TARGET_ARCH% == "amd64"
757 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
758 Delete /REBOOTOK "$g_strSysWow64\VBoxMRXNP.dll"
759 !endif ; amd64
760 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
761
762 Pop $0
763
764FunctionEnd
765!macroend
766!ifndef UNINSTALLER_ONLY
767 !insertmacro W2K_Uninstall ""
768!endif
769!insertmacro W2K_Uninstall "un."
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette