1 | ; $Id$
|
---|
2 | ; @file
|
---|
3 | ; VBoxGuestAdditionsNT4.nsh - Guest Additions installation for NT4.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 |
|
---|
18 | Function NT4_SetVideoResolution
|
---|
19 |
|
---|
20 | ; Check for all required parameters
|
---|
21 | StrCmp $g_iScreenX "0" missingParms
|
---|
22 | StrCmp $g_iScreenY "0" missingParms
|
---|
23 | StrCmp $g_iScreenBpp "0" missingParms
|
---|
24 | Goto haveParms
|
---|
25 |
|
---|
26 | missingParms:
|
---|
27 |
|
---|
28 | ${LogVerbose} "Missing display parameters for NT4, setting default (640x480, 8 BPP) ..."
|
---|
29 |
|
---|
30 | StrCpy $g_iScreenX '640' ; Default value
|
---|
31 | StrCpy $g_iScreenY '480' ; Default value
|
---|
32 | StrCpy $g_iScreenBpp '8' ; Default value
|
---|
33 |
|
---|
34 | ; Write setting into registry to show the desktop applet on next boot
|
---|
35 | WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\GraphicsDrivers\NewDisplay" "" ""
|
---|
36 |
|
---|
37 | haveParms:
|
---|
38 |
|
---|
39 | ${LogVerbose} "Setting display parameters for NT4 ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
|
---|
40 |
|
---|
41 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.BitsPerPel" $g_iScreenBpp
|
---|
42 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.Flags" 0x00000000
|
---|
43 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.VRefresh" 0x00000001
|
---|
44 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.XPanning" 0x00000000
|
---|
45 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.XResolution" $g_iScreenX
|
---|
46 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.YPanning" 0x00000000
|
---|
47 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vboxvideo\Device0" "DefaultSettings.YResolution" $g_iScreenY
|
---|
48 |
|
---|
49 | FunctionEnd
|
---|
50 |
|
---|
51 | Function NT4_SaveMouseDriverInfo
|
---|
52 |
|
---|
53 | Push $0
|
---|
54 |
|
---|
55 | ; !!! NOTE !!!
|
---|
56 | ; Due to some re-branding (see functions Uninstall_Sun, Uninstall_Innotek and
|
---|
57 | ; Uninstall_SunXVM) the installer *has* to transport the very first saved i8042prt
|
---|
58 | ; value to the current installer's "uninstall" directory in both mentioned
|
---|
59 | ; functions above, otherwise NT4 will be screwed because it then would store
|
---|
60 | ; "VBoxMouseNT.sys" as the original i8042prt driver which obviously isn't there
|
---|
61 | ; after uninstallation anymore
|
---|
62 | ; !!! NOTE !!!
|
---|
63 |
|
---|
64 | ; Save current mouse driver info so we may restore it on uninstallation
|
---|
65 | ; But first check if we already installed the additions otherwise we will
|
---|
66 | ; overwrite it with the VBoxMouseNT.sys
|
---|
67 | ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH}
|
---|
68 | StrCmp $0 "" 0 exists
|
---|
69 |
|
---|
70 | ${LogVerbose} "Saving mouse driver info ..."
|
---|
71 | ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath"
|
---|
72 | WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH} $0
|
---|
73 | Goto exit
|
---|
74 |
|
---|
75 | exists:
|
---|
76 |
|
---|
77 | ${LogVerbose} "Mouse driver info already saved."
|
---|
78 | Goto exit
|
---|
79 |
|
---|
80 | exit:
|
---|
81 |
|
---|
82 | !ifdef _DEBUG
|
---|
83 | ${LogVerbose} "Mouse driver info: $0"
|
---|
84 | !endif
|
---|
85 |
|
---|
86 | Pop $0
|
---|
87 |
|
---|
88 | FunctionEnd
|
---|
89 |
|
---|
90 | Function NT4_Prepare
|
---|
91 |
|
---|
92 | ${If} $g_bNoVBoxServiceExit == "false"
|
---|
93 | ; Stop / kill VBoxService
|
---|
94 | Call StopVBoxService
|
---|
95 | ${EndIf}
|
---|
96 |
|
---|
97 | ${If} $g_bNoVBoxTrayExit == "false"
|
---|
98 | ; Stop / kill VBoxTray
|
---|
99 | Call StopVBoxTray
|
---|
100 | ${EndIf}
|
---|
101 |
|
---|
102 | ; Delete VBoxService from registry
|
---|
103 | DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
|
---|
104 |
|
---|
105 | ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
|
---|
106 | Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
|
---|
107 |
|
---|
108 | FunctionEnd
|
---|
109 |
|
---|
110 | Function NT4_CopyFiles
|
---|
111 |
|
---|
112 | ${LogVerbose} "Copying files for NT4 ..."
|
---|
113 |
|
---|
114 | SetOutPath "$INSTDIR"
|
---|
115 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestDrvInst.exe"
|
---|
116 | FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
|
---|
117 |
|
---|
118 | ; The files to install for NT 4, they go into the system directories
|
---|
119 | SetOutPath "$SYSDIR"
|
---|
120 | FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
|
---|
121 | FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
|
---|
122 | FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
|
---|
123 | FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
|
---|
124 |
|
---|
125 | ; VBoxService
|
---|
126 | FILE "$%PATH_OUT%\bin\additions\VBoxServiceNT.exe"
|
---|
127 |
|
---|
128 | ; The drivers into the "drivers" directory
|
---|
129 | SetOutPath "$SYSDIR\drivers"
|
---|
130 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
|
---|
131 | FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
|
---|
132 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestNT.sys"
|
---|
133 | ;FILE "$%PATH_OUT%\bin\additions\VBoxSFNT.sys" ; Shared Folders not available on NT4!
|
---|
134 |
|
---|
135 | FunctionEnd
|
---|
136 |
|
---|
137 | Function NT4_InstallFiles
|
---|
138 |
|
---|
139 | ${LogVerbose} "Installing drivers for NT4 ..."
|
---|
140 |
|
---|
141 | ; Install guest driver
|
---|
142 | ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxGuest$\" $\"VBoxGuest Support Driver$\" 1 1 $\"$SYSDIR\drivers\VBoxGuestNT.sys$\" $\"Base$\"" "false"
|
---|
143 |
|
---|
144 | ; Bugfix: Set "Start" to 1, otherwise, VBoxGuest won't start on boot-up!
|
---|
145 | ; Bugfix: Correct invalid "ImagePath" (\??\C:\WINNT\...)
|
---|
146 | WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "Start" 1
|
---|
147 | WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "ImagePath" "System32\Drivers\VBoxGuestNT.sys"
|
---|
148 |
|
---|
149 | ; Run VBoxTray when Windows NT starts
|
---|
150 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" '"$SYSDIR\VBoxTray.exe"'
|
---|
151 |
|
---|
152 | ; Video driver
|
---|
153 | ${CmdExecute} "$\"$INSTDIR\VBoxGuestDrvInst.exe$\" /i" "false"
|
---|
154 |
|
---|
155 | ${LogVerbose} "Installing VirtualBox service ..."
|
---|
156 |
|
---|
157 | ; Create the VBoxService service
|
---|
158 | ; No need to stop/remove the service here! Do this only on uninstallation!
|
---|
159 | ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"system32\VBoxServiceNT.exe$\" $\"Base$\"" "false"
|
---|
160 |
|
---|
161 | ; Create the Shared Folders service ...
|
---|
162 | ;nsSCM::Install /NOUNLOAD "VBoxSF" "VirtualBox Shared Folders" 1 1 "$SYSDIR\drivers\VBoxSFNT.sys" "Network" "" "" ""
|
---|
163 | ;Pop $0 ; Ret value
|
---|
164 |
|
---|
165 | !ifdef _DEBUG
|
---|
166 | ;${LogVerbose} "SCM::Install VBoxSFNT.sys: $0"
|
---|
167 | !endif
|
---|
168 |
|
---|
169 | ;IntCmp $0 0 +1 error error ; Check ret value (0=OK, 1=Error)
|
---|
170 |
|
---|
171 | ; ... and the link to the network provider
|
---|
172 | ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
|
---|
173 | ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
|
---|
174 | ;WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
|
---|
175 |
|
---|
176 | ; Add the shared folders network provider
|
---|
177 | ;${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF" "false"
|
---|
178 |
|
---|
179 | Goto done
|
---|
180 |
|
---|
181 | error:
|
---|
182 | Abort "ERROR: Could not install files for Windows NT4! Installation aborted."
|
---|
183 |
|
---|
184 | done:
|
---|
185 |
|
---|
186 | FunctionEnd
|
---|
187 |
|
---|
188 | Function NT4_Main
|
---|
189 |
|
---|
190 | SetOutPath "$INSTDIR"
|
---|
191 |
|
---|
192 | Call NT4_Prepare
|
---|
193 | Call NT4_CopyFiles
|
---|
194 |
|
---|
195 | ; This removes the flag "new display driver installed on the next bootup
|
---|
196 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "VBoxGuestInst" '"$INSTDIR\RegCleanup.exe"'
|
---|
197 |
|
---|
198 | Call NT4_SaveMouseDriverInfo
|
---|
199 | Call NT4_InstallFiles
|
---|
200 | Call NT4_SetVideoResolution
|
---|
201 |
|
---|
202 | ; Write mouse driver name to registry overwriting the default name
|
---|
203 | WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" "System32\DRIVERS\VBoxMouseNT.sys"
|
---|
204 |
|
---|
205 | FunctionEnd
|
---|
206 |
|
---|
207 | !macro NT4_UninstallInstDir un
|
---|
208 | Function ${un}NT4_UninstallInstDir
|
---|
209 |
|
---|
210 | ; Delete remaining files
|
---|
211 | Delete /REBOOTOK "$INSTDIR\VBoxGuestDrvInst.exe"
|
---|
212 | Delete /REBOOTOK "$INSTDIR\RegCleanup.exe"
|
---|
213 |
|
---|
214 | FunctionEnd
|
---|
215 | !macroend
|
---|
216 | !insertmacro NT4_UninstallInstDir ""
|
---|
217 | !insertmacro NT4_UninstallInstDir "un."
|
---|
218 |
|
---|
219 | !macro NT4_Uninstall un
|
---|
220 | Function ${un}NT4_Uninstall
|
---|
221 |
|
---|
222 | Push $0
|
---|
223 |
|
---|
224 | ; Remove the guest driver service
|
---|
225 | ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
|
---|
226 | Delete /REBOOTOK "$SYSDIR\drivers\VBoxGuestNT.sys"
|
---|
227 |
|
---|
228 | ; Delete the VBoxService service
|
---|
229 | Call ${un}StopVBoxService
|
---|
230 | ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
|
---|
231 | DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
|
---|
232 | Delete /REBOOTOK "$SYSDIR\VBoxServiceNT.exe"
|
---|
233 |
|
---|
234 | ; Delete the VBoxTray app
|
---|
235 | Call ${un}StopVBoxTray
|
---|
236 | DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
|
---|
237 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "VBoxTrayDel" "$SYSDIR\cmd.exe /c del /F /Q $SYSDIR\VBoxTray.exe"
|
---|
238 | Delete /REBOOTOK "$SYSDIR\VBoxTray.exe" ; If it can't be removed cause it's running, try next boot with "RunOnce" key above!
|
---|
239 | Delete /REBOOTOK "$SYSDIR\VBoxHook.dll"
|
---|
240 |
|
---|
241 | ; Delete the VBoxControl utility
|
---|
242 | Delete /REBOOTOK "$SYSDIR\VBoxControl.exe"
|
---|
243 |
|
---|
244 | ; Delete the VBoxVideo service
|
---|
245 | ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
|
---|
246 |
|
---|
247 | ; Delete the VBox video driver files
|
---|
248 | Delete /REBOOTOK "$SYSDIR\drivers\VBoxVideo.sys"
|
---|
249 | Delete /REBOOTOK "$SYSDIR\VBoxDisp.dll"
|
---|
250 |
|
---|
251 | ; Get original mouse driver info and restore it
|
---|
252 | ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" ${ORG_MOUSE_PATH}
|
---|
253 | ; If we still got our driver stored in $0 then this will *never* work, so
|
---|
254 | ; warn the user and set it to the default driver to not screw up NT4 here
|
---|
255 | ${If} $0 == "System32\DRIVERS\VBoxMouseNT.sys"
|
---|
256 | WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" "System32\DRIVERS\i8042prt.sys"
|
---|
257 | ${LogVerbose} "Old mouse driver is set to VBoxMouseNT.sys, defaulting to i8042prt.sys ..."
|
---|
258 | ${Else}
|
---|
259 | WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\i8042prt" "ImagePath" $0
|
---|
260 | ${EndIf}
|
---|
261 | Delete /REBOOTOK "$SYSDIR\drivers\VBoxMouseNT.sys"
|
---|
262 |
|
---|
263 | Pop $0
|
---|
264 |
|
---|
265 | FunctionEnd
|
---|
266 | !macroend
|
---|
267 | !insertmacro NT4_Uninstall ""
|
---|
268 | !insertmacro NT4_Uninstall "un."
|
---|