VirtualBox

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

最後變更 在這個檔案從95874是 95757,由 vboxsync 提交於 3 年 前

Windows Guest Additions installer: Added switches /[no_]install_timestamp_ca to (not) force installation of the timestamp CA [build fix]. bugref:8691

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 23.6 KB
 
1; $Id: VBoxGuestAdditionsW2KXP.nsh 95757 2022-07-20 15:11:37Z vboxsync $
2;; @file
3; VBoxGuestAdditionsW2KXP.nsh - Guest Additions installation for Windows 2000/XP.
4;
5
6;
7; Copyright (C) 2006-2022 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.alldomusa.eu.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17
18Function W2K_SetVideoResolution
19
20 ; NSIS only supports global vars, even in functions -- great
21 Var /GLOBAL i
22 Var /GLOBAL tmp
23 Var /GLOBAL tmppath
24 Var /GLOBAL dev_id
25 Var /GLOBAL dev_desc
26
27 ; Check for all required parameters
28 StrCmp $g_iScreenX "0" exit
29 StrCmp $g_iScreenY "0" exit
30 StrCmp $g_iScreenBpp "0" exit
31
32 ${LogVerbose} "Setting display parameters ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
33
34 ; Enumerate all video devices (up to 32 at the moment, use key "MaxObjectNumber" key later)
35 ${For} $i 0 32
36
37 ReadRegStr $tmp HKLM "HARDWARE\DEVICEMAP\VIDEO" "\Device\Video$i"
38 StrCmp $tmp "" dev_not_found
39
40 ; Extract path to video settings
41 ; Ex: \Registry\Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
42 ; Or: \Registry\Machine\System\CurrentControlSet\Control\Video\vboxvideo\Device0
43 ; Result: Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
44 Push "$tmp" ; String
45 Push "\" ; SubString
46 Push ">" ; SearchDirection
47 Push ">" ; StrInclusionDirection
48 Push "0" ; IncludeSubString
49 Push "2" ; Loops
50 Push "0" ; CaseSensitive
51 Call StrStrAdv
52 Pop $tmppath ; $1 only contains the full path
53 StrCmp $tmppath "" dev_not_found
54
55 ; Get device description
56 ReadRegStr $dev_desc HKLM "$tmppath" "Device Description"
57!ifdef _DEBUG
58 ${LogVerbose} "Registry path: $tmppath"
59 ${LogVerbose} "Registry path to device name: $temp"
60!endif
61 ${LogVerbose} "Detected video device: $dev_desc"
62
63 ${If} $dev_desc == "VirtualBox Graphics Adapter"
64 ${LogVerbose} "VirtualBox video device found!"
65 Goto dev_found
66 ${EndIf}
67 ${Next}
68 Goto dev_not_found
69
70dev_found:
71
72 ; If we're on Windows 2000, skip the ID detection ...
73 ${If} $g_strWinVersion == "2000"
74 Goto change_res
75 ${EndIf}
76 Goto dev_found_detect_id
77
78dev_found_detect_id:
79
80 StrCpy $i 0 ; Start at index 0
81 ${LogVerbose} "Detecting device ID ..."
82
83dev_found_detect_id_loop:
84
85 ; Resolve real path to hardware instance "{GUID}"
86 EnumRegKey $dev_id HKLM "SYSTEM\CurrentControlSet\Control\Video" $i
87 StrCmp $dev_id "" dev_not_found ; No more entries? Jump out
88!ifdef _DEBUG
89 ${LogVerbose} "Got device ID: $dev_id"
90!endif
91 ReadRegStr $dev_desc HKLM "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000" "Device Description" ; Try to read device name
92 ${If} $dev_desc == "VirtualBox Graphics Adapter"
93 ${LogVerbose} "Device ID of $dev_desc: $dev_id"
94 Goto change_res
95 ${EndIf}
96
97 IntOp $i $i + 1 ; Increment index
98 goto dev_found_detect_id_loop
99
100dev_not_found:
101
102 ${LogVerbose} "No VirtualBox video device (yet) detected! No custom mode set."
103 Goto exit
104
105change_res:
106
107!ifdef _DEBUG
108 ${LogVerbose} "Device description: $dev_desc"
109 ${LogVerbose} "Device ID: $dev_id"
110!endif
111
112 Var /GLOBAL reg_path_device
113 Var /GLOBAL reg_path_monitor
114
115 ${LogVerbose} "Custom mode set: Platform is Windows $g_strWinVersion"
116 ${If} $g_strWinVersion == "2000"
117 ${OrIf} $g_strWinVersion == "Vista"
118 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0"
119 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0\Mon00000001"
120 ${ElseIf} $g_strWinVersion == "XP"
121 ${OrIf} $g_strWinVersion == "7"
122 ${OrIf} $g_strWinVersion == "8"
123 ${OrIf} $g_strWinVersion == "8_1"
124 ${OrIf} $g_strWinVersion == "10"
125 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000"
126 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\Control\VIDEO\$dev_id\0000\Mon00000001"
127 ${Else}
128 ${LogVerbose} "Custom mode set: Windows $g_strWinVersion not supported yet"
129 Goto exit
130 ${EndIf}
131
132 ; Write the new value in the adapter config (VBoxVideo.sys) using hex values in binary format
133 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomXRes REG_BIN $g_iScreenX DWORD" "false"
134 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD" "false"
135 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD" "false"
136
137 ; ... and tell Windows to use that mode on next start!
138 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.XResolution" "$g_iScreenX"
139 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.YResolution" "$g_iScreenY"
140 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
141
142 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.XResolution" "$g_iScreenX"
143 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.YResolution" "$g_iScreenY"
144 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
145
146 ${LogVerbose} "Custom mode set to $g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP on next restart."
147
148exit:
149
150FunctionEnd
151
152Function W2K_Prepare
153
154 ${If} $g_bNoVBoxServiceExit == "false"
155 ; Stop / kill VBoxService
156 Call StopVBoxService
157 ${EndIf}
158
159 ${If} $g_bNoVBoxTrayExit == "false"
160 ; Stop / kill VBoxTray
161 Call StopVBoxTray
162 ${EndIf}
163
164 ; Delete VBoxService from registry
165 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
166
167 ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
168 Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
169
170!ifdef VBOX_SIGN_ADDITIONS && VBOX_WITH_VBOX_LEGACY_TS_CA
171 ; NSIS only supports global vars, even in functions -- great
172 Var /GLOBAL bDoInstallCA
173 StrCpy $bDoInstallCA "false" ; Set a default value
174
175 ; If not explicitly specified, let the detected Windows version decide what to do.
176 ${If} $g_bInstallTimestampCA == "unset"
177 ${If} $g_strWinVersion != "10"
178 ; On guest OSes < Windows 10 we always go for the PreW10 drivers and install our legacy timestamp CA.
179 StrCpy $bDoInstallCA "true"
180 ${EndIf}
181 ${Else}
182 StrCpy $bDoInstallCA $g_bInstallTimestampCA
183 ${EndIf}
184
185 ${If} $bDoInstallCA == "true"
186 ${LogVerbose} "Installing legacy timestamp CA certificate ..."
187 SetOutPath "$INSTDIR\cert"
188 FILE "$%PATH_OUT%\bin\additions\vbox-legacy-timestamp-ca.cer"
189 FILE "$%PATH_OUT%\bin\additions\VBoxCertUtil.exe"
190 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" add-trusted-publisher --root $\"$INSTDIR\cert\vbox-legacy-timestamp-ca.cer$\"" "true"
191 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" display-all" "true"
192 ${EndIf}
193!endif
194
195FunctionEnd
196
197Function W2K_CopyFiles
198
199 Push $0
200 SetOutPath "$INSTDIR"
201
202 ; Video driver
203 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
204 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
205
206 ; Mouse driver
207 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
208 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
209!ifdef VBOX_SIGN_ADDITIONS
210 ${If} $g_strWinVersion == "10"
211 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
212 ${Else}
213 FILE "/oname=VBoxMouse.cat" "$%PATH_OUT%\bin\additions\VBoxMouse-PreW10.cat"
214 ${EndIf}
215!endif
216
217 ; Guest driver
218 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
219 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
220!ifdef VBOX_SIGN_ADDITIONS
221 ${If} $g_strWinVersion == "10"
222 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
223 ${Else}
224 FILE "/oname=VBoxGuest.cat" "$%PATH_OUT%\bin\additions\VBoxGuest-PreW10.cat"
225 ${EndIf}
226!endif
227
228 ; Guest driver files
229 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
230 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe" ; Not used by W2K and up, but required by the .INF file
231
232!ifdef VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST
233 FILE "$%PATH_OUT%\bin\additions\VBoxAudioTest.exe"
234!endif
235
236 SetOutPath $g_strSystemDir
237
238 ; VBoxService
239 ${If} $g_bNoVBoxServiceExit == "false"
240 ; VBoxService has been terminated before, so just install the file
241 ; in the regular way
242 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
243 ${Else}
244 ; VBoxService is in use and wasn't terminated intentionally. So extract the
245 ; new version into a temporary location and install it on next reboot
246 Push $0
247 ClearErrors
248 GetTempFileName $0
249 IfErrors 0 +3
250 ${LogVerbose} "Error getting temp file for VBoxService.exe"
251 StrCpy "$0" "$INSTDIR\VBoxServiceTemp.exe"
252 ${LogVerbose} "VBoxService is in use, will be installed on next reboot (from '$0')"
253 File "/oname=$0" "$%PATH_OUT%\bin\additions\VBoxService.exe"
254 IfErrors 0 +2
255 ${LogVerbose} "Error copying VBoxService.exe to '$0'"
256 Rename /REBOOTOK "$0" "$g_strSystemDir\VBoxService.exe"
257 IfErrors 0 +2
258 ${LogVerbose} "Error renaming '$0' to '$g_strSystemDir\VBoxService.exe'"
259 Pop $0
260 ${EndIf}
261
262!if $%VBOX_WITH_WDDM% == "1"
263 ${If} $g_bWithWDDM == "true"
264 ; WDDM Video driver
265 SetOutPath "$INSTDIR"
266
267 !ifdef VBOX_SIGN_ADDITIONS
268 ${If} $g_strWinVersion == "10"
269 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
270 ${Else}
271 FILE "/oname=VBoxWddm.cat" "$%PATH_OUT%\bin\additions\VBoxWddm-PreW10.cat"
272 ${EndIf}
273 !endif
274 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.sys"
275 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.inf"
276
277 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
278 !if $%VBOX_WITH_WDDM_DX% == "1"
279 FILE "$%PATH_OUT%\bin\additions\VBoxDX.dll"
280 !endif
281 !if $%VBOX_WITH_MESA3D% == "1"
282 FILE "$%PATH_OUT%\bin\additions\VBoxNine.dll"
283 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA.dll"
284 FILE "$%PATH_OUT%\bin\additions\VBoxGL.dll"
285 !endif
286
287 !if $%KBUILD_TARGET_ARCH% == "amd64"
288 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
289 !if $%VBOX_WITH_WDDM_DX% == "1"
290 FILE "$%PATH_OUT%\bin\additions\VBoxDX-x86.dll"
291 !endif
292 !if $%VBOX_WITH_MESA3D% == "1"
293 FILE "$%PATH_OUT%\bin\additions\VBoxNine-x86.dll"
294 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA-x86.dll"
295 FILE "$%PATH_OUT%\bin\additions\VBoxGL-x86.dll"
296 !endif
297 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
298
299 Goto doneCr
300 ${EndIf}
301!endif ; $%VBOX_WITH_WDDM% == "1"
302
303doneCr:
304
305 Pop $0
306
307FunctionEnd
308
309
310Function W2K_InstallFiles
311
312 ; The Shared Folder IFS goes to the system directory
313 !if $%BUILD_TARGET_ARCH% == "x86"
314 ; On x86 we have to use a different shared folder driver linked against an older RDBSS for Windows 7 and older.
315 ${If} $g_strWinVersion == "2000"
316 ${OrIf} $g_strWinVersion == "XP"
317 ${OrIf} $g_strWinVersion == "2003"
318 ${OrIf} $g_strWinVersion == "Vista"
319 ${OrIf} $g_strWinVersion == "7"
320 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSFW2K.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
321 ${Else}
322 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
323 ${EndIf}
324 !else
325 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
326 !endif
327
328 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
329 AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
330 !if $%KBUILD_TARGET_ARCH% == "amd64"
331 ; Only 64-bit installer: Copy the 32-bit DLL for 32 bit applications.
332 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll" "$g_strSysWow64\VBoxMRXNP.dll" "$INSTDIR"
333 AccessControl::GrantOnFile "$g_strSysWow64\VBoxMRXNP.dll" "(BU)" "GenericRead"
334 !endif
335
336 ; The VBoxTray hook DLL also goes to the system directory; it might be locked
337 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
338 AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
339
340 ${LogVerbose} "Installing drivers ..."
341
342 Push $0 ; For fetching results
343
344 SetOutPath "$INSTDIR"
345
346 ${If} $g_bNoGuestDrv == "false"
347 ${LogVerbose} "Installing guest driver ..."
348 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxGuest.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
349 ${Else}
350 ${LogVerbose} "Guest driver installation skipped!"
351 ${EndIf}
352
353 ${If} $g_bNoVideoDrv == "false"
354 ${If} $g_bWithWDDM == "true"
355 ${LogVerbose} "Installing WDDM video driver..."
356 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxWddm.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
357 ${Else}
358 ${LogVerbose} "Installing video driver ..."
359 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideo.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
360 ${EndIf}
361 ${Else}
362 ${LogVerbose} "Video driver installation skipped!"
363 ${EndIf}
364
365 ${If} $g_bNoMouseDrv == "false"
366 ${LogVerbose} "Installing mouse driver ..."
367 ; The mouse filter does not contain any device IDs but a "DefaultInstall" section;
368 ; so this .INF file needs to be installed using "InstallHinfSection" which is implemented
369 ; with VBoxDrvInst's "driver executeinf" routine
370 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxMouse.inf$\"" "false"
371 ${Else}
372 ${LogVerbose} "Mouse driver installation skipped!"
373 ${EndIf}
374
375 ; Create the VBoxService service
376 ; No need to stop/remove the service here! Do this only on uninstallation!
377 ${LogVerbose} "Installing VirtualBox service ..."
378 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"%SystemRoot%\System32\VBoxService.exe$\" $\"Base$\"" "false"
379
380 ; Set service description
381 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
382
383sf:
384
385 ${LogVerbose} "Installing Shared Folders service ..."
386
387 ; Create the Shared Folders service ...
388 ; No need to stop/remove the service here! Do this only on uninstallation!
389 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxSF$\" $\"VirtualBox Shared Folders$\" 2 1 $\"\SystemRoot\System32\drivers\VBoxSF.sys$\" $\"NetworkProvider$\"" "false"
390
391 ; ... and the link to the network provider
392 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
393 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
394 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
395
396 ; Add default network providers (if not present or corrupted)
397 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add WebClient" "false"
398 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add LanmanWorkstation" "false"
399 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add RDPNP" "false"
400
401 ; Add the shared folders network provider
402 ${LogVerbose} "Adding network provider (Order = $g_iSfOrder) ..."
403 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF $g_iSfOrder" "false"
404
405 Goto done
406
407done:
408
409 Pop $0
410
411FunctionEnd
412
413Function W2K_Main
414
415 SetOutPath "$INSTDIR"
416 SetOverwrite on
417
418 Call W2K_Prepare
419 Call W2K_CopyFiles
420 Call W2K_InstallFiles
421 Call W2K_SetVideoResolution
422
423FunctionEnd
424
425!macro W2K_UninstallInstDir un
426Function ${un}W2K_UninstallInstDir
427
428 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
429 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
430 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
431 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
432
433 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
434 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
435 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
436
437 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
438
439 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
440 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
441 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
442
443 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll" ; Deprecated, does not get installed anymore
444 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
445 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; Deprecated, does not get installed anymore
446
447!if $%VBOX_WITH_WDDM% == "1"
448 Delete /REBOOTOK "$INSTDIR\VBoxWddm.cat"
449 Delete /REBOOTOK "$INSTDIR\VBoxWddm.sys"
450 Delete /REBOOTOK "$INSTDIR\VBoxWddm.inf"
451 ; Obsolete files begin
452 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.cat"
453 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.sys"
454 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.inf"
455 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.cat"
456 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.sys"
457 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.inf"
458 ; Obsolete files end
459 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D.dll"
460 !if $%VBOX_WITH_WDDM_DX% == "1"
461 Delete /REBOOTOK "$INSTDIR\VBoxDX.dll"
462 !endif
463 !if $%VBOX_WITH_MESA3D% == "1"
464 Delete /REBOOTOK "$INSTDIR\VBoxNine.dll"
465 Delete /REBOOTOK "$INSTDIR\VBoxSVGA.dll"
466 Delete /REBOOTOK "$INSTDIR\VBoxICD.dll"
467 Delete /REBOOTOK "$INSTDIR\VBoxGL.dll"
468 !endif
469
470 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm.dll"
471 Delete /REBOOTOK "$INSTDIR\wined3dwddm.dll"
472 ; Try to delete libWine in case it is there from old installation
473 Delete /REBOOTOK "$INSTDIR\libWine.dll"
474
475 !if $%KBUILD_TARGET_ARCH% == "amd64"
476 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D-x86.dll"
477 !if $%VBOX_WITH_WDDM_DX% == "1"
478 Delete /REBOOTOK "$INSTDIR\VBoxDX-x86.dll"
479 !endif
480 !if $%VBOX_WITH_MESA3D% == "1"
481 Delete /REBOOTOK "$INSTDIR\VBoxNine-x86.dll"
482 Delete /REBOOTOK "$INSTDIR\VBoxSVGA-x86.dll"
483 Delete /REBOOTOK "$INSTDIR\VBoxICD-x86.dll"
484 Delete /REBOOTOK "$INSTDIR\VBoxGL-x86.dll"
485 !endif
486
487 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm-x86.dll"
488 Delete /REBOOTOK "$INSTDIR\wined3dwddm-x86.dll"
489 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
490!endif ; $%VBOX_WITH_WDDM% == "1"
491
492 ; Log file
493 Delete /REBOOTOK "$INSTDIR\install.log"
494 Delete /REBOOTOK "$INSTDIR\install_ui.log"
495
496FunctionEnd
497!macroend
498!insertmacro W2K_UninstallInstDir ""
499!insertmacro W2K_UninstallInstDir "un."
500
501!macro W2K_Uninstall un
502Function ${un}W2K_Uninstall
503
504 Push $0
505
506 ; Remove VirtualBox video driver
507 ${LogVerbose} "Uninstalling video driver ..."
508 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideo.inf$\"" "true"
509 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
510 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
511 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
512
513 ; Remove video driver
514!if $%VBOX_WITH_WDDM% == "1"
515
516 ${LogVerbose} "Uninstalling WDDM video driver..."
517 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxWddm.inf$\"" "true"
518 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxWddm" "true"
519 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
520 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
521 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxWddm.sys"
522
523 ; Obsolete files begin
524 ${LogVerbose} "Uninstalling WDDM video driver for Windows 8..."
525 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoW8.inf$\"" "true"
526 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoW8" "true"
527 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
528 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
529 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoW8.sys"
530
531 ${LogVerbose} "Uninstalling WDDM video driver for Windows Vista and 7..."
532 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoWddm.inf$\"" "true"
533 ; Always try to remove both VBoxVideoWddm & VBoxVideo services no matter what is installed currently
534 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoWddm" "true"
535 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
536 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
537 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
538 ; Obsolete files end
539
540 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
541 !if $%KBUILD_TARGET_ARCH% == "amd64"
542 Delete /REBOOTOK "$g_strSysWow64\VBoxDispD3D-x86.dll"
543 !endif
544
545 !if $%VBOX_WITH_WDDM_DX% == "1"
546 Delete /REBOOTOK "$g_strSystemDir\VBoxDX.dll"
547 !if $%KBUILD_TARGET_ARCH% == "amd64"
548 Delete /REBOOTOK "$g_strSysWow64\VBoxDX-x86.dll"
549 !endif
550 !endif
551
552 !if $%VBOX_WITH_MESA3D% == "1"
553 Delete /REBOOTOK "$g_strSystemDir\VBoxNine.dll"
554 Delete /REBOOTOK "$g_strSystemDir\VBoxSVGA.dll"
555 Delete /REBOOTOK "$g_strSystemDir\VBoxICD.dll"
556 Delete /REBOOTOK "$g_strSystemDir\VBoxGL.dll"
557
558 !if $%KBUILD_TARGET_ARCH% == "amd64"
559 Delete /REBOOTOK "$g_strSysWow64\VBoxNine-x86.dll"
560 Delete /REBOOTOK "$g_strSysWow64\VBoxSVGA-x86.dll"
561 Delete /REBOOTOK "$g_strSysWow64\VBoxICD-x86.dll"
562 Delete /REBOOTOK "$g_strSysWow64\VBoxGL-x86.dll"
563 !endif
564 !endif
565!endif ; $%VBOX_WITH_WDDM% == "1"
566
567 ; Remove mouse driver
568 ${LogVerbose} "Removing mouse driver ..."
569 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxMouse" "true"
570 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
571 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry delmultisz $\"SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}$\" $\"UpperFilters$\" $\"VBoxMouse$\"" "true"
572
573 ; Delete the VBoxService service
574 Call ${un}StopVBoxService
575 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
576 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
577 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
578
579 ; VBoxGINA
580 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
581 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
582 ${If} $0 == "VBoxGINA.dll"
583 ${LogVerbose} "Removing auto-logon support ..."
584 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
585 ${EndIf}
586 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
587
588 ; Delete VBoxTray
589 Call ${un}StopVBoxTray
590 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
591
592 ; Remove guest driver
593 ${LogVerbose} "Removing guest driver ..."
594 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxGuest.inf$\"" "true"
595
596 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
597 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
598 Delete /REBOOTOK "$g_strSystemDir\VBCoInst.dll" ; Deprecated, does not get installed anymore
599 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
600 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
601 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
602 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
603
604 ; Remove shared folders driver
605 ${LogVerbose} "Removing shared folders driver ..."
606 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider remove VBoxSF" "true"
607 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxSF" "true"
608 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
609 !if $%KBUILD_TARGET_ARCH% == "amd64"
610 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
611 Delete /REBOOTOK "$g_strSysWow64\VBoxMRXNP.dll"
612 !endif ; amd64
613 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
614
615 Pop $0
616
617FunctionEnd
618!macroend
619!insertmacro W2K_Uninstall ""
620!insertmacro W2K_Uninstall "un."
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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