win-pvdrivers

view installer.nsi @ 644:7b9b8806ad93

Added tag 0.10.0.97 for changeset 1794a52f415d
author James Harper <james.harper@bendigoit.com.au>
date Tue Aug 25 10:17:37 2009 +1000 (2009-08-25)
parents db0ea4b20c3c
children
line source
1 !include "MUI.nsh"
2 !include "winver.nsh"
4 Var MYPROGRAMFILES
5 Var ARCH_SPEC
7 !define AppName "Xen PV Drivers"
8 !define StartMenu "$SMPROGRAMS\${AppName}"
9 !define Version "0.9.12-pre15"
10 #!define Version "$%VERSION%"
11 Name "${AppName}"
13 #InstallDir "$MYPROGRAMFILES\${AppName}"
14 OutFile "${AppName} ${Version}.exe"
16 # make sure /GPLPV is not currently active
18 #!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre
19 #!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow
20 !define MUI_STARTMENUPAGE
21 !define MUI_COMPONENTSPAGE
22 !define MUI_DIRECTORYPAGE
23 !insertmacro MUI_PAGE_WELCOME
24 !insertmacro MUI_PAGE_COMPONENTS
25 !insertmacro MUI_PAGE_INSTFILES
26 !define MUI_UNINSTALLER
27 !insertmacro MUI_LANGUAGE "English"
29 Section "Common Files"
30 SectionIn RO
31 SetOutPath $INSTDIR
32 File .\doc\Building.txt
33 File .\doc\Installing.txt
34 File .\doc\Readme.txt
35 File .\doc\TODO.txt
36 File .\doc\xennet.txt
37 ExecWait 'NET STOP ShutdownMon'
38 StrCmp $ARCH_SPEC "amd64" amd64
39 File .\target\winxp\i386\copyconfig.exe
40 File .\target\winxp\i386\shutdownmon.exe
41 File $%DDK_PATH%\redist\DIFx\DPInst\EngMui\x86\DPInst.exe
42 Goto amd64_done
43 amd64:
44 File .\target\winnet\amd64\copyconfig.exe
45 File .\target\winnet\amd64\shutdownmon.exe
46 File $%DDK_PATH%\redist\DIFx\DPInst\EngMui\amd64\DPInst.exe
47 amd64_done:
48 CreateDirectory "${StartMenu}\"
49 CreateShortCut "${StartMenu}\Building.lnk" "$INSTDIR\Building.txt"
50 CreateShortCut "${StartMenu}\Installing.lnk" "$INSTDIR\Installing.txt"
51 CreateShortCut "${StartMenu}\Readme.lnk" "$INSTDIR\Readme.txt"
52 CreateShortCut "${StartMenu}\TODO.lnk" "$INSTDIR\TODO.txt"
53 CreateShortCut "${StartMenu}\Wiki Page.lnk" "http://wiki.xensource.com/xenwiki/XenWindowsGplPv"
54 WriteUninstaller $INSTDIR\Uninstall.exe
55 CreateShortCut "${StartMenu}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
56 SectionEnd
58 Section "Windows XP" winxp
59 SetOutPath $INSTDIR
60 File /nonfatal .\ca.cer
61 SetOutPath $INSTDIR\drivers
62 File .\target\winxp\xenpci.inf
63 File .\target\winxp\xennet.inf
64 File .\target\winxp\xenvbd.inf
65 File .\target\winxp\xenscsi.inf
66 File .\target\winxp\xenstub.inf
67 File /nonfatal .\target\winxp\xengplpv.cat
68 SetOutPath $INSTDIR\drivers\i386
69 File .\target\winxp\i386\xenpci.sys
70 File .\target\winxp\i386\xenhide.sys
71 File .\target\winxp\i386\xennet.sys
72 File .\target\winxp\i386\xenvbd.sys
73 File .\target\winxp\i386\xenscsi.sys
74 File .\target\winxp\i386\xenstub.sys
75 SectionEnd
77 Section "Windows 2003 x32" win2k3x32
78 SetOutPath $INSTDIR
79 File /nonfatal .\ca.cer
80 SetOutPath $INSTDIR\drivers
81 File .\target\winnet\xenpci.inf
82 File .\target\winnet\xennet.inf
83 File .\target\winnet\xenvbd.inf
84 File .\target\winnet\xenscsi.inf
85 File .\target\winnet\xenstub.inf
86 File /nonfatal .\target\winnet\xengplpv.cat
87 SetOutPath $INSTDIR\drivers\i386
88 File .\target\winnet\i386\xenpci.sys
89 File .\target\winnet\i386\xenhide.sys
90 File .\target\winnet\i386\xennet.sys
91 File .\target\winnet\i386\xenvbd.sys
92 File .\target\winnet\i386\xenscsi.sys
93 File .\target\winnet\i386\xenstub.sys
94 SectionEnd
96 Section "Windows 2003 x64" win2k3x64
97 SetOutPath $INSTDIR
98 File /nonfatal .\ca.cer
99 SetOutPath $INSTDIR\drivers
100 File .\target\winnet\xenpci.inf
101 File .\target\winnet\xennet.inf
102 File .\target\winnet\xenvbd.inf
103 File .\target\winnet\xenscsi.inf
104 File .\target\winnet\xenstub.inf
105 File /nonfatal .\target\winnet\xengplpv.cat
106 SetOutPath $INSTDIR\drivers\amd64
107 File .\target\winnet\amd64\xenpci.sys
108 File .\target\winnet\amd64\xenhide.sys
109 File .\target\winnet\amd64\xennet.sys
110 File .\target\winnet\amd64\xenvbd.sys
111 File .\target\winnet\amd64\xenscsi.sys
112 File .\target\winnet\amd64\xenstub.sys
113 SectionEnd
115 Section "Windows 2008 x32" win2k8x32
116 SetOutPath $INSTDIR
117 File /nonfatal .\ca.cer
118 SetOutPath $INSTDIR\drivers
119 File .\target\winlh\xenpci.inf
120 File .\target\winlh\xennet.inf
121 File .\target\winlh\xenvbd.inf
122 File .\target\winlh\xenscsi.inf
123 File .\target\winlh\xenstub.inf
124 File /nonfatal .\target\winlh\xengplpv.cat
125 SetOutPath $INSTDIR\drivers\i386
126 File .\target\winlh\i386\xenpci.sys
127 File .\target\winlh\i386\xenhide.sys
128 File .\target\winlh\i386\xennet.sys
129 File .\target\winlh\i386\xenvbd.sys
130 File .\target\winlh\i386\xenscsi.sys
131 File .\target\winlh\i386\xenstub.sys
132 SectionEnd
134 Section "Windows 2008 x64" win2k8x64
135 SetOutPath $INSTDIR
136 File /nonfatal .\ca.cer
137 SetOutPath $INSTDIR\drivers
138 File .\target\winlh\xenpci.inf
139 File .\target\winlh\xennet.inf
140 File .\target\winlh\xenvbd.inf
141 File .\target\winlh\xenscsi.inf
142 File .\target\winlh\xenstub.inf
143 File /nonfatal .\target\winlh\xengplpv.cat
144 SetOutPath $INSTDIR\drivers\amd64
145 File .\target\winlh\amd64\xenpci.sys
146 File .\target\winlh\amd64\xenhide.sys
147 File .\target\winlh\amd64\xennet.sys
148 File .\target\winlh\amd64\xenvbd.sys
149 File .\target\winlh\amd64\xenscsi.sys
150 File .\target\winlh\amd64\xenstub.sys
151 SectionEnd
153 Section /o "Install Cert" installcert
154 # For some reason this next line doesn't need any double quotes around
155 # the filename, and in fact it breaks when they are included...
156 ExecWait 'rundll32.exe cryptext.dll,CryptExtAddCER $INSTDIR\ca.cer'
157 SectionEnd
159 Section "Install Drivers" installdrivers
160 ExecWait '"$INSTDIR\DPInst.exe" /PATH "$INSTDIR\drivers" /LM /SA /SE /SW'
161 !if false
162 Push "$INSTDIR\drivers"
163 Push "$INSTDIR\drivers\xennet.inf"
164 Push "XEN\VIF"
165 Call InstallUpgradeDriver
167 Push "$INSTDIR\drivers"
168 Push "$INSTDIR\drivers\xenvbd.inf"
169 Push "XEN\VBD"
170 Call InstallUpgradeDriver
172 Push "$INSTDIR\drivers"
173 Push "$INSTDIR\drivers\xenscsi.inf"
174 Push "XEN\VSCSI"
175 Call InstallUpgradeDriver
177 Push "$INSTDIR\drivers"
178 Push "$INSTDIR\drivers\xenstub.inf"
179 Push "XEN\CONSOLE"
180 Call InstallUpgradeDriver
182 Push "$INSTDIR\drivers"
183 Push "$INSTDIR\drivers\xenstub.inf"
184 Push "XEN\VFB"
185 Call InstallUpgradeDriver
187 Push "$INSTDIR\drivers"
188 Push "$INSTDIR\drivers\xenstub.inf"
189 Push "XEN\VKBD"
190 Call InstallUpgradeDriver
192 Push "$INSTDIR\drivers"
193 Push "$INSTDIR\drivers\xenpci.inf"
194 Push "PCI\VEN_5853&DEV_0001"
195 Call InstallUpgradeDriver
196 !endif
197 SectionEnd
199 Section "Shutdown Monitor Service" shutdownmon
200 ExecWait '"$INSTDIR\ShutdownMon.exe" -o'
201 ExecWait '"$INSTDIR\ShutdownMon.exe" -u'
202 ExecWait '"$INSTDIR\ShutdownMon.exe" -i'
203 ExecWait 'NET START ShutdownMon'
204 SectionEnd
206 Section /o "Copy Network Config" copynetworkconfig
207 MessageBox MB_OKCANCEL "This will copy the network IP configuration from the qemu network adapter to the gplpv xennet network adapter. Ensure that all the drivers are loaded for all the network adapters before clicking OK" IDCANCEL done
208 ExecWait '"$INSTDIR\copyconfig.exe"'
209 done:
210 SectionEnd
212 Var arch
214 Function .onInit
215 Push $0
217 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Control SystemStartOptions
218 Push $0
219 Push "GPLPV"
220 Call StrContains
221 Pop $0
222 StrCmp $0 "" no_GPLPV
224 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Services\XenHide DisplayName
225 StrCmp $0 "" 0 no_GPLPV
227 MessageBox MB_OK "Warning - GPLPV specified on boot but drivers not installed yet. You should cancel now and boot without GPLPV"
228 no_GPLPV:
230 Call GetWindowsVersion
231 Pop $R0
233 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
234 StrCmp $0 "AMD64" is_amd64
235 StrCpy $MYPROGRAMFILES $PROGRAMFILES
236 StrCpy $ARCH_SPEC "i386"
237 Goto amd64_done
238 is_amd64:
239 StrCpy $MYPROGRAMFILES $PROGRAMFILES64
240 StrCpy $ARCH_SPEC "amd64"
241 amd64_done:
242 StrCpy $INSTDIR "$MYPROGRAMFILES\${AppName}"
244 StrCmp $R0 "XP" 0 check_2k3
245 StrCpy $arch "winxp"
246 Goto version_done
247 check_2k3:
248 StrCmp $R0 "2003" 0 check_2k8
249 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
250 StrCmp $0 "AMD64" version_2k3x64
251 StrCpy $arch "win2k3x32"
252 Goto version_done
253 version_2k3x64:
254 StrCpy $arch "win2k3x64"
255 Goto version_done
256 check_2k8:
257 StrCmp $R0 "Vista" 0 version_error
258 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
259 StrCmp $0 "AMD64" version_2k8x64
260 StrCpy $arch "win2k8x32"
261 Goto version_done
262 version_2k8x64:
263 StrCpy $arch "win2k8x64"
264 Goto version_done
265 version_error:
266 MessageBox MB_OK "Unable to detect windows version - proceed with caution"
267 StrCpy $arch ""
269 version_done:
270 Call SelectSection
272 # SectionGetFlags ${sec1} $0
273 # IntOp $0 $0 | ${SF_SELECTED}
274 # SectionSetFlags ${sec1} $0
276 Pop $0
277 FunctionEnd
279 Var NewArch
281 Function .onSelChange
282 Push $0
284 StrCpy $newarch $arch
285 StrCmp $arch "winxp" check_2k3x32
286 SectionGetFlags ${winxp} $0
287 IntOp $0 $0 & ${SF_SELECTED}
288 IntCmp $0 ${SF_SELECTED} 0 check_2k3x32 check_2k3x32
289 StrCpy $newarch "winxp"
290 check_2k3x32:
291 StrCmp $arch "win2k3x32" check_2k3x64
292 SectionGetFlags ${win2k3x32} $0
293 IntOp $0 $0 & ${SF_SELECTED}
294 IntCmp $0 ${SF_SELECTED} 0 check_2k3x64 check_2k3x64
295 StrCpy $newarch "win2k3x32"
296 check_2k3x64:
297 StrCmp $arch "win2k3x64" check_2k8x32
298 SectionGetFlags ${win2k3x64} $0
299 IntOp $0 $0 & ${SF_SELECTED}
300 IntCmp $0 ${SF_SELECTED} 0 check_2k8x32 check_2k8x32
301 StrCpy $newarch "win2k3x64"
302 check_2k8x32:
303 StrCmp $arch "win2k8x32" check_2k8x64
304 SectionGetFlags ${win2k8x32} $0
305 IntOp $0 $0 & ${SF_SELECTED}
306 IntCmp $0 ${SF_SELECTED} 0 check_2k8x64 check_2k8x64
307 StrCpy $newarch "win2k8x32"
308 check_2k8x64:
309 StrCmp $arch "win2k8x64" done
310 SectionGetFlags ${win2k8x64} $0
311 IntOp $0 $0 & ${SF_SELECTED}
312 IntCmp $0 ${SF_SELECTED} 0 done done
313 StrCpy $newarch "win2k8x64"
314 done:
315 StrCpy $arch $newarch
316 Call SelectSection
318 Pop $0
319 FunctionEnd
321 Function SelectSection
322 Push $0
324 StrCmp $arch "winxp" set_winxp
325 SectionGetFlags ${winxp} $0
326 IntOp $0 $0 & ${SECTION_OFF}
327 SectionSetFlags ${winxp} $0
328 goto check_2k3x32
329 set_winxp:
330 SectionGetFlags ${winxp} $0
331 IntOp $0 $0 | ${SF_SELECTED}
332 SectionSetFlags ${winxp} $0
333 check_2k3x32:
334 StrCmp $arch "win2k3x32" set_2k3x32
335 SectionGetFlags ${win2k3x32} $0
336 IntOp $0 $0 & ${SECTION_OFF}
337 SectionSetFlags ${win2k3x32} $0
338 goto check_2k3x64
339 set_2k3x32:
340 SectionGetFlags ${win2k3x32} $0
341 IntOp $0 $0 | ${SF_SELECTED}
342 SectionSetFlags ${win2k3x32} $0
343 check_2k3x64:
344 StrCmp $arch "win2k3x64" set_2k3x64
345 SectionGetFlags ${win2k3x64} $0
346 IntOp $0 $0 & ${SECTION_OFF}
347 SectionSetFlags ${win2k3x64} $0
348 goto check_2k8x32
349 set_2k3x64:
350 SectionGetFlags ${win2k3x64} $0
351 IntOp $0 $0 | ${SF_SELECTED}
352 SectionSetFlags ${win2k3x64} $0
353 check_2k8x32:
354 StrCmp $arch "win2k8x32" set_2k8x32
355 SectionGetFlags ${win2k8x32} $0
356 IntOp $0 $0 & ${SECTION_OFF}
357 SectionSetFlags ${win2k8x32} $0
358 goto check_2k8x64
359 set_2k8x32:
360 SectionGetFlags ${win2k8x32} $0
361 IntOp $0 $0 | ${SF_SELECTED}
362 SectionSetFlags ${win2k8x32} $0
363 check_2k8x64:
364 StrCmp $arch "win2k8x64" set_2k8x64
365 SectionGetFlags ${win2k8x64} $0
366 IntOp $0 $0 & ${SECTION_OFF}
367 SectionSetFlags ${win2k8x64} $0
368 goto done
369 set_2k8x64:
370 SectionGetFlags ${win2k8x64} $0
371 IntOp $0 $0 | ${SF_SELECTED}
372 SectionSetFlags ${win2k8x64} $0
373 done:
374 Pop $0
376 FunctionEnd
378 Section "Uninstall"
379 Delete "${StartMenu}\Uninstall.lnk"
380 RMDir "${StartMenu}\"
381 Delete $INSTDIR\uninstall.exe
382 RMDir $INSTDIR
383 SectionEnd
385 Var STR_HAYSTACK
386 Var STR_NEEDLE
387 Var STR_CONTAINS_VAR_1
388 Var STR_CONTAINS_VAR_2
389 Var STR_CONTAINS_VAR_3
390 Var STR_CONTAINS_VAR_4
391 Var STR_RETURN_VAR
393 Function StrContains
394 Exch $STR_NEEDLE
395 Exch 1
396 Exch $STR_HAYSTACK
397 ; Uncomment to debug
398 ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
399 StrCpy $STR_RETURN_VAR ""
400 StrCpy $STR_CONTAINS_VAR_1 -1
401 StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
402 StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
403 loop:
404 IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
405 StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
406 StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
407 StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
408 Goto loop
409 found:
410 StrCpy $STR_RETURN_VAR $STR_NEEDLE
411 Goto done
412 done:
413 Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
414 Exch $STR_RETURN_VAR
415 FunctionEnd