VirtualBox

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

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

scm copyright and license note update

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 23.9 KB
 
1; $Id: VBoxGuestAdditionsW2KXP.nsh 96407 2022-08-22 17:43:14Z 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.alldomusa.eu.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" "false"
144 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD" "false"
145 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD" "false"
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
162Function W2K_Prepare
163
164 ${If} $g_bNoVBoxServiceExit == "false"
165 ; Stop / kill VBoxService
166 Call StopVBoxService
167 ${EndIf}
168
169 ${If} $g_bNoVBoxTrayExit == "false"
170 ; Stop / kill VBoxTray
171 Call StopVBoxTray
172 ${EndIf}
173
174 ; Delete VBoxService from registry
175 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
176
177 ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
178 Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
179
180!ifdef VBOX_SIGN_ADDITIONS && VBOX_WITH_VBOX_LEGACY_TS_CA
181 ; NSIS only supports global vars, even in functions -- great
182 Var /GLOBAL bDoInstallCA
183 StrCpy $bDoInstallCA "false" ; Set a default value
184
185 ; If not explicitly specified, let the detected Windows version decide what to do.
186 ${If} $g_bInstallTimestampCA == "unset"
187 ${If} $g_strWinVersion != "10"
188 ; On guest OSes < Windows 10 we always go for the PreW10 drivers and install our legacy timestamp CA.
189 StrCpy $bDoInstallCA "true"
190 ${EndIf}
191 ${Else}
192 StrCpy $bDoInstallCA $g_bInstallTimestampCA
193 ${EndIf}
194
195 ${If} $bDoInstallCA == "true"
196 ${LogVerbose} "Installing legacy timestamp CA certificate ..."
197 SetOutPath "$INSTDIR\cert"
198 FILE "$%PATH_OUT%\bin\additions\vbox-legacy-timestamp-ca.cer"
199 FILE "$%PATH_OUT%\bin\additions\VBoxCertUtil.exe"
200 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" add-trusted-publisher --root $\"$INSTDIR\cert\vbox-legacy-timestamp-ca.cer$\"" "true"
201 ${CmdExecute} "$\"$INSTDIR\cert\VBoxCertUtil.exe$\" display-all" "true"
202 ${EndIf}
203!endif
204
205FunctionEnd
206
207Function W2K_CopyFiles
208
209 Push $0
210 SetOutPath "$INSTDIR"
211
212 ; Video driver
213 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
214 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
215
216 ; Mouse driver
217 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
218 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
219!ifdef VBOX_SIGN_ADDITIONS
220 ${If} $g_strWinVersion == "10"
221 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
222 ${Else}
223 FILE "/oname=VBoxMouse.cat" "$%PATH_OUT%\bin\additions\VBoxMouse-PreW10.cat"
224 ${EndIf}
225!endif
226
227 ; Guest driver
228 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
229 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
230!ifdef VBOX_SIGN_ADDITIONS
231 ${If} $g_strWinVersion == "10"
232 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
233 ${Else}
234 FILE "/oname=VBoxGuest.cat" "$%PATH_OUT%\bin\additions\VBoxGuest-PreW10.cat"
235 ${EndIf}
236!endif
237
238 ; Guest driver files
239 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
240 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe" ; Not used by W2K and up, but required by the .INF file
241
242!ifdef VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST
243 FILE "$%PATH_OUT%\bin\additions\VBoxAudioTest.exe"
244!endif
245
246 SetOutPath $g_strSystemDir
247
248 ; VBoxService
249 ${If} $g_bNoVBoxServiceExit == "false"
250 ; VBoxService has been terminated before, so just install the file
251 ; in the regular way
252 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
253 ${Else}
254 ; VBoxService is in use and wasn't terminated intentionally. So extract the
255 ; new version into a temporary location and install it on next reboot
256 Push $0
257 ClearErrors
258 GetTempFileName $0
259 IfErrors 0 +3
260 ${LogVerbose} "Error getting temp file for VBoxService.exe"
261 StrCpy "$0" "$INSTDIR\VBoxServiceTemp.exe"
262 ${LogVerbose} "VBoxService is in use, will be installed on next reboot (from '$0')"
263 File "/oname=$0" "$%PATH_OUT%\bin\additions\VBoxService.exe"
264 IfErrors 0 +2
265 ${LogVerbose} "Error copying VBoxService.exe to '$0'"
266 Rename /REBOOTOK "$0" "$g_strSystemDir\VBoxService.exe"
267 IfErrors 0 +2
268 ${LogVerbose} "Error renaming '$0' to '$g_strSystemDir\VBoxService.exe'"
269 Pop $0
270 ${EndIf}
271
272!if $%VBOX_WITH_WDDM% == "1"
273 ${If} $g_bWithWDDM == "true"
274 ; WDDM Video driver
275 SetOutPath "$INSTDIR"
276
277 !ifdef VBOX_SIGN_ADDITIONS
278 ${If} $g_strWinVersion == "10"
279 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
280 ${Else}
281 FILE "/oname=VBoxWddm.cat" "$%PATH_OUT%\bin\additions\VBoxWddm-PreW10.cat"
282 ${EndIf}
283 !endif
284 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.sys"
285 FILE "$%PATH_OUT%\bin\additions\VBoxWddm.inf"
286
287 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
288 !if $%VBOX_WITH_WDDM_DX% == "1"
289 FILE "$%PATH_OUT%\bin\additions\VBoxDX.dll"
290 !endif
291 !if $%VBOX_WITH_MESA3D% == "1"
292 FILE "$%PATH_OUT%\bin\additions\VBoxNine.dll"
293 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA.dll"
294 FILE "$%PATH_OUT%\bin\additions\VBoxGL.dll"
295 !endif
296
297 !if $%KBUILD_TARGET_ARCH% == "amd64"
298 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
299 !if $%VBOX_WITH_WDDM_DX% == "1"
300 FILE "$%PATH_OUT%\bin\additions\VBoxDX-x86.dll"
301 !endif
302 !if $%VBOX_WITH_MESA3D% == "1"
303 FILE "$%PATH_OUT%\bin\additions\VBoxNine-x86.dll"
304 FILE "$%PATH_OUT%\bin\additions\VBoxSVGA-x86.dll"
305 FILE "$%PATH_OUT%\bin\additions\VBoxGL-x86.dll"
306 !endif
307 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
308
309 Goto doneCr
310 ${EndIf}
311!endif ; $%VBOX_WITH_WDDM% == "1"
312
313doneCr:
314
315 Pop $0
316
317FunctionEnd
318
319
320Function W2K_InstallFiles
321
322 ; The Shared Folder IFS goes to the system directory
323 !if $%BUILD_TARGET_ARCH% == "x86"
324 ; On x86 we have to use a different shared folder driver linked against an older RDBSS for Windows 7 and older.
325 ${If} $g_strWinVersion == "2000"
326 ${OrIf} $g_strWinVersion == "XP"
327 ${OrIf} $g_strWinVersion == "2003"
328 ${OrIf} $g_strWinVersion == "Vista"
329 ${OrIf} $g_strWinVersion == "7"
330 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSFW2K.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
331 ${Else}
332 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
333 ${EndIf}
334 !else
335 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxSF.sys" "$g_strSystemDir\drivers\VBoxSF.sys" "$INSTDIR"
336 !endif
337
338 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
339 AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
340 !if $%KBUILD_TARGET_ARCH% == "amd64"
341 ; Only 64-bit installer: Copy the 32-bit DLL for 32 bit applications.
342 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll" "$g_strSysWow64\VBoxMRXNP.dll" "$INSTDIR"
343 AccessControl::GrantOnFile "$g_strSysWow64\VBoxMRXNP.dll" "(BU)" "GenericRead"
344 !endif
345
346 ; The VBoxTray hook DLL also goes to the system directory; it might be locked
347 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
348 AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
349
350 ${LogVerbose} "Installing drivers ..."
351
352 Push $0 ; For fetching results
353
354 SetOutPath "$INSTDIR"
355
356 ${If} $g_bNoGuestDrv == "false"
357 ${LogVerbose} "Installing guest driver ..."
358 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxGuest.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
359 ${Else}
360 ${LogVerbose} "Guest driver installation skipped!"
361 ${EndIf}
362
363 ${If} $g_bNoVideoDrv == "false"
364 ${If} $g_bWithWDDM == "true"
365 ${LogVerbose} "Installing WDDM video driver..."
366 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxWddm.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
367 ${Else}
368 ${LogVerbose} "Installing video driver ..."
369 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideo.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
370 ${EndIf}
371 ${Else}
372 ${LogVerbose} "Video driver installation skipped!"
373 ${EndIf}
374
375 ${If} $g_bNoMouseDrv == "false"
376 ${LogVerbose} "Installing mouse driver ..."
377 ; The mouse filter does not contain any device IDs but a "DefaultInstall" section;
378 ; so this .INF file needs to be installed using "InstallHinfSection" which is implemented
379 ; with VBoxDrvInst's "driver executeinf" routine
380 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxMouse.inf$\"" "false"
381 ${Else}
382 ${LogVerbose} "Mouse driver installation skipped!"
383 ${EndIf}
384
385 ; Create the VBoxService service
386 ; No need to stop/remove the service here! Do this only on uninstallation!
387 ${LogVerbose} "Installing VirtualBox service ..."
388 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"%SystemRoot%\System32\VBoxService.exe$\" $\"Base$\"" "false"
389
390 ; Set service description
391 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
392
393sf:
394
395 ${LogVerbose} "Installing Shared Folders service ..."
396
397 ; Create the Shared Folders service ...
398 ; No need to stop/remove the service here! Do this only on uninstallation!
399 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxSF$\" $\"VirtualBox Shared Folders$\" 2 1 $\"\SystemRoot\System32\drivers\VBoxSF.sys$\" $\"NetworkProvider$\"" "false"
400
401 ; ... and the link to the network provider
402 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
403 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
404 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
405
406 ; Add default network providers (if not present or corrupted)
407 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add WebClient" "false"
408 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add LanmanWorkstation" "false"
409 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add RDPNP" "false"
410
411 ; Add the shared folders network provider
412 ${LogVerbose} "Adding network provider (Order = $g_iSfOrder) ..."
413 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF $g_iSfOrder" "false"
414
415 Goto done
416
417done:
418
419 Pop $0
420
421FunctionEnd
422
423Function W2K_Main
424
425 SetOutPath "$INSTDIR"
426 SetOverwrite on
427
428 Call W2K_Prepare
429 Call W2K_CopyFiles
430 Call W2K_InstallFiles
431 Call W2K_SetVideoResolution
432
433FunctionEnd
434
435!macro W2K_UninstallInstDir un
436Function ${un}W2K_UninstallInstDir
437
438 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
439 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
440 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
441 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
442
443 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
444 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
445 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
446
447 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
448
449 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
450 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
451 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
452
453 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll" ; Deprecated, does not get installed anymore
454 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
455 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; Deprecated, does not get installed anymore
456
457!if $%VBOX_WITH_WDDM% == "1"
458 Delete /REBOOTOK "$INSTDIR\VBoxWddm.cat"
459 Delete /REBOOTOK "$INSTDIR\VBoxWddm.sys"
460 Delete /REBOOTOK "$INSTDIR\VBoxWddm.inf"
461 ; Obsolete files begin
462 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.cat"
463 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.sys"
464 Delete /REBOOTOK "$INSTDIR\VBoxVideoWddm.inf"
465 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.cat"
466 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.sys"
467 Delete /REBOOTOK "$INSTDIR\VBoxVideoW8.inf"
468 ; Obsolete files end
469 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D.dll"
470 !if $%VBOX_WITH_WDDM_DX% == "1"
471 Delete /REBOOTOK "$INSTDIR\VBoxDX.dll"
472 !endif
473 !if $%VBOX_WITH_MESA3D% == "1"
474 Delete /REBOOTOK "$INSTDIR\VBoxNine.dll"
475 Delete /REBOOTOK "$INSTDIR\VBoxSVGA.dll"
476 Delete /REBOOTOK "$INSTDIR\VBoxICD.dll"
477 Delete /REBOOTOK "$INSTDIR\VBoxGL.dll"
478 !endif
479
480 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm.dll"
481 Delete /REBOOTOK "$INSTDIR\wined3dwddm.dll"
482 ; Try to delete libWine in case it is there from old installation
483 Delete /REBOOTOK "$INSTDIR\libWine.dll"
484
485 !if $%KBUILD_TARGET_ARCH% == "amd64"
486 Delete /REBOOTOK "$INSTDIR\VBoxDispD3D-x86.dll"
487 !if $%VBOX_WITH_WDDM_DX% == "1"
488 Delete /REBOOTOK "$INSTDIR\VBoxDX-x86.dll"
489 !endif
490 !if $%VBOX_WITH_MESA3D% == "1"
491 Delete /REBOOTOK "$INSTDIR\VBoxNine-x86.dll"
492 Delete /REBOOTOK "$INSTDIR\VBoxSVGA-x86.dll"
493 Delete /REBOOTOK "$INSTDIR\VBoxICD-x86.dll"
494 Delete /REBOOTOK "$INSTDIR\VBoxGL-x86.dll"
495 !endif
496
497 Delete /REBOOTOK "$INSTDIR\VBoxD3D9wddm-x86.dll"
498 Delete /REBOOTOK "$INSTDIR\wined3dwddm-x86.dll"
499 !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
500!endif ; $%VBOX_WITH_WDDM% == "1"
501
502 ; Log file
503 Delete /REBOOTOK "$INSTDIR\install.log"
504 Delete /REBOOTOK "$INSTDIR\install_ui.log"
505
506FunctionEnd
507!macroend
508!insertmacro W2K_UninstallInstDir ""
509!insertmacro W2K_UninstallInstDir "un."
510
511!macro W2K_Uninstall un
512Function ${un}W2K_Uninstall
513
514 Push $0
515
516 ; Remove VirtualBox video driver
517 ${LogVerbose} "Uninstalling video driver ..."
518 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideo.inf$\"" "true"
519 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
520 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
521 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
522
523 ; Remove video driver
524!if $%VBOX_WITH_WDDM% == "1"
525
526 ${LogVerbose} "Uninstalling WDDM video driver..."
527 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxWddm.inf$\"" "true"
528 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxWddm" "true"
529 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
530 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
531 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxWddm.sys"
532
533 ; Obsolete files begin
534 ${LogVerbose} "Uninstalling WDDM video driver for Windows 8..."
535 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoW8.inf$\"" "true"
536 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoW8" "true"
537 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
538 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
539 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoW8.sys"
540
541 ${LogVerbose} "Uninstalling WDDM video driver for Windows Vista and 7..."
542 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoWddm.inf$\"" "true"
543 ; Always try to remove both VBoxVideoWddm & VBoxVideo services no matter what is installed currently
544 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoWddm" "true"
545 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
546 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
547 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
548 ; Obsolete files end
549
550 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
551 !if $%KBUILD_TARGET_ARCH% == "amd64"
552 Delete /REBOOTOK "$g_strSysWow64\VBoxDispD3D-x86.dll"
553 !endif
554
555 !if $%VBOX_WITH_WDDM_DX% == "1"
556 Delete /REBOOTOK "$g_strSystemDir\VBoxDX.dll"
557 !if $%KBUILD_TARGET_ARCH% == "amd64"
558 Delete /REBOOTOK "$g_strSysWow64\VBoxDX-x86.dll"
559 !endif
560 !endif
561
562 !if $%VBOX_WITH_MESA3D% == "1"
563 Delete /REBOOTOK "$g_strSystemDir\VBoxNine.dll"
564 Delete /REBOOTOK "$g_strSystemDir\VBoxSVGA.dll"
565 Delete /REBOOTOK "$g_strSystemDir\VBoxICD.dll"
566 Delete /REBOOTOK "$g_strSystemDir\VBoxGL.dll"
567
568 !if $%KBUILD_TARGET_ARCH% == "amd64"
569 Delete /REBOOTOK "$g_strSysWow64\VBoxNine-x86.dll"
570 Delete /REBOOTOK "$g_strSysWow64\VBoxSVGA-x86.dll"
571 Delete /REBOOTOK "$g_strSysWow64\VBoxICD-x86.dll"
572 Delete /REBOOTOK "$g_strSysWow64\VBoxGL-x86.dll"
573 !endif
574 !endif
575!endif ; $%VBOX_WITH_WDDM% == "1"
576
577 ; Remove mouse driver
578 ${LogVerbose} "Removing mouse driver ..."
579 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxMouse" "true"
580 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
581 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry delmultisz $\"SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}$\" $\"UpperFilters$\" $\"VBoxMouse$\"" "true"
582
583 ; Delete the VBoxService service
584 Call ${un}StopVBoxService
585 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
586 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
587 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
588
589 ; VBoxGINA
590 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
591 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
592 ${If} $0 == "VBoxGINA.dll"
593 ${LogVerbose} "Removing auto-logon support ..."
594 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
595 ${EndIf}
596 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
597
598 ; Delete VBoxTray
599 Call ${un}StopVBoxTray
600 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
601
602 ; Remove guest driver
603 ${LogVerbose} "Removing guest driver ..."
604 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxGuest.inf$\"" "true"
605
606 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
607 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
608 Delete /REBOOTOK "$g_strSystemDir\VBCoInst.dll" ; Deprecated, does not get installed anymore
609 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
610 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
611 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
612 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
613
614 ; Remove shared folders driver
615 ${LogVerbose} "Removing shared folders driver ..."
616 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider remove VBoxSF" "true"
617 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxSF" "true"
618 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
619 !if $%KBUILD_TARGET_ARCH% == "amd64"
620 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
621 Delete /REBOOTOK "$g_strSysWow64\VBoxMRXNP.dll"
622 !endif ; amd64
623 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
624
625 Pop $0
626
627FunctionEnd
628!macroend
629!insertmacro W2K_Uninstall ""
630!insertmacro W2K_Uninstall "un."
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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