VirtualBox

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

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

Add/Nt/Installer: Added some comments, cleanups and a slickedit NSIS config. bugref:10261

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

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