VirtualBox

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

Last change on this file since 33540 was 33087, checked in by vboxsync, 14 years ago

Windows Guest Additions installer: Added switch for not shutting down VBoxService when installing, ignore unknown command line parameters in silent mode.

  • Property svn:eol-style set to native
File size: 22.2 KB
Line 
1
2Function W2K_SetVideoResolution
3
4 ; NSIS only supports global vars, even in functions -- great
5 Var /GLOBAL i
6 Var /GLOBAL tmp
7 Var /GLOBAL tmppath
8 Var /GLOBAL dev_id
9 Var /GLOBAL dev_desc
10
11 ; Check for all required parameters
12 StrCmp $g_iScreenX "0" exit
13 StrCmp $g_iScreenY "0" exit
14 StrCmp $g_iScreenBpp "0" exit
15
16 DetailPrint "Setting display parameters ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
17
18 ; Enumerate all video devices (up to 32 at the moment, use key "MaxObjectNumber" key later)
19 ${For} $i 0 32
20
21 ReadRegStr $tmp HKLM "HARDWARE\DEVICEMAP\VIDEO" "\Device\Video$i"
22 StrCmp $tmp "" dev_not_found
23
24 ; Extract path to video settings
25 ; Ex: \Registry\Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
26 ; Or: \Registry\Machine\System\CurrentControlSet\Control\Video\vboxvideo\Device0
27 ; Result: Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
28 Push "$tmp" ; String
29 Push "\" ; SubString
30 Push ">" ; SearchDirection
31 Push ">" ; StrInclusionDirection
32 Push "0" ; IncludeSubString
33 Push "2" ; Loops
34 Push "0" ; CaseSensitive
35 Call StrStrAdv
36 Pop $tmppath ; $1 only contains the full path
37 StrCmp $tmppath "" dev_not_found
38
39 ; Get device description
40 ReadRegStr $dev_desc HKLM "$tmppath" "Device Description"
41!ifdef _DEBUG
42 DetailPrint "Registry path: $tmppath"
43 DetailPrint "Registry path to device name: $temp"
44!endif
45 DetailPrint "Detected video device: $dev_desc"
46
47 ${If} $dev_desc == "VirtualBox Graphics Adapter"
48 DetailPrint "VirtualBox video device found!"
49 Goto dev_found
50 ${EndIf}
51 ${Next}
52 Goto dev_not_found
53
54dev_found:
55
56 ; If we're on Windows 2000, skip the ID detection ...
57 ${If} $g_strWinVersion == "2000"
58 Goto change_res
59 ${EndIf}
60 Goto dev_found_detect_id
61
62dev_found_detect_id:
63
64 StrCpy $i 0 ; Start at index 0
65 DetailPrint "Detecting device ID ..."
66
67dev_found_detect_id_loop:
68
69 ; Resolve real path to hardware instance "{GUID}"
70 EnumRegKey $dev_id HKLM "SYSTEM\CurrentControlSet\Control\Video" $i
71 StrCmp $dev_id "" dev_not_found ; No more entries? Jump out
72!ifdef _DEBUG
73 DetailPrint "Got device ID: $dev_id"
74!endif
75 ReadRegStr $dev_desc HKLM "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000" "Device Description" ; Try to read device name
76 ${If} $dev_desc == "VirtualBox Graphics Adapter"
77 DetailPrint "Device ID of $dev_desc: $dev_id"
78 Goto change_res
79 ${EndIf}
80
81 IntOp $i $i + 1 ; Increment index
82 goto dev_found_detect_id_loop
83
84dev_not_found:
85
86 DetailPrint "No VirtualBox video device (yet) detected! No custom mode set."
87 Goto exit
88
89change_res:
90
91!ifdef _DEBUG
92 DetailPrint "Device description: $dev_desc"
93 DetailPrint "Device ID: $dev_id"
94!endif
95
96 Var /GLOBAL reg_path_device
97 Var /GLOBAL reg_path_monitor
98
99 DetailPrint "Custom mode set: Platform is Windows $g_strWinVersion"
100 ${If} $g_strWinVersion == "2000"
101 ${OrIf} $g_strWinVersion == "Vista"
102 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0"
103 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0\Mon00000001"
104 ${ElseIf} $g_strWinVersion == "XP"
105 ${OrIf} $g_strWinVersion == "7"
106 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000"
107 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\Control\VIDEO\$dev_id\0000\Mon00000001"
108 ${Else}
109 DetailPrint "Custom mode set: Windows $g_strWinVersion not supported yet"
110 Goto exit
111 ${EndIf}
112
113 ; Write the new value in the adapter config (VBoxVideo.sys) using hex values in binary format
114 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomXRes REG_BIN $g_iScreenX DWORD'
115 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD'
116 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD'
117
118 ; ... and tell Windows to use that mode on next start!
119 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.XResolution" "$g_iScreenX"
120 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.YResolution" "$g_iScreenY"
121 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
122
123 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.XResolution" "$g_iScreenX"
124 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.YResolution" "$g_iScreenY"
125 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
126
127 DetailPrint "Custom mode set to $g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP on next restart."
128
129exit:
130
131FunctionEnd
132
133Function W2K_Prepare
134
135 ${If} $g_bNoVBoxServiceExit == "false"
136 ; Stop / kill VBoxService
137 Call StopVBoxService
138 ${EndIf}
139
140 ; Stop / kill VBoxTray
141 Call StopVBoxTray
142
143 ; Delete VBoxService from registry
144 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
145
146 ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
147 Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
148
149FunctionEnd
150
151Function W2K_CopyFiles
152
153 SetOutPath "$INSTDIR"
154
155 ; Video driver
156 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
157 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
158
159 ; Mouse driver
160 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
161 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
162!ifdef VBOX_SIGN_ADDITIONS
163 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
164!endif
165
166 ; Guest driver
167 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
168 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
169!ifdef VBOX_SIGN_ADDITIONS
170 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
171!endif
172
173 ; Guest driver files
174 FILE "$%PATH_OUT%\bin\additions\VBCoInst.dll"
175 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
176 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe" ; Not used by W2K and up, but required by the .INF file
177
178 ; WHQL fake
179!ifdef WHQL_FAKE
180 FILE "$%PATH_OUT%\bin\additions\VBoxWHQLFake.exe"
181!endif
182
183 SetOutPath $g_strSystemDir
184
185 ; VBoxService
186 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe" ; Only used by W2K and up (for Shared Folders at the moment)
187
188!if $%VBOX_WITH_CROGL% == "1"
189 !if $%VBOX_WITH_WDDM% == "1"
190 !if $%BUILD_TARGET_ARCH% == "x86"
191 ${If} $g_bWithWDDM == "true"
192 SetOutPath "$INSTDIR"
193 ; WDDM Video driver
194 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
195 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
196 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
197 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
198 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
199 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
200 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
201 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
202 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
203 FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
204 FILE "$%PATH_OUT%\bin\additions\libWine.dll"
205 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
206 FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
207 SetOutPath $g_strSystemDir
208 Goto doneCr
209 ${EndIf}
210 !endif ; $%BUILD_TARGET_ARCH% == "x86"
211 !endif ; $%VBOX_WITH_WDDM% == "1"
212 ; crOpenGL
213 SetOutPath $g_strSystemDir
214 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
215 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
216 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
217 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
218 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
219 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
220 FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
221
222 !if $%BUILD_TARGET_ARCH% == "amd64"
223 ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target arch in
224 ; Wow64 node (32-bit sub system).
225 ${EnableX64FSRedirection}
226 SetOutPath $SYSDIR
227 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll"
228 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll"
229 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll"
230 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll"
231 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll"
232 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll"
233 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll"
234 ${DisableX64FSRedirection}
235 !endif
236
237doneCr:
238
239!endif ; VBOX_WITH_CROGL
240
241FunctionEnd
242
243!ifdef WHQL_FAKE
244
245Function W2K_WHQLFakeOn
246
247 StrCmp $g_bFakeWHQL "true" do
248 Goto exit
249
250do:
251
252 DetailPrint "Turning off WHQL protection..."
253 nsExec::ExecToLog '"$INSTDIR\VBoxWHQLFake.exe" "ignore"'
254
255exit:
256
257FunctionEnd
258
259Function W2K_WHQLFakeOff
260
261 StrCmp $g_bFakeWHQL "true" do
262 Goto exit
263
264do:
265
266 DetailPrint "Turning back on WHQL protection..."
267 nsExec::ExecToLog '"$INSTDIR\VBoxWHQLFake.exe" "warn"'
268
269exit:
270
271FunctionEnd
272
273!endif
274
275Function W2K_InstallFiles
276
277 ; The Shared Folder IFS goes to the system directory
278 FILE /oname=$g_strSystemDir\drivers\VBoxSF.sys "$%PATH_OUT%\bin\additions\VBoxSF.sys"
279 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
280 AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
281
282 ; The VBoxTray hook DLL also goes to the system directory; it might be locked
283 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
284 AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
285
286 DetailPrint "Installing Drivers..."
287
288drv_video:
289
290 StrCmp $g_bNoVideoDrv "true" drv_guest
291 SetOutPath "$INSTDIR"
292 ${If} $g_bWithWDDM == "true"
293 DetailPrint "Installing WDDM video driver ..."
294 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxVideoWddm.inf" "Display"'
295 ${Else}
296 DetailPrint "Installing video driver ..."
297 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxVideo.inf" "Display"'
298 ${EndIf}
299 Pop $0 ; Ret value
300 LogText "Video driver result: $0"
301 IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
302
303drv_guest:
304
305 StrCmp $g_bNoGuestDrv "true" drv_mouse
306 DetailPrint "Installing guest driver ..."
307 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_CAFE&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxGuest.inf" "Media"'
308 Pop $0 ; Ret value
309 LogText "Guest driver result: $0"
310 IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
311
312drv_mouse:
313
314 StrCmp $g_bNoMouseDrv "true" vbox_service
315 DetailPrint "Installing mouse filter ..."
316 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /inf "$INSTDIR\VBoxMouse.inf"'
317 Pop $0 ; Ret value
318 LogText "Mouse driver returned: $0"
319 IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
320
321vbox_service:
322
323 DetailPrint "Installing VirtualBox service ..."
324
325 ; Create the VBoxService service
326 ; No need to stop/remove the service here! Do this only on uninstallation!
327 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /createsvc "VBoxService" "VirtualBox Guest Additions Service" 16 2 "system32\VBoxService.exe" "Base"'
328 Pop $0 ; Ret value
329 LogText "VBoxService returned: $0"
330
331 ; Set service description
332 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
333
334sf:
335
336 DetailPrint "Installing Shared Folders service ..."
337
338 ; Create the Shared Folders service ...
339 ; No need to stop/remove the service here! Do this only on uninstallation!
340 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /createsvc "VBoxSF" "VirtualBox Shared Folders" 2 1 "system32\drivers\VBoxSF.sys" "NetworkProvider"'
341
342 ; ... and the link to the network provider
343 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
344 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
345 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
346
347 ; Add default network providers (if not present or corrupted)
348 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider WebClient'
349 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider LanmanWorkstation'
350 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider RDPNP'
351
352 ; Add the shared folders network provider
353 DetailPrint "Adding network provider (Order = $g_iSfOrder) ..."
354 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider VBoxSF $g_iSfOrder'
355 Pop $0 ; Ret value
356 IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
357
358!if $%VBOX_WITH_CROGL% == "1"
359cropengl:
360 ${If} $g_bWithWDDM == "true"
361 ; Nothing to do here
362 ${Else}
363 DetailPrint "Installing 3D OpenGL support ..."
364 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
365 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
366 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
367 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
368!if $%BUILD_TARGET_ARCH% == "amd64"
369 ; Write additional keys required for Windows XP, Vista and 7 64-bit (but for 32-bit stuff)
370 ${If} $g_strWinVersion == '7'
371 ${OrIf} $g_strWinVersion == 'Vista'
372 ${OrIf} $g_strWinVersion == 'XP'
373 WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
374 WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
375 WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
376 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
377 ${EndIf}
378!endif
379 ${Endif}
380!endif
381
382 Goto done
383
384error:
385
386 Abort "ERROR: Could not install files for Windows 2000 / XP / Vista! Installation aborted."
387
388done:
389
390FunctionEnd
391
392Function W2K_Main
393
394 SetOutPath "$INSTDIR"
395 SetOverwrite on
396
397 Call W2K_Prepare
398 Call W2K_CopyFiles
399
400!ifdef WHQL_FAKE
401 Call W2K_WHQLFakeOn
402!endif
403
404 Call W2K_InstallFiles
405
406!ifdef WHQL_FAKE
407 Call W2K_WHQLFakeOff
408!endif
409
410 Call W2K_SetVideoResolution
411
412FunctionEnd
413
414!macro W2K_UninstallInstDir un
415Function ${un}W2K_UninstallInstDir
416
417 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
418 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
419 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
420 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
421
422 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
423 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
424 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
425
426 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
427
428 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
429 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
430 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
431
432 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll"
433 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
434 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; File from an older installation maybe, not present here anymore
435
436 ; WHQL fake
437!ifdef WHQL_FAKE
438 Delete /REBOOTOK "$INSTDIR\VBoxWHQLFake.exe"
439!endif
440
441 ; Log file
442 Delete /REBOOTOK "$INSTDIR\install.log"
443 Delete /REBOOTOK "$INSTDIR\install_ui.log"
444
445FunctionEnd
446!macroend
447!insertmacro W2K_UninstallInstDir ""
448!insertmacro W2K_UninstallInstDir "un."
449
450!macro W2K_Uninstall un
451Function ${un}W2K_Uninstall
452
453 Push $0
454!if $%VBOX_WITH_WDDM% == "1"
455 ; First check whether WDDM driver is installed
456 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /matchdrv "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "WDDM"'
457 Pop $0 ; Ret value
458 ${If} $0 == "0"
459 DetailPrint "WDDM display driver is installed"
460 StrCpy $g_bWithWDDM "true"
461 ${ElseIf} $0 == "4"
462 DetailPrint "Non-WDDM display driver is installed"
463 ${Else}
464 DetailPrint "Error occured"
465 ; @todo Add error handling here!
466 ${Endif}
467!endif
468
469 ; Remove VirtualBox graphics adapter & PCI base drivers
470 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /u "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00"'
471 Pop $0 ; Ret value
472 ; @todo Add error handling here!
473
474 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /u "PCI\VEN_80EE&DEV_CAFE&SUBSYS_00000000&REV_00"'
475 Pop $0 ; Ret value
476 ; @todo Add error handling here!
477
478 ; @todo restore old drivers
479
480 ; Remove video driver
481 ${If} $g_bWithWDDM == "true"
482 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxVideoWddm'
483 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
484 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
485 ${Else}
486 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxVideo'
487 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
488 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
489 ${Endif}
490
491 ; Remove mouse driver
492 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxMouse'
493 Pop $0 ; Ret value
494 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
495 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /reg_delmultisz "SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}" "UpperFilters" "VBoxMouse"'
496 Pop $0 ; Ret value
497 ; @todo Add error handling here!
498
499 ; Delete the VBoxService service
500 Call ${un}StopVBoxService
501 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxService'
502 Pop $0 ; Ret value
503 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
504 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
505
506 ; GINA
507 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
508 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
509 ${If} $0 == "VBoxGINA.dll"
510 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
511 ${EndIf}
512
513 ; Delete VBoxTray
514 Call ${un}StopVBoxTray
515 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
516
517 ; Remove guest driver
518 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxGuest'
519 Pop $0 ; Ret value
520 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
521 Delete /REBOOTOK "$g_strSystemDir\vbcoinst.dll"
522 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
523 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
524 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
525 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
526
527 ; Remove shared folders driver
528 call ${un}RemoveProvider ; Remove Shared Folders network provider from registry
529 ; @todo Add a /delnetprovider to VBoxDrvInst for doing this job!
530 nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxSF'
531 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
532 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
533
534!if $%VBOX_WITH_CROGL% == "1"
535
536 DetailPrint "Removing 3D graphics support ..."
537 !if $%BUILD_TARGET_ARCH% == "x86"
538 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLarrayspu.dll"
539 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLcrutil.dll"
540 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLerrorspu.dll"
541 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpackspu.dll"
542 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpassthroughspu.dll"
543 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLfeedbackspu.dll"
544 Delete /REBOOTOK "$g_strSystemDir\VBoxOGL.dll"
545
546 ; Remove D3D stuff
547 ; @todo add a feature flag to only remove if installed explicitly
548 Delete /REBOOTOK "$g_strSystemDir\libWine.dll"
549 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D8.dll"
550 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D9.dll"
551 Delete /REBOOTOK "$g_strSystemDir\wined3d.dll"
552 ; Update DLL cache
553 IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" 0 +2
554 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d8.dll"
555 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll"
556 IfFileExists g_strSystemDir\dllcache\msd3d9.dll" 0 +2
557 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d9.dll"
558 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll"
559 ; Restore original DX DLLs
560 IfFileExists "$g_strSystemDir\msd3d8.dll" 0 +2
561 Delete /REBOOTOK "$g_strSystemDir\d3d8.dll"
562 Rename /REBOOTOK "$g_strSystemDir\msd3d8.dll" "$g_strSystemDir\d3d8.dll"
563 IfFileExists "$g_strSystemDir\msd3d9.dll" 0 +2
564 Delete /REBOOTOK "$g_strSystemDir\d3d9.dll"
565 Rename /REBOOTOK "$g_strSystemDir\msd3d9.dll" "$g_strSystemDir\d3d9.dll"
566
567 !else ; amd64
568
569 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
570 ${EnableX64FSRedirection}
571 Delete /REBOOTOK "$SYSDIR\VBoxOGLarrayspu.dll"
572 Delete /REBOOTOK "$SYSDIR\VBoxOGLcrutil.dll"
573 Delete /REBOOTOK "$SYSDIR\VBoxOGLerrorspu.dll"
574 Delete /REBOOTOK "$SYSDIR\VBoxOGLpackspu.dll"
575 Delete /REBOOTOK "$SYSDIR\VBoxOGLpassthroughspu.dll"
576 Delete /REBOOTOK "$SYSDIR\VBoxOGLfeedbackspu.dll"
577 Delete /REBOOTOK "$SYSDIR\VBoxOGL.dll"
578
579 ; Remove D3D stuff
580 ; @todo add a feature flag to only remove if installed explicitly
581 Delete /REBOOTOK "$SYSDIR\libWine.dll"
582 Delete /REBOOTOK "$SYSDIR\VBoxD3D8.dll"
583 Delete /REBOOTOK "$SYSDIR\VBoxD3D9.dll"
584 Delete /REBOOTOK "$SYSDIR\wined3d.dll"
585 ; Update DLL cache
586 IfFileExists "$SYSDIR\dllcache\msd3d8.dll" 0 +2
587 Delete /REBOOTOK "$SYSDIR\dllcache\d3d8.dll"
588 Rename /REBOOTOK "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll"
589 IfFileExists "$SYSDIR\dllcache\msd3d9.dll" 0 +2
590 Delete /REBOOTOK "$SYSDIR\dllcache\d3d9.dll"
591 Rename /REBOOTOK "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll"
592 ; Restore original DX DLLs
593 IfFileExists "$SYSDIR\msd3d8.dll" 0 +2
594 Delete /REBOOTOK "$SYSDIR\d3d8.dll"
595 Rename /REBOOTOK "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll"
596 IfFileExists "$SYSDIR\msd3d9.dll" 0 +2
597 Delete /REBOOTOK "$SYSDIR\d3d9.dll"
598 Rename /REBOOTOK "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll"
599 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
600 ${DisableX64FSRedirection}
601 !endif ; amd64
602
603 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
604
605!endif ; VBOX_WITH_CROGL
606
607 Pop $0
608
609FunctionEnd
610!macroend
611!insertmacro W2K_Uninstall ""
612!insertmacro W2K_Uninstall "un."
613
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use