VBoxGuestAdditionsW2KXP.nsh revision e7a38576d54d605f0a98a9646abb201ff8d995e4
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncFunction W2K_SetVideoResolution
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; NSIS only supports global vars, even in functions -- great
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Var /GLOBAL i
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Var /GLOBAL tmp
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync Var /GLOBAL tmppath
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Var /GLOBAL dev_id
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Var /GLOBAL dev_desc
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Check for all required parameters
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync StrCmp $g_iScreenX "0" exit
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync StrCmp $g_iScreenY "0" exit
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync StrCmp $g_iScreenBpp "0" exit
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DetailPrint "Setting display parameters ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync ; Enumerate all video devices (up to 32 at the moment, use key "MaxObjectNumber" key later)
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync ${For} $i 0 32
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ReadRegStr $tmp HKLM "HARDWARE\DEVICEMAP\VIDEO" "\Device\Video$i"
456f370fcde010d585d9174df045978a6c9893c1vboxsync StrCmp $tmp "" dev_not_found
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Extract path to video settings
8c5d1958147c3988a7693b5a7666f5fe21a93b7bvboxsync ; Ex: \Registry\Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Or: \Registry\Machine\System\CurrentControlSet\Control\Video\vboxvideo\Device0
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Result: Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Push "$tmp" ; String
8c5d1958147c3988a7693b5a7666f5fe21a93b7bvboxsync Push "\" ; SubString
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync Push ">" ; SearchDirection
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync Push ">" ; StrInclusionDirection
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync Push "0" ; IncludeSubString
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync Push "2" ; Loops
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Push "0" ; CaseSensitive
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Call StrStrAdv
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Pop $tmppath ; $1 only contains the full path
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync StrCmp $tmppath "" dev_not_found
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; Get device description
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ReadRegStr $dev_desc HKLM "$tmppath" "Device Description"
f7d6665d93770b79026556438d5e081807917420vboxsync!ifdef _DEBUG
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DetailPrint "Registry path: $tmppath"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DetailPrint "Registry path to device name: $temp"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DetailPrint "Detected video device: $dev_desc"
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync ${If} $dev_desc == "VirtualBox Graphics Adapter"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DetailPrint "VirtualBox video device found!"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Goto dev_found
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Goto dev_not_found
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; If we're on Windows 2000, skip the ID detection ...
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ${If} $g_strWinVersion == "2000"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync Goto change_res
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync Goto dev_found_detect_id
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncdev_found_detect_id:
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync StrCpy $i 0 ; Start at index 0
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync DetailPrint "Detecting device ID ..."
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncdev_found_detect_id_loop:
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; Resolve real path to hardware instance "{GUID}"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync EnumRegKey $dev_id HKLM "SYSTEM\CurrentControlSet\Control\Video" $i
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync StrCmp $dev_id "" dev_not_found ; No more entries? Jump out
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync!ifdef _DEBUG
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync DetailPrint "Got device ID: $dev_id"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ReadRegStr $dev_desc HKLM "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000" "Device Description" ; Try to read device name
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync ${If} $dev_desc == "VirtualBox Graphics Adapter"
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync DetailPrint "Device ID of $dev_desc: $dev_id"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Goto change_res
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync IntOp $i $i + 1 ; Increment index
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync goto dev_found_detect_id_loop
771761cda2c81e899526a0dce22c8cd2510fff82vboxsyncdev_not_found:
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync DetailPrint "No VirtualBox video device (yet) detected! No custom mode set."
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync!ifdef _DEBUG
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync DetailPrint "Device description: $dev_desc"
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync DetailPrint "Device ID: $dev_id"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Var /GLOBAL reg_path_device
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Var /GLOBAL reg_path_monitor
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync DetailPrint "Custom mode set: Platform is Windows $g_strWinVersion"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ${If} $g_strWinVersion == "2000"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ${OrIf} $g_strWinVersion == "Vista"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync StrCpy $reg_path_device "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0\Mon00000001"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ${ElseIf} $g_strWinVersion == "XP"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ${OrIf} $g_strWinVersion == "7"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync StrCpy $reg_path_device "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\Control\VIDEO\$dev_id\0000\Mon00000001"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync DetailPrint "Custom mode set: Windows $g_strWinVersion not supported yet"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; Write the new value in the adapter config (VBoxVideo.sys) using hex values in binary format
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomXRes REG_BIN $g_iScreenX DWORD'
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD'
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD'
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; ... and tell Windows to use that mode on next start!
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync WriteRegDWORD HKCC $reg_path_device "DefaultSettings.XResolution" "$g_iScreenX"
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync WriteRegDWORD HKCC $reg_path_device "DefaultSettings.YResolution" "$g_iScreenY"
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync WriteRegDWORD HKCC $reg_path_device "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.XResolution" "$g_iScreenX"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.YResolution" "$g_iScreenY"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync DetailPrint "Custom mode set to $g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP on next restart."
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsyncFunction W2K_Prepare
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ${If} $g_bNoVBoxServiceExit == "false"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; Stop / kill VBoxService
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync Call StopVBoxService
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ${If} $g_bNoVBoxTrayExit == "false"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ; Stop / kill VBoxTray
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync Call StopVBoxTray
df3d4c8e9c81584c535676a3d40c57d868ac61bbvboxsync ; Delete VBoxService from registry
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncFunction W2K_CopyFiles
9c59bcefe2993070fafaf0d6cee9673f48479128vboxsync SetOutPath "$INSTDIR"
97674677e4f2aeae576c39f966568dd664ba7979vboxsync ; Video driver
efbdd9fc22305720d20be7cc37b4f45f43146b09vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
22e47c581ecabc66ee210e93099727074f74b2b9vboxsync ; Mouse driver
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync!ifdef VBOX_SIGN_ADDITIONS
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; Guest driver
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync!ifdef VBOX_SIGN_ADDITIONS
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ; Guest driver files
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBCoInst.dll"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe" ; Not used by W2K and up, but required by the .INF file
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; WHQL fake
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync!ifdef WHQL_FAKE
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxWHQLFake.exe"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync SetOutPath $g_strSystemDir
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; VBoxService
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxService.exe" ; Only used by W2K and up (for Shared Folders at the moment)
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync!if $%VBOX_WITH_CROGL% == "1"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !if $%VBOX_WITH_WDDM% == "1"
efbdd9fc22305720d20be7cc37b4f45f43146b09vboxsync !if $%BUILD_TARGET_ARCH% == "x86"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ${If} $g_bWithWDDM == "true"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; WDDM Video driver
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync StrCpy $0 "$TEMP\VBoxGuestAdditions\WDDM"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync CreateDirectory "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys" "$INSTDIR\VBoxVideoWddm.sys" "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf" "$INSTDIR\VBoxVideoWddm.inf" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll" "$INSTDIR\VBoxDispD3D.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll" "$INSTDIR\VBoxOGLarrayspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll" "$INSTDIR\VBoxOGLcrutil.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll" "$INSTDIR\VBoxOGLerrorspu.dll" "$0"
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll" "$INSTDIR\VBoxOGLpackspu.dll" "$0"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll" "$INSTDIR\VBoxOGLpassthroughspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll" "$INSTDIR\VBoxOGLfeedbackspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGL.dll" "$INSTDIR\VBoxOGL.dll" "$0"
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\libWine.dll" "$INSTDIR\libWine.dll" "$0"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll" "$INSTDIR\VBoxD3D9wddm.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\wined3dwddm.dll" "$INSTDIR\wined3dwddm.dll" "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync Goto doneCr
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !endif ; $%BUILD_TARGET_ARCH% == "x86"
8e1c5c73ab19c968abbd3decf41e4783cbd8c017vboxsync !endif ; $%VBOX_WITH_WDDM% == "1"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !if $%BUILD_TARGET_ARCH% == "amd64"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !define LIBRARY_X64 ; Enable installation of 64-bit libraries
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync StrCpy $0 "$TEMP\VBoxGuestAdditions\VBoxOGL"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync CreateDirectory "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll" "$g_strSystemDir\VBoxOGLarrayspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll" "$g_strSystemDir\VBoxOGLcrutil.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll" "$g_strSystemDir\VBoxOGLerrorspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll" "$g_strSystemDir\VBoxOGLpackspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll" "$g_strSystemDir\VBoxOGLpassthroughspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll" "$g_strSystemDir\VBoxOGLfeedbackspu.dll" "$0"
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGL.dll" "$g_strSystemDir\VBoxOGL.dll" "$0"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync !if $%BUILD_TARGET_ARCH% == "amd64"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !undef LIBRARY_X64 ; Disable installation of 64-bit libraries
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync !if $%BUILD_TARGET_ARCH% == "amd64"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync StrCpy $0 "$TEMP\VBoxGuestAdditions\VBoxOGL32"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync CreateDirectory "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target arch in
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ; Wow64 node (32-bit sub system). Note that $SYSDIR contains the 32-bit
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ; path after calling EnableX64FSRedirection
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ${EnableX64FSRedirection}
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll" "$SYSDIR\VBoxOGLarrayspu.dll" "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll" "$SYSDIR\VBoxOGLcrutil.dll" "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll" "$SYSDIR\VBoxOGLerrorspu.dll" "$0"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll" "$SYSDIR\VBoxOGLpackspu.dll" "$0"
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll" "$SYSDIR\VBoxOGLpassthroughspu.dll" "$0"
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll" "$SYSDIR\VBoxOGLfeedbackspu.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll" "$SYSDIR\VBoxOGL.dll" "$0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ${DisableX64FSRedirection}
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync!endif ; VBOX_WITH_CROGL
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync!ifdef WHQL_FAKE
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsyncFunction W2K_WHQLFakeOn
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync StrCmp $g_bFakeWHQL "true" do
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync DetailPrint "Turning off WHQL protection..."
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxWHQLFake.exe" "ignore"'
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsyncFunction W2K_WHQLFakeOff
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync StrCmp $g_bFakeWHQL "true" do
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync DetailPrint "Turning back on WHQL protection..."
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxWHQLFake.exe" "warn"'
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsyncFunction W2K_InstallFiles
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ; The Shared Folder IFS goes to the system directory
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync FILE /oname=$g_strSystemDir\drivers\VBoxSF.sys "$%PATH_OUT%\bin\additions\VBoxSF.sys"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync ; The VBoxTray hook DLL also goes to the system directory; it might be locked
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync DetailPrint "Installing Drivers..."
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync StrCmp $g_bNoVideoDrv "true" drv_guest
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync SetOutPath "$INSTDIR"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ${If} $g_bWithWDDM == "true"
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync DetailPrint "Installing WDDM video driver ..."
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxVideoWddm.inf" "Display"'
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync DetailPrint "Installing video driver ..."
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxVideo.inf" "Display"'
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync Pop $0 ; Ret value
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync LogText "Video driver result: $0"
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync StrCmp $g_bNoGuestDrv "true" drv_mouse
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync DetailPrint "Installing guest driver ..."
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /i "PCI\VEN_80EE&DEV_CAFE&SUBSYS_00000000&REV_00" "$INSTDIR\VBoxGuest.inf" "Media"'
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync Pop $0 ; Ret value
; No need to stop/remove the service here! Do this only on uninstallation!
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /createsvc "VBoxService" "VirtualBox Guest Additions Service" 16 2 "system32\VBoxService.exe" "Base"'
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
; No need to stop/remove the service here! Do this only on uninstallation!
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /createsvc "VBoxSF" "VirtualBox Shared Folders" 2 1 "system32\drivers\VBoxSF.sys" "NetworkProvider"'
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider WebClient'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider LanmanWorkstation'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider RDPNP'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /addnetprovider VBoxSF $g_iSfOrder'
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
WriteRegDWORD HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
Delete /REBOOTOK "$INSTDIR\VBCoInst.dll"
Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; File from an older installation maybe, not present here anymore
Delete /REBOOTOK "$INSTDIR\VBoxWHQLFake.exe"
Delete /REBOOTOK "$INSTDIR\install.log"
Delete /REBOOTOK "$INSTDIR\install_ui.log"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /matchdrv "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00" "WDDM"'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /u "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00"'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /u "PCI\VEN_80EE&DEV_CAFE&SUBSYS_00000000&REV_00"'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxVideoWddm'
Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxVideo'
Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxMouse'
Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /reg_delmultisz "SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}" "UpperFilters" "VBoxMouse"'
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxService'
Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
${If} $0 == "VBoxGINA.dll"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxGuest'
Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
Delete /REBOOTOK "$g_strSystemDir\vbcoinst.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
nsExec::ExecToLog '"$INSTDIR\VBoxDrvInst.exe" /delsvc VBoxSF'
Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLarrayspu.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLcrutil.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLerrorspu.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpackspu.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpassthroughspu.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGLfeedbackspu.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxOGL.dll"
Delete /REBOOTOK "$g_strSystemDir\libWine.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxD3D8.dll"
Delete /REBOOTOK "$g_strSystemDir\VBoxD3D9.dll"
Delete /REBOOTOK "$g_strSystemDir\wined3d.dll"
IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" 0 +2
Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d8.dll"
IfFileExists g_strSystemDir\dllcache\msd3d9.dll" 0 +2
Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d9.dll"
IfFileExists "$g_strSystemDir\msd3d8.dll" 0 +2
Delete /REBOOTOK "$g_strSystemDir\d3d8.dll"
IfFileExists "$g_strSystemDir\msd3d9.dll" 0 +2
Delete /REBOOTOK "$g_strSystemDir\d3d9.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLarrayspu.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLcrutil.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLerrorspu.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLpackspu.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLpassthroughspu.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGLfeedbackspu.dll"
Delete /REBOOTOK "$SYSDIR\VBoxOGL.dll"
Delete /REBOOTOK "$SYSDIR\libWine.dll"
Delete /REBOOTOK "$SYSDIR\VBoxD3D8.dll"
Delete /REBOOTOK "$SYSDIR\VBoxD3D9.dll"
Delete /REBOOTOK "$SYSDIR\wined3d.dll"
IfFileExists "$SYSDIR\dllcache\msd3d8.dll" 0 +2
Delete /REBOOTOK "$SYSDIR\dllcache\d3d8.dll"
IfFileExists "$SYSDIR\dllcache\msd3d9.dll" 0 +2
Delete /REBOOTOK "$SYSDIR\dllcache\d3d9.dll"
IfFileExists "$SYSDIR\msd3d8.dll" 0 +2
Delete /REBOOTOK "$SYSDIR\d3d8.dll"
IfFileExists "$SYSDIR\msd3d9.dll" 0 +2
Delete /REBOOTOK "$SYSDIR\d3d9.dll"