b711a01730152421a900e5f4e237cfb848c9c4fdvboxsync; $Id$
b711a01730152421a900e5f4e237cfb848c9c4fdvboxsync; @file
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; VBoxGuestAdditionsNT4.nsh - Guest Additions installation for NT4.
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync;
2f14f4556ae74ad40719bc9690534693abb71868vboxsync
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync;
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync; Copyright (C) 2006-2013 Oracle Corporation
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync;
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; available from http://www.virtualbox.org. This file is free software;
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; you can redistribute it and/or modify it under the terms of the GNU
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; General Public License (GPL) as published by the Free Software
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync;
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_SetVideoResolution
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Check for all required parameters
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCmp $g_iScreenX "0" missingParms
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCmp $g_iScreenY "0" missingParms
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCmp $g_iScreenBpp "0" missingParms
78a072e1b56619e3230735ae073668311232ec94vboxsync Goto haveParms
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncmissingParms:
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Missing display parameters for NT4, setting default (640x480, 8 BPP) ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCpy $g_iScreenX '640' ; Default value
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCpy $g_iScreenY '480' ; Default value
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCpy $g_iScreenBpp '8' ; Default value
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Write setting into registry to show the desktop applet on next boot
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\GraphicsDrivers\NewDisplay" "" ""
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsynchaveParms:
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Setting display parameters for NT4 ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.BitsPerPel" $g_iScreenBpp
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.Flags" 0x00000000
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.VRefresh" 0x00000001
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.XPanning" 0x00000000
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.XResolution" $g_iScreenX
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.YPanning" 0x00000000
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.YResolution" $g_iScreenY
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_SaveMouseDriverInfo
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync Push $0
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; !!! NOTE !!!
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Due to some re-branding (see functions Uninstall_Sun, Uninstall_Innotek and
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Uninstall_SunXVM) the installer *has* to transport the very first saved i8042prt
78a072e1b56619e3230735ae073668311232ec94vboxsync ; value to the current installer's "uninstall" directory in both mentioned
78a072e1b56619e3230735ae073668311232ec94vboxsync ; functions above, otherwise NT4 will be screwed because it then would store
78a072e1b56619e3230735ae073668311232ec94vboxsync ; "VBoxMouseNT.sys" as the original i8042prt driver which obviously isn't there
cc260ed3418d1fd2771d0395f818f76808b60238vboxsync ; after uninstallation anymore
78a072e1b56619e3230735ae073668311232ec94vboxsync ; !!! NOTE !!!
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Save current mouse driver info so we may restore it on uninstallation
78a072e1b56619e3230735ae073668311232ec94vboxsync ; But first check if we already installed the additions otherwise we will
78a072e1b56619e3230735ae073668311232ec94vboxsync ; overwrite it with the VBoxMouseNT.sys
78a072e1b56619e3230735ae073668311232ec94vboxsync ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH}
78a072e1b56619e3230735ae073668311232ec94vboxsync StrCmp $0 "" 0 exists
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Saving mouse driver info ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath"
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH} $0
78a072e1b56619e3230735ae073668311232ec94vboxsync Goto exit
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncexists:
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Mouse driver info already saved."
78a072e1b56619e3230735ae073668311232ec94vboxsync Goto exit
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncexit:
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync!ifdef _DEBUG
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Mouse driver info: $0"
78a072e1b56619e3230735ae073668311232ec94vboxsync!endif
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync Pop $0
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_Prepare
78a072e1b56619e3230735ae073668311232ec94vboxsync
34aa2e97a2a6d7c3c0a5be5121edfd51a31281acvboxsync ${If} $g_bNoVBoxServiceExit == "false"
34aa2e97a2a6d7c3c0a5be5121edfd51a31281acvboxsync ; Stop / kill VBoxService
34aa2e97a2a6d7c3c0a5be5121edfd51a31281acvboxsync Call StopVBoxService
34aa2e97a2a6d7c3c0a5be5121edfd51a31281acvboxsync ${EndIf}
78a072e1b56619e3230735ae073668311232ec94vboxsync
156101683587682f6d63b4af322f611d90b77fcevboxsync ${If} $g_bNoVBoxTrayExit == "false"
156101683587682f6d63b4af322f611d90b77fcevboxsync ; Stop / kill VBoxTray
156101683587682f6d63b4af322f611d90b77fcevboxsync Call StopVBoxTray
156101683587682f6d63b4af322f611d90b77fcevboxsync ${EndIf}
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete VBoxService from registry
78a072e1b56619e3230735ae073668311232ec94vboxsync DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_CopyFiles
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Copying files for NT4 ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync SetOutPath "$INSTDIR"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxGuestDrvInst.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; The files to install for NT 4, they go into the system directories
78a072e1b56619e3230735ae073668311232ec94vboxsync SetOutPath "$SYSDIR"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; VBoxService
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxServiceNT.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; The drivers into the "drivers" directory
78a072e1b56619e3230735ae073668311232ec94vboxsync SetOutPath "$SYSDIR\drivers"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxGuestNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync ;FILE "$%PATH_OUT%\bin\additions\VBoxSFNT.sys" ; Shared Folders not available on NT4!
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_InstallFiles
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Installing drivers for NT4 ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Install guest driver
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxGuest$\" $\"VBoxGuest Support Driver$\" 1 1 $\"$SYSDIR\drivers\VBoxGuestNT.sys$\" $\"Base$\"" "false"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Bugfix: Set "Start" to 1, otherwise, VBoxGuest won't start on boot-up!
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Bugfix: Correct invalid "ImagePath" (\??\C:\WINNT\...)
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "Start" 1
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "ImagePath" "System32\Drivers\VBoxGuestNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Run VBoxTray when Windows NT starts
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" '"$SYSDIR\VBoxTray.exe"'
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Video driver
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxGuestDrvInst.exe$\" /i" "false"
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Installing VirtualBox service ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Create the VBoxService service
78a072e1b56619e3230735ae073668311232ec94vboxsync ; No need to stop/remove the service here! Do this only on uninstallation!
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"system32\VBoxServiceNT.exe$\" $\"Base$\"" "false"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Create the Shared Folders service ...
78a072e1b56619e3230735ae073668311232ec94vboxsync ;nsSCM::Install /NOUNLOAD "VBoxSF" "VirtualBox Shared Folders" 1 1 "$SYSDIR\drivers\VBoxSFNT.sys" "Network" "" "" ""
78a072e1b56619e3230735ae073668311232ec94vboxsync ;Pop $0 ; Ret value
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync!ifdef _DEBUG
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ;${LogVerbose} "SCM::Install VBoxSFNT.sys: $0"
78a072e1b56619e3230735ae073668311232ec94vboxsync!endif
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ;IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; ... and the link to the network provider
78a072e1b56619e3230735ae073668311232ec94vboxsync ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
78a072e1b56619e3230735ae073668311232ec94vboxsync ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
78a072e1b56619e3230735ae073668311232ec94vboxsync ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Add the shared folders network provider
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ;${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF" "false"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync Goto done
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncerror:
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Abort "ERROR: Could not install files for Windows NT4! Installation aborted."
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncdone:
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction NT4_Main
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync SetOutPath "$INSTDIR"
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Call NT4_Prepare
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Call NT4_CopyFiles
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; This removes the flag "new display driver installed on the next bootup
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "VBoxGuestInst" '"$INSTDIR\RegCleanup.exe"'
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Call NT4_SaveMouseDriverInfo
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Call NT4_InstallFiles
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Call NT4_SetVideoResolution
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Write mouse driver name to registry overwriting the default name
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" "System32\DRIVERS\VBoxMouseNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!macro NT4_UninstallInstDir un
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction ${un}NT4_UninstallInstDir
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete remaining files
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$INSTDIR\VBoxGuestDrvInst.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$INSTDIR\RegCleanup.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync!macroend
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!insertmacro NT4_UninstallInstDir ""
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!insertmacro NT4_UninstallInstDir "un."
78a072e1b56619e3230735ae073668311232ec94vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!macro NT4_Uninstall un
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncFunction ${un}NT4_Uninstall
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync Push $0
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Remove the guest driver service
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\drivers\VBoxGuestNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete the VBoxService service
78a072e1b56619e3230735ae073668311232ec94vboxsync Call ${un}StopVBoxService
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
78a072e1b56619e3230735ae073668311232ec94vboxsync DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\VBoxServiceNT.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete the VBoxTray app
78a072e1b56619e3230735ae073668311232ec94vboxsync Call ${un}StopVBoxTray
78a072e1b56619e3230735ae073668311232ec94vboxsync DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "VBoxTrayDel" "$SYSDIR\cmd.exe /c del /F /Q $SYSDIR\VBoxTray.exe"
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync Delete /REBOOTOK "$SYSDIR\VBoxTray.exe" ; If it can't be removed cause it's running, try next boot with "RunOnce" key above!
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\VBoxHook.dll"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete the VBoxControl utility
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\VBoxControl.exe"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete the VBoxVideo service
59bb2da0ef97dc8c9d0821ac921728f515623ac5vboxsync ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Delete the VBox video driver files
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\drivers\VBoxVideo.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\VBoxDisp.dll"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync ; Get original mouse driver info and restore it
78a072e1b56619e3230735ae073668311232ec94vboxsync ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH}
78a072e1b56619e3230735ae073668311232ec94vboxsync ; If we still got our driver stored in $0 then this will *never* work, so
78a072e1b56619e3230735ae073668311232ec94vboxsync ; warn the user and set it to the default driver to not screw up NT4 here
78a072e1b56619e3230735ae073668311232ec94vboxsync ${If} $0 == "System32\DRIVERS\VBoxMouseNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" "System32\DRIVERS\i8042prt.sys"
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync ${LogVerbose} "Old mouse driver is set to VBoxMouseNT.sys, defaulting to i8042prt.sys ..."
78a072e1b56619e3230735ae073668311232ec94vboxsync ${Else}
78a072e1b56619e3230735ae073668311232ec94vboxsync WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" $0
78a072e1b56619e3230735ae073668311232ec94vboxsync ${EndIf}
78a072e1b56619e3230735ae073668311232ec94vboxsync Delete /REBOOTOK "$SYSDIR\drivers\VBoxMouseNT.sys"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync Pop $0
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncFunctionEnd
78a072e1b56619e3230735ae073668311232ec94vboxsync!macroend
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!insertmacro NT4_Uninstall ""
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync!insertmacro NT4_Uninstall "un."