2 ' * Copyright (c) 2008 Intel Corporation. All rights reserved.
\r
4 ' * This software is available to you under the OpenIB.org BSD license
\r
7 ' * Redistribution and use in source and binary forms, with or
\r
8 ' * without modification, are permitted provided that the following
\r
9 ' * conditions are met:
\r
11 ' * - Redistributions of source code must retain the above
\r
12 ' * copyright notice, this list of conditions and the following
\r
15 ' * - Redistributions in binary form must reproduce the above
\r
16 ' * copyright notice, this list of conditions and the following
\r
17 ' * disclaimer in the documentation and/or other materials
\r
18 ' * provided with the distribution.
\r
20 ' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
21 ' * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
22 ' * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
23 ' * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
24 ' * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
25 ' * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
26 ' * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
30 ' WIX CustomActions used in the WinOF (Windows OpenFabrics) Release.
\r
31 ' File is based on the installer src contributed by Mellanox Technologies.
\r
37 Const WindowsXP ="501"
\r
38 Const WindowsLongHorn ="600"
\r
39 Const Windows7 ="700"
\r
41 ' Global debug flag: Session.Property from msiexec.exe cmd line DBG=1
\r
44 Function Architecture()
\r
46 For Each item In GetObject("winmgmts:root/cimv2").ExecQuery("SELECT Architecture FROM Win32_Processor")
\r
47 Arch=item.Architecture
\r
53 Elseif (Arch=1) Then
\r
55 Elseif (Arch=2) Then
\r
57 Elseif (Arch=3) Then
\r
59 Elseif (Arch=6) Then
\r
61 Elseif (Arch=9) Then
\r
65 WScript.echo "Arch ID=" & Arch
\r
66 Arch="CustomAction.vbs: Unable to determine Architecture"
\r
74 ' A CustomAction (CA) that runs after SetupInitialize which sets up
\r
75 ' CustomAction Data for the defered action DriverInstall().
\r
76 ' A CA can only see Installer properties through pre-loaded 'CustomActionData'
\r
79 dim VersionNT,Installed,AddLocal,use_this_HCA
\r
81 VersionNT = Session.Property("VersionNT")
\r
82 Installed = Session.Property("Installed")
\r
83 AddLocal = Session.Property("ADDLOCAL")
\r
85 ' The WIX UI (UserInterface) sets up ADDLOCAL. When cmd-line msiexec.exe is
\r
86 ' run with a deprecited UI, then ADDLOCAL is not setup; default it's value
\r
88 If AddLocal = "" AND Installed = "" Then
\r
89 ' Enable default features.
\r
90 AddLocal = "IBcore,hca_mthca,fIPoIB,fWSD,fDAPL,fDatBASIC1,fDatBASIC2"
\r
93 ' Process msiexec cmd line arg HCA=cx or HCA=+cx
\r
94 ' Pre WLH OS only (Server 2003/XP)
\r
95 ' Replace default InfiniHost HCA driver with ConnectX HCA driver if
\r
96 ' requested 'HCA=cx' or add ConnectX '+cx'.
\r
98 If VersionNT < WindowsLongHorn Then
\r
99 use_this_HCA = Session.Property("HCA")
\r
100 If use_this_HCA <> "" Then
\r
101 ' down-case if required.
\r
102 If Instr(use_this_HCA,"CX") <> 0 Then
\r
103 use_this_HCA = Replace(use_this_HCA,"CX","cx")
\r
105 If Instr(use_this_HCA,"+cx") <> 0 Then
\r
106 ' Add ConnectX HCA drivers
\r
107 AddLocal = AddLocal & ",hca_connectX"
\r
109 If Instr(use_this_HCA,"cx") <> 0 Then
\r
110 If Instr(AddLocal,"hca_mthca") <> 0 Then
\r
111 AddLocal = Replace(AddLocal,"hca_mthca","hca_connectX")
\r
113 AddLocal = AddLocal & ",hca_connectX"
\r
120 If Session.Property("OSM") = "1" OR Session.Property("OSMS") = "1" Then
\r
121 AddLocal = AddLocal & ",fOSMS"
\r
124 If Session.Property("SRP") = "1" Then
\r
125 AddLocal = AddLocal & ",fSRP"
\r
128 If Session.Property("VNIC") = "1" Then
\r
129 AddLocal = AddLocal & ",fVNIC"
\r
132 ' Driver Install Properties:
\r
133 ' 0-INSTALLDIR; 1-SystemFolder; 2-System64Folder; 3-WindowsFolder ;
\r
134 ' 4-VersionNT; 5-ADDLOCAL; 6-REMOVE; 7-NODRV; 8-DBG
\r
136 Session.Property("DriverInstall") = _
\r
137 Session.Property("INSTALLDIR") & ";" & _
\r
138 Session.Property("SystemFolder") & ";" & _
\r
139 Session.Property("System64Folder") & ";" & _
\r
140 Session.Property("WindowsFolder") & ";" & _
\r
141 VersionNT & ";" & _
\r
143 Session.Property("REMOVE") & ";" & _
\r
144 Session.Property("NODRV") & ";" & _
\r
145 Session.Property("DBG")
\r
150 'Waiting to delete a file until it's free
\r
152 Function FileDeleteUntilFree(filename)
\r
153 Set objFSO=CreateObject("Scripting.FileSystemObject")
\r
154 Set WshShell = CreateObject("WScript.Shell")
\r
157 Do While objFSO.FileExists(filename)
\r
158 On Error Resume Next
\r
159 objFSO.DeleteFile(filename)
\r
160 WScript.Sleep 100 ' milliseconds
\r
161 ' Do not wait to long to delete the file, bail and don't delete it if too
\r
163 too_much = too_much + 1
\r
164 if too_much > 50 then
\r
165 msgbox "delete Timeout(5) " & filename
\r
172 Sub FileDelete(filename)
\r
174 Set fso = CreateObject("Scripting.FileSystemObject")
\r
176 If fso.FileExists(filename) Then
\r
177 On Error Resume Next
\r
178 fso.DeleteFile(filename),True
\r
179 If (Err And Err.Number <> 70) Then ' tolerate protection errors
\r
180 ErrMsg ("Could not delete: " & filename)
\r
186 Sub FileDeleteQ(fso,filename)
\r
188 If fso.FileExists(filename) Then
\r
189 On Error Resume Next
\r
190 fso.DeleteFile(filename),True
\r
191 If (Err And Err.Number <> 70) Then ' tolerate protection errors
\r
192 ErrMsg ("Could not delete: " & filename)
\r
198 ' Move and then Delete a file. File is moved into %TEMP%\basename(filename)
\r
199 ' then deleted; pesky files in 'system32\drivers'.
\r
201 Function FileMove(filename,destination)
\r
203 Set fso = CreateObject("Scripting.FileSystemObject")
\r
204 On Error Resume Next
\r
205 If fso.FileExists(filename) Then
\r
206 fso.MoveFile filename,destination
\r
207 If (Err And Err.Number <> 70) then ' tolerate protection errors.
\r
208 ErrMsg ("Could not move: " & filename & " to " & destination)
\r
211 If Err Then ShowError
\r
215 Sub DriverFileDelete(fso,WshShell,filename,VersionNT)
\r
217 If fso.FileExists(filename) Then
\r
218 ' allow continuation after 'permission denied' error
\r
219 On Error Resume Next
\r
220 ' unlock the driver file by deleting PnPLocked reg entry.
\r
221 If VersionNT >= WindowsLongHorn Then
\r
222 base = "reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /v "
\r
223 Return = WshShell.Run (base & filename & " /f", 0, true)
\r
225 fso.DeleteFile(filename),True
\r
226 If (Err And Err.Number <> 70) Then ' tolerate protection errors
\r
227 ErrMsg ("Could not delete: " & filename)
\r
234 ' Remove the specified folder and all sub-folders & files.
\r
235 ' What rmdir does from the cmd line but will not do from vbs?
\r
237 Sub RemoveFolder(objStartFolder)
\r
239 Set objFSO = CreateObject("Scripting.FileSystemObject")
\r
241 If Not objFSO.FolderExists(objStartFolder) Then
\r
245 Set objFolder = objFSO.GetFolder(objStartFolder)
\r
246 'Wscript.Echo objFolder.Path
\r
247 Set colFiles = objFolder.Files
\r
249 ' del files in top-level folder
\r
250 For Each objFile in colFiles
\r
251 objFSO.DeleteFile(objFolder.Path & "\" & objFile.Name)
\r
253 ErrMsg("Del err on " & objFolder.Path & "\" & objFile.Name)
\r
257 ShowSubfolders objFSO.GetFolder(objStartFolder), objFSO
\r
259 On Error Resume Next
\r
260 objFSO.DeleteFolder(objStartFolder)
\r
262 ErrMsg("DelFolder err on " & objStartFolder)
\r
268 Sub ShowSubFolders(Folder,FSO)
\r
269 On Error Resume Next
\r
270 For Each Subfolder in Folder.SubFolders
\r
271 ' Wscript.Echo Subfolder.Path
\r
272 Set objFolder = FSO.GetFolder(Subfolder.Path)
\r
273 Set colFiles = objFolder.Files
\r
274 For Each objFile in colFiles
\r
275 ' Wscript.Echo Subfolder.Path & "\" & objFile.Name
\r
276 FSO.DeleteFile(Subfolder.Path & "\" & objFile.Name)
\r
278 ErrMsg("DelFile err on " & Subfolder.Path & "\" & objFile.Name)
\r
282 ShowSubFolders Subfolder, FSO
\r
283 FSO.DeleteFolder(Subfolder.Path)
\r
285 ErrMsg("DelFolder err on " & Subfolder.Path)
\r
293 ''''''''''' Remove Driver Files ''''''''''''
\r
295 ' Attempt to clean out driver installed files which fail to be uninstalled
\r
296 ' when the driver is uninstalled. Win2K3/x64 files persist, XP & Win2K3/x86
\r
297 ' the driver files are correctly remove?
\r
299 Sub RemoveDriverFiles(fso,WshShell,VersionNT)
\r
301 Dim Win, sDRIVERS, sSYS32, sSYSWOW64
\r
302 Dim CheckMode, PropArray, sTemp
\r
304 ' Function can be called from the Driver{Install/Uninstall} rtns.
\r
306 Win = fso.GetSpecialFolder(0) & "\"
\r
308 ' this is screw-ball: on 64-bit systems: SystemFolder == %windir%\SysWOW64
\r
309 ' on 32-bit systems: SystemFolder == %windir%\system32
\r
311 sSYS32 = Win & "system32\"
\r
312 sSYSWOW64 = Win & "SysWOW64\"
\r
313 sDRIVERS = sSYS32 & "drivers\"
\r
315 DriverFileDelete fso,WshShell,sDRIVERS & "ibbus.sys",VersionNT
\r
316 DriverFileDelete fso,WshShell,sDRIVERS & "mthca.sys",VersionNT
\r
317 FileDeleteQ fso,sDRIVERS & "mthca.sy1"
\r
318 DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_bus.sys",VersionNT
\r
319 DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_hca.sys",VersionNT
\r
320 DriverFileDelete fso,WshShell,sDRIVERS & "winverbs.sys",VersionNT
\r
321 DriverFileDelete fso,WshShell,sDRIVERS & "winmad.sys",VersionNT
\r
322 DriverFileDelete fso,WshShell,sDRIVERS & "ipoib.sys",VersionNT
\r
323 DriverFileDelete fso,WshShell,sDRIVERS & "ibiou.sys",VersionNT
\r
324 DriverFileDelete fso,WshShell,sDRIVERS & "ibsrp.sys",VersionNT
\r
325 DriverFileDelete fso,WshShell,sDRIVERS & "vnic.sys",VersionNT
\r
326 DriverFileDelete fso,WshShell,sDRIVERS & "qlgcvnic.sys",VersionNT
\r
328 DriverFileDelete fso,WshShell,sSYS32 & "libibverbs.dll",VersionNT
\r
329 DriverFileDelete fso,WshShell,sSYS32 & "libibverbsd.dll",VersionNT
\r
330 DriverFileDelete fso,WshShell,sSYS32 & "winmad.dll",VersionNT
\r
331 DriverFileDelete fso,WshShell,sSYS32 & "winmadd.dll",VersionNT
\r
332 DriverFileDelete fso,WshShell,sSYS32 & "winverbs.dll",VersionNT
\r
333 DriverFileDelete fso,WshShell,sSYS32 & "winverbsd.dll",VersionNT
\r
334 DriverFileDelete fso,WshShell,sSYS32 & "ibal.dll",VersionNT
\r
335 DriverFileDelete fso,WshShell,sSYS32 & "ibald.dll",VersionNT
\r
336 DriverFileDelete fso,WshShell,sSYS32 & "ibal32.dll",VersionNT
\r
337 DriverFileDelete fso,WshShell,sSYS32 & "ibal32d.dll",VersionNT
\r
338 DriverFileDelete fso,WshShell,sSYS32 & "complib.dll",VersionNT
\r
339 DriverFileDelete fso,WshShell,sSYS32 & "complibd.dll",VersionNT
\r
340 DriverFileDelete fso,WshShell,sSYS32 & "cl32.dll",VersionNT
\r
341 DriverFileDelete fso,WshShell,sSYS32 & "cl32d.dll",VersionNT
\r
342 DriverFileDelete fso,WshShell,sSYS32 & "mthcau.dll",VersionNT
\r
343 DriverFileDelete fso,WshShell,sSYS32 & "mthcaud.dll",VersionNT
\r
344 DriverFileDelete fso,WshShell,sSYS32 & "mthca32.dll",VersionNT
\r
345 DriverFileDelete fso,WshShell,sSYS32 & "mthca32d.dll",VersionNT
\r
346 DriverFileDelete fso,WshShell,sSYS32 & "mlx4u.dll",VersionNT
\r
347 DriverFileDelete fso,WshShell,sSYS32 & "mlx4ud.dll",VersionNT
\r
348 DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32.dll",VersionNT
\r
349 DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32d.dll",VersionNT
\r
350 DriverFileDelete fso,WshShell,sSYS32 & "ibsrp.dll",VersionNT
\r
351 DriverFileDelete fso,WshShell,sSYS32 & "ibsrpd.dll",VersionNT
\r
352 DriverFileDelete fso,WshShell,sSYS32 & "IbInstaller.dll",VersionNT
\r
353 DriverFileDelete fso,WshShell,sSYS32 & "ibwsd.dll",VersionNT
\r
354 DriverFileDelete fso,WshShell,sSYS32 & "ibndprov.dll",VersionNT
\r
355 DriverFileDelete fso,WshShell,sSYS32 & "ibndprov32.dll",VersionNT
\r
356 DriverFileDelete fso,WshShell,sSYS32 & "ndinstall.exe",VersionNT
\r
358 If fso.FolderExists(sSYSWOW64) Then
\r
359 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibal.dll",VersionNT
\r
360 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibald.dll",VersionNT
\r
361 DriverFileDelete fso,WshShell,sSYSWOW64 & "complib.dll",VersionNT
\r
362 DriverFileDelete fso,WshShell,sSYSWOW64 & "complibd.dll",VersionNT
\r
363 DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcau.dll",VersionNT
\r
364 DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcaud.dll",VersionNT
\r
365 DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4u.dll",VersionNT
\r
366 DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4ud.dll",VersionNT
\r
367 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrp.dll",VersionNT
\r
368 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrpd.dll",VersionNT
\r
369 DriverFileDelete fso,WshShell,sSYSWOW64 & "IbInstaller.dll",VersionNT
\r
370 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibwsd.dll",VersionNT
\r
371 DriverFileDelete fso,WshShell,sSYSWOW64 & "ibndprov.dll",VersionNT
\r
374 If fso.FolderExists(Win & "lastgood" ) Then
\r
375 FileDeleteQ fso,Win & "lastgood\system32\ibwsd.dll"
\r
376 FileDeleteQ fso,Win & "lastgood\SysWOW64\ibwsd.dll"
\r
377 FileDeleteQ fso,Win & "lastgood\SysWOW64\mthcau.dll"
\r
378 FileDeleteQ fso,Win & "lastgood\SysWOW64\mthcaud.dll"
\r
379 FileDeleteQ fso,Win & "lastgood\system32\mthcau.dll"
\r
380 FileDeleteQ fso,Win & "lastgood\system32\mthcaud.dll"
\r
381 FileDeleteQ fso,Win & "lastgood\system32\drivers\mthcau.dll"
\r
382 FileDeleteQ fso,Win & "lastgood\system32\drivers\mthcaud.dll"
\r
383 FileDeleteQ fso,Win & "lastgood\system32\drivers\mthca.sys"
\r
384 FileDeleteQ fso,Win & "lastgood\system32\drivers\winverbs.sys"
\r
385 FileDeleteQ fso,Win & "lastgood\system32\drivers\winmad.sys"
\r
388 FileDeleteQ fso,Win & "winverbs.lib"
\r
389 FileDeleteQ fso,Win & "libibverbs.lib"
\r
391 ' delete opensm files
\r
392 sTemp = fso.GetSpecialFolder(0) & "\temp\"
\r
393 ' remove files from %SystemRoot%\temp
\r
394 FileDeleteQ fso,sTemp & "guid2lid"
\r
395 FileDeleteQ fso,sTemp & "opensm-sa.dump"
\r
396 FileDeleteQ fso,sTemp & "osm.log"
\r
397 FileDeleteQ fso,sTemp & "osm-subnet.lst"
\r
402 ''''''''''' Delete registry key ''''''''''''
\r
404 Function DeleteRegKey(KeyPath)
\r
405 Const HKEY_LOCAL_MACHINE = &H80000002
\r
408 Set objReg=GetObject("winmgmts:" & _
\r
409 "{impersonationLevel=impersonate}!\\" & _
\r
410 strComputer & "\root\default:StdRegProv")
\r
412 ' Display error number and description if applicable
\r
413 ' If Err Then ShowError
\r
414 Return = objReg.DeleteKey(HKEY_LOCAL_MACHINE, KeyPath)
\r
419 ''''''''''' Delete registry value ''''''''''''
\r
421 Function DeleteRegValue(strKeyPath, strValueName)
\r
422 Const HKEY_LOCAL_MACHINE = &H80000002
\r
427 Set objReg=GetObject("winmgmts:" & _
\r
428 "{impersonationLevel=impersonate}!\\" & _
\r
429 strComputer & "\root\default:StdRegProv")
\r
432 Return = objReg.DeleteValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName)
\r
433 ' Display error number and description if applicable
\r
434 If Err Then ShowError
\r
435 ' If (Return = 0) And (Err.Number = 0) Then
\r
436 ' WScript.Echo value & "Registry value HKEY_LOCAL_MACHINE," & _
\r
437 ' strKeyPath & "," & strValueName & "," & dwValue & " deleted"
\r
439 ' WScript.Echo "Registry value not deleted" & VBNewLine & _
\r
440 ' "Error = " & Err.Number
\r
447 Function ReadSysPath
\r
449 Const HKEY_LOCAL_MACHINE = &H80000002
\r
450 Dim strComputer, strKeyPath, strValueName, strValue
\r
452 ReadSysPath = Null ' assume the worst.
\r
454 Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
\r
455 strComputer & "\root\default:StdRegProv")
\r
457 strKeyPath="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
\r
458 strValueName = "Path"
\r
459 oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,_
\r
460 strKeyPath, strValueName, strValue
\r
462 If (Err.Number = 0) And (Not IsNull(strValue)) Then
\r
463 ReadSysPath = strValue
\r
468 Function WriteSysPath(NewPath)
\r
470 Const HKEY_LOCAL_MACHINE = &H80000002
\r
471 Dim strComputer, strKeyPath, strValueName
\r
474 Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
\r
475 strComputer & "\root\default:StdRegProv")
\r
477 strKeyPath="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
\r
478 strValueName = "Path"
\r
479 oReg.SetExpandedStringValue _
\r
480 HKEY_LOCAL_MACHINE, strKeyPath, strValueName, NewPath
\r
482 WriteSysPath = Err.Number
\r
486 ''''''''''' Check installation status ''''''''''''
\r
488 Function install_verify()
\r
491 sInstalldir = Session.Property("INSTALLDIR")
\r
492 Set WshShell = CreateObject("WScript.Shell")
\r
493 Set vstat = WshShell.Exec(sInstalldir & "vstat.exe")
\r
494 install_verify = vstat.ExitCode
\r
497 '-------------------------------------------------------------
\r
500 Function CreateRegKey(KeyPath)
\r
501 Const HKEY_LOCAL_MACHINE = &H80000002
\r
504 Set objReg=GetObject("winmgmts:" & _
\r
505 "{impersonationLevel=impersonate}!\\" & _
\r
506 strComputer & "\root\default:StdRegProv")
\r
508 ' Display error number and description if applicable
\r
509 If Err Then ShowError
\r
510 Return = objReg.CreateKey(HKEY_LOCAL_MACHINE, KeyPath)
\r
516 '--------------------------------------------------------
\r
519 ' Function to add registry DWORD val.
\r
520 Function AddRegDWORDValue(strKeyPath, strValueName, dwValue)
\r
521 Const HKEY_LOCAL_MACHINE = &H80000002
\r
524 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
\r
525 strComputer & "\root\default:StdRegProv")
\r
526 If Err Then ShowError
\r
528 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
\r
530 If Err Then ShowError
\r
534 '-------------------------------------------------
\r
536 ' Function to add registry Expanded string val.
\r
538 Function AddRegExpandValue(strKeyPath, strValueName, dwValue)
\r
539 Const HKEY_LOCAL_MACHINE = &H80000002
\r
542 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
\r
543 strComputer & "\root\default:StdRegProv")
\r
545 If Err Then ShowError
\r
546 oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,_
\r
548 If Err Then ShowError
\r
552 '------------------------------------------------------------------------
\r
555 ' Function to add registry string val.
\r
557 Function AddRegStringValue(strKeyPath, strValueName, dwValue)
\r
558 Const HKEY_LOCAL_MACHINE = &H80000002
\r
561 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
\r
562 strComputer & "\root\default:StdRegProv")
\r
564 If Err Then ShowError
\r
565 oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
\r
566 If Err Then ShowError
\r
570 '------------------------------------------------------------------------
\r
572 ' Return a list of PCI devices using 'devcon find | findall'
\r
573 ' sFindHow - stringArg: devcon cmd arg {find | findall}
\r
575 Function Find_Dev_by_Tag(WshShell,exe,sFindHow,tag)
\r
578 cmd = exe & " " & sFindHow & " * | find """ & tag & """"
\r
579 Set connExec = WshShell.Exec(cmd)
\r
581 msgbox "Shell.Exec err: " & cmd
\r
582 Find_Dev_by_Tag = Null
\r
586 devs = split(connExec.StdOut.ReadAll, vbCrLF)
\r
588 On Error Resume Next
\r
590 ' verify we have some useful data.
\r
593 for each dev in devs
\r
594 If Instr(dev,Tag) <> 0 Then
\r
595 arrSize = arrSize + 1
\r
599 If arrSize = 0 Then
\r
600 Find_Dev_by_Tag = Null
\r
604 'Create new array of selected devices
\r
606 Redim ibaDev(arrSize - 1)
\r
608 For each dev in devs
\r
609 if (Instr(dev,Tag) <> 0) Then
\r
610 ibaDev(index) = dev
\r
615 Find_Dev_by_Tag = ibaDev
\r
620 Function IsInfiniHost(ID)
\r
622 HCAs = Array("5A44","5A45","5E8C","5E8D","6264","6274","6275","6278",_
\r
625 For each dID in HCAs
\r
628 'msgbox "match ID " & ID & " dID " & dID
\r
632 'msgbox "NO match ID " & ID
\r
638 ' Install Qlogic VNIC Driver using devman.exe (aka devcon)
\r
640 Sub devman_Install_VNIC(WshShell,sInstalldir)
\r
644 devmanQL = "cmd.exe /c cd /d " & sInstalldir & "qlgcvnic & " & _
\r
645 "..\IBcore\devman.exe "
\r
648 devID = "IBA\V00066AP00000030"
\r
649 rc = WshShell.Run (devmanQL & "disable " & devID, 0, true)
\r
650 rc = WshShell.Run (devmanQL & "update netvnic.inf " & devID,0,true)
\r
651 ' Display error number and description if applicable
\r
653 msgbox "Install_VNIC Err(" & rc & ") - devman update qlgcvnic.sys " _
\r
654 & devID,,"devman_install_VNIC"
\r
656 rc = WshShell.Run (devmanQL & "enable " & devID, 0, true)
\r
657 If sDBG >= "1" Then
\r
658 msgbox "VNIC Install OK",,"devman_Install_VNIC"
\r
665 Function dpinst_Install_VNIC(WshShell,sInstalldir)
\r
666 Dim dpinstSRP,cmd,rc
\r
668 dpinst_Install_VNIC = 0
\r
670 dpinstVNIC = "cmd.exe /c cd /d " & sInstalldir & _
\r
671 "qlgcvnic & ..\ibcore\dpinst.exe "
\r
673 cmd = dpinstVNIC & "/S /F /SA /PATH """ & sInstalldir & "qlgcvnic""" & _
\r
675 rc = WshShell.Run (cmd,0,true)
\r
676 If (rc AND DPINST_INSTALLED) = 0 Then
\r
677 dpinst_status "qlgcvnic Install failed",cmd,rc,"dpinst_Install_VNIC"
\r
678 dpinst_Install_VNIC = rc
\r
679 ElseIf sDBG >= "1" Then
\r
680 dpinst_status "qlgcvnic Install OK.",cmd,rc,"dpinst_Install_VNIC"
\r
686 ' Install SRP (SCSI RDMA Protocol) Driver
\r
688 ' QLogic Virtual FC I/O controller or
\r
689 ' InfiniBand SRP Miniport: IBA\C0100C609EP0108 or IBA\CFF00C609EP0108
\r
690 ' OFED SRP target: IBA\V000002P00005A44
\r
691 ' one driver handles all three. Definition also used for SRP uninstall.
\r
694 "IBA\V000002P00005A44",_
\r
695 "IBA\C0100C609EP0108",_
\r
696 "IBA\CFF00C609EP0108",_
\r
697 "IBA\V00066AP00000038",_
\r
698 "IBA\V000006P00006282")
\r
700 Function devman_Install_SRP(WshShell,sInstalldir)
\r
702 Dim Devices,devID,rc,found
\r
704 devmanSRP = "cmd.exe /c cd /d " & sInstalldir & "SRP & " & _
\r
705 "..\IBcore\devman.exe "
\r
709 On Error Resume Next
\r
711 Devices = Find_IBA_Devices(WshShell,sInstalldir)
\r
712 If IsNull(Devices) Then
\r
713 msgbox "missing SRP [IBA\*] devices?",,"devman_Install_SRP"
\r
714 devman_Install_SRP = -1
\r
718 For each ID in SRP_IDS
\r
719 For each devID in Devices
\r
720 If Instr(1,devID,ID) = 1 Then
\r
722 rc = WshShell.Run (devmanSRP & "update ib_srp.inf " & ID,0,true)
\r
723 ' Display error number and description if applicable
\r
725 msgbox "Install_SRP Err(" & rc _
\r
726 & ") devman update ib_srp.inf " & ID
\r
727 ElseIf sDBG >= "1" Then
\r
728 msgbox "SRP install OK.",,"devman_Install_SRP"
\r
733 ' One driver handles all SRP devices - install once?
\r
734 ' If found = 1 Then
\r
740 devman_Install_SRP = -1
\r
742 devman_Install_SRP = 0
\r
748 Function dpinst_Install_SRP(WshShell,sInstalldir)
\r
749 Dim dpinstSRP,cmd,rc
\r
751 dpinst_Install_SRP = 0
\r
752 dpinstSRP = "cmd.exe /c cd /d " & sInstalldir _
\r
753 & "SRP & ..\ibcore\dpinst.exe "
\r
754 cmd = dpinstSRP & "/S /F /SA /PATH """ & sInstalldir & "SRP""" & " /SE /SW"
\r
755 rc = WshShell.Run (cmd,0,true)
\r
756 If (rc AND DPINST_INSTALLED) = 0 Then
\r
757 dpinst_status "SRP Install failed",cmd,rc,"dpinst_Install_SRP"
\r
758 dpinst_Install_SRP = rc
\r
759 ElseIf sDBG >= "1" Then
\r
760 dpinst_status "SRP Install OK.",cmd,rc,"dpinst_Install_SRP"
\r
766 Sub devman_Install_IOU(WshShell,sInstalldir)
\r
770 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
772 On Error Resume Next
\r
774 dev_list = Find_Dev_by_Tag(WshShell,devman,"find","InfiniBand I/O Unit")
\r
776 ' if no IB_IOU device found, install ibiou.sys driver
\r
777 If IsNull(dev_list) Then
\r
778 rc = WshShell.Run (devman & "update ib_iou.inf IBA\IB_IOU",0,true)
\r
780 msgbox "Install_IOU Err(" & rc & ")" & _
\r
781 "devman update ib_iou.inf IBA\IB_IOU"
\r
784 ' msgbox "IOU driver already loaded [" & dev_list(0) & "]"
\r
790 ' For installer error codes see
\r
791 ' http://msdn2.microsoft.com/en-us/library/aa368542(VS.85).aspx
\r
793 Const ERROR_INSTALL_SOURCE_ABSENT = 1612 ' missing files to install,
\r
794 ' invalid feature selection.
\r
795 Const ERROR_INSTALL_FAILURE = 1603 ' fatal error during installation
\r
796 Const ERROR_FUNCTION_FAILED = 1627 ' function failed during execution
\r
797 Const ERROR_SUCCESS_REBOOT_REQUIRED = 3010 ' restart required
\r
799 ' For the dpinst.exe error discussion see
\r
800 ' http://msdn.microsoft.com/en-us/library/ms791066.aspx
\r
802 ' The dpinst.exe return code is a DWORD (0xWWXXYYZZ), where the meaning of
\r
803 ' the four single-byte fields 0xWW, 0xXX, 0xYY, and 0xZZ are defined as follows
\r
805 ' 0xWW If a driver package could not be installed, the 0x80 bit is set. If a
\r
806 ' computer restart is necessary, the 0x40 bit is set. Otherwise, no bits
\r
808 ' 0xXX The number of driver packages that could not be installed.
\r
809 ' 0xYY The number of driver packages that were copied to the driver store but
\r
810 ' were not installed on a device.
\r
811 ' 0xZZ The number of driver packages that were installed on a device.
\r
813 Const DPINST_INSTALLED = &H000000FF
\r
815 Sub dpinst_status(umsg,cmd,err,title)
\r
819 msg = umsg & " (status 0x" & Hex(err) & ") " & vbCrLf & vbCrLf & _
\r
821 " See %windir%\dpinst.log for details" & vbCrLf & vbCrLf
\r
823 S(I) = (err AND 255)
\r
826 msg = msg & "Status Decode:" & vbCrLf
\r
827 msg = msg & S(0) & " driver packages installed on a device" & vbcrlf & _
\r
828 S(1) & " driver packages copied to the driver store and not installed on a device" & vbcrlf & _
\r
829 S(2) & " driver packages not installed on a device" & vbcrlf
\r
830 if S(3) = &H80 then
\r
831 msg = msg & "[0x" & Hex(S(3)) & "] A driver package could not be installed." & vbcrlf
\r
833 if S(3) = &H40 then
\r
834 msg = msg & "[0x" & Hex(S(3)) & "] 0x40 reboot required." & vbcrlf
\r
842 Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP)
\r
844 Dim dpinst,dpinstNET,cmd,rc
\r
847 On Error Resume Next
\r
849 cmdspec = "cmd.exe /c cd /d " & sInstalldir
\r
850 dpinst = cmdspec & "IBcore & dpinst.exe "
\r
851 dpinstNET = cmdspec & "net & ..\ibcore\dpinst.exe "
\r
853 cmd = dpinst & "/S /F /SA /SE /SW"
\r
855 ' HCA driver install - mlx4 or mthca, dpinst does all .inf files in
\r
856 ' the current folder.
\r
858 rc = WshShell.Run (cmd,0,true)
\r
860 If (rc AND DPINST_INSTALLED) = 0 Then
\r
861 dpinst_status "HCA driver Install failed",cmd,rc,"dpinst_install"
\r
862 dpinst_install=ERROR_INSTALL_FAILURE
\r
864 ElseIf sDBG >= "1" Then
\r
865 dpinst_status "IB Core Drivers [HCA] Install OK.",cmd,rc,_
\r
869 ' Check/install IPoIB driver
\r
871 cmd = dpinstNET & "/S /F /SA /PATH """ & sInstalldir & "net""" & _
\r
873 rc = WshShell.Run (cmd,0,true)
\r
874 If (rc AND DPINST_INSTALLED) = 0 Then
\r
875 dpinst_status "IPoIB Install failed",cmd,rc,"dpinst_install"
\r
876 dpinst_install=ERROR_INSTALL_FAILURE
\r
879 ElseIf sDBG >= "1" Then
\r
880 dpinst_status "IPoIB Install OK.",cmd,rc,"dpinst_install"
\r
884 ' Start the Local OpenSM Subnet Manager service?
\r
886 OpenSM_StartMeUp WshShell,sInstalldir
\r
887 If sDBG >= "1" Then
\r
888 msgbox "Local Subnet Management Service [OpenSM] started.",,_
\r
893 ' IOU driver is installed (loaded into driver store) by default as the
\r
894 ' driver (ibiou.sys) is located in IBcore; side-effect of dpinst.exe.
\r
897 rc = dpinst_Install_VNIC(WshShell,sInstalldir)
\r
901 rc = dpinst_Install_SRP(WshShell,sInstalldir)
\r
909 Function devman_install(WshShell,sInstalldir,have_mthca,have_mlx4,localSM,IPOIB,VNIC,SRP)
\r
911 Dim devman,cmd,Return,rc
\r
913 ' an HCA driver is 'required' for devman/devcon installs.
\r
914 If have_mlx4 = 0 AND have_mthca = 0 Then
\r
915 msgbox "devman_install - No HCA Driver Selected to Install?" & _
\r
916 " Aborting Installation."
\r
917 ' Force installer cleanup (real magic).
\r
918 devman_install=ERROR_INSTALL_SOURCE_ABSENT
\r
922 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
924 dev_list = Find_Dev_by_Tag(WshShell,devman,"find","VEN_15B3")
\r
926 If IsNull(dev_list) Then
\r
927 msgbox "HCA driver install - No HCA devices to install?"
\r
928 devman_install=ERROR_INSTALL_FAILURE
\r
932 ' Install ConnectX (mlx4) HCA driver?
\r
936 ' install ConnectX/mlx4 bus driver
\r
938 For each Dev in dev_list
\r
940 mlxdev = Left(Dev,(Instr(dev,"SUBSYS")-2))
\r
941 devID = Right(mlxdev,4)
\r
942 If IsInfiniHost( devID ) = 0 Then
\r
943 ' Mixed HCA types? if not, then Vendor_ID install
\r
944 If have_mthca = 0 Then
\r
945 mlxdev = "PCI\VEN_15B3"
\r
947 cmd = devman & "update mlx4_bus.inf """ & mlxdev & """"
\r
948 Return = WshShell.Run (cmd,0,true)
\r
950 DrvInstalled = true
\r
953 ' one time install attempt if not mixed HCA types present.
\r
954 ' Otherwise, continue with next mlx4 DEV_ID
\r
955 If have_mthca = 0 Then
\r
962 If DrvInstalled <> true Then
\r
963 msgbox "mlx4_bus Install failed(" & Return & ") " & cmd
\r
964 devman_install=ERROR_INSTALL_FAILURE
\r
968 ' Install ConnectX HCA
\r
969 cmd = devman & "update mlx4_hca.inf MLX4\CONNECTX_HCA"
\r
970 Return = WshShell.Run (cmd,0,true)
\r
972 ' Display error number and description if applicable
\r
973 If Return <> 0 Then
\r
974 msgbox "mlx4_hca Install Err(" & Return & ") " & cmd
\r
975 devman_install=ERROR_INSTALL_FAILURE
\r
980 ' InfiniHost (mthca) HCA driver?
\r
983 DrvInstalled = false
\r
986 For each dev in dev_list
\r
988 idev = Left(dev,(Instr(dev,"SUBSYS")-2))
\r
989 devID = Right(idev,4)
\r
990 If IsInfiniHost( devID ) = 1 Then
\r
991 ' Mixed HCA types? if not, then Vendor_ID install
\r
992 If have_mlx4 = 0 Then
\r
993 idev = "PCI\VEN_15B3"
\r
995 cmd = devman & "update mthca.inf """ & idev & """"
\r
996 Return = WshShell.Run (cmd,0,true)
\r
998 DrvInstalled = true
\r
1001 ' one time install attempt if no mlx4 present
\r
1002 ' otherwise, continue with next DEV_ID
\r
1003 If have_mlx4 = 0 Then
\r
1010 If DrvInstalled <> true Then
\r
1011 msgbox "InfiniHost(mthca) Install Err(" & Return & ") " & cmd
\r
1012 devman_install=ERROR_INSTALL_FAILURE
\r
1017 ' an HCA driver is 'required'.
\r
1019 If DrvInstalled = false Then
\r
1020 msgbox "No HCA Driver Selected to Install? Aborting Installation.",,_
\r
1022 ' Force installer cleanup (real magic).
\r
1023 devman_install=ERROR_INSTALL_SOURCE_ABSENT
\r
1025 ElseIf sDBG >= "1" Then
\r
1026 msgbox "IB Core Drivers [HCA] installed OK.",,"devman_install"
\r
1029 ' Start a Local OpenSM Subnet Manager service?
\r
1031 OpenSM_StartMeUp WshShell,sInstalldir
\r
1032 If sDBG >= "1" Then
\r
1033 msgbox "Local Subnet Management Service [OpenSM] started.",,_
\r
1038 ' Check/install IPoIB driver
\r
1040 devmanNET = "cmd.exe /c cd /d " & sInstalldir & _
\r
1041 "net & ..\IBcore\devman.exe "
\r
1042 cmd = devmanNET & "update netipoib.inf IBA\IPoIB"
\r
1043 rc = WshShell.Run (cmd,0,true)
\r
1045 msgbox "IPoIB Install Err(" & rc & ") " & cmd
\r
1046 devman_install=ERROR_INSTALL_FAILURE
\r
1048 ElseIf sDBG >= "1" Then
\r
1049 msgbox "IPoIB Install OK.",,"devman_install"
\r
1053 ' IB I/O Unit driver installed only if required by VNIC or SRP.
\r
1055 If VNIC OR SRP Then
\r
1056 rc = WshShell.Run (devman & "update ib_iou.inf IBA\IB_IOU",0,true)
\r
1058 msgbox "IOU Install Err(" & rc & ") update ib_iou.inf IBA\IB_IOU"
\r
1059 devman_install=ERROR_INSTALL_FAILURE
\r
1061 ElseIf sDBG >= "1" Then
\r
1062 msgbox "IOU driver Install OK.",,"devman_install"
\r
1066 ' Install Qlogic VNIC Driver?
\r
1068 devman_Install_VNIC WshShell,sInstalldir
\r
1071 ' Install SRP (SCSI RDMA Protocol) Driver?
\r
1074 rc = devman_Install_SRP(WshShell,sInstalldir)
\r
1078 WshShell.popup "Waiting 10 seconds for SRP device(s) to appear",10,_
\r
1079 "WinOF - SRP Install"
\r
1082 msgbox "WinOF: Missing SRP device?" & vbCrLf _
\r
1083 & "cd /d " & sInstalldir & "SRP" & vbCrLf _
\r
1084 & "..\IBcore\devman find IBA\*" & vbCrLf _
\r
1085 & "..\IBcore\devman update ib_srp.inf found-SRP-DevID" & vbCrLf
\r
1089 devman_install = 0
\r
1095 ''''''''''' Device Driver Install ''''''''''''
\r
1097 Function DriverInstall()
\r
1099 Dim devman, devmanEXE
\r
1100 Dim rc, cmd, CheckMode, sInstalldir, fso
\r
1101 Dim DrvInstalled, idev, mlxdev, dev, dev_list
\r
1102 Dim VersionNT,IPOIB,SRP,VNIC,localSM
\r
1104 On Error Resume Next
\r
1106 ' Get the value of INSTALLDIR - see WinOF_Setup
\r
1107 CheckMode = Session.Property("CustomActionData")
\r
1109 If Not CheckMode = "" Then
\r
1110 'in defered action this is the way to pass arguments.
\r
1111 PropArray = Split(Session.Property("CustomActionData"), ";")
\r
1113 Redim PropArray(9)
\r
1114 PropArray(0) = Session.Property("INSTALLDIR")
\r
1115 PropArray(1) = Session.Property("SystemFolder")
\r
1116 PropArray(2) = Session.Property("System64Folder")
\r
1117 PropArray(3) = Session.Property("WindowsFolder")
\r
1118 PropArray(4) = Session.Property("VersionNT")
\r
1119 PropArray(5) = Session.Property("ADDLOCAL")
\r
1120 PropArray(6) = Session.Property("REMOVE")
\r
1121 PropArray(7) = Session.Property("NODRV")
\r
1122 PropArray(8) = Session.Property("DBG")
\r
1125 ' If cmd-line specified NODRV=1, then do not install drivers.
\r
1126 ' Should not get here with NODRV=1 as WIX src files check.
\r
1129 If PropArray(7) <> "" Then
\r
1133 sInstalldir = PropArray(0)
\r
1134 VersionNT = PropArray(4)
\r
1135 InstallThis = PropArray(5)
\r
1136 sDBG = PropArray(8) ' set global debug flag.
\r
1138 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1140 Set WshShell = CreateObject("WScript.Shell")
\r
1141 Set fso = CreateObject("Scripting.FileSystemObject")
\r
1143 If Not fso.FileExists(sInstalldir & "IBcore\devman.exe") Then
\r
1144 msgbox "DriverInstall: missing " & sInstalldir & "IBcore\devman.exe"
\r
1145 DriverInstall=ERROR_FUNCTION_FAILED
\r
1149 If Not fso.FileExists(sInstalldir & "IBcore\dpinst.exe") Then
\r
1150 msgbox "DriverInstall: missing " & sInstalldir & "IBcore\dpinst.exe"
\r
1151 DriverInstall=ERROR_FUNCTION_FAILED
\r
1157 ' rescan system buses
\r
1158 Return = WshShell.Run (devman & "rescan", 0, true)
\r
1160 ' Install HCA (Host Channel Adapter) Driver(s)
\r
1161 DrvInstalled = false
\r
1163 ' Which HCAs are selected to install?
\r
1164 ' Both InfiniHost(mthca) and ConnectX(mlx4) have the same
\r
1165 ' Vendor ID VEN_15B3, so a generic by 'Vendor ID' install will not suceed.
\r
1166 ' In the case of both InfiniHost and ConnectX (mixed) HCAs present, install
\r
1167 ' using VENDOR_ID and DEV_ID.
\r
1172 ' msgbox "InstallThis " & InstallThis
\r
1174 have_mlx4 = instr(InstallThis,"hca_connectX")
\r
1175 have_mthca = instr(InstallThis,"hca_mthca")
\r
1176 IPOIB = instr(InstallThis,"fIPoIB")
\r
1177 localSM = instr(InstallThis,"fOSMS")
\r
1179 SRP = instr(InstallThis,"fSRP") _
\r
1180 AND fso.FileExists(sInstalldir & "SRP\ib_srp.inf")
\r
1182 VNIC = instr(InstallThis,"fVNIC") _
\r
1183 AND fso.FileExists(sInstalldir & "qlgcvnic\netvnic.inf")
\r
1185 ' Flag Windows LongHorn Install (aka Vista | Server 2008)
\r
1187 ' Use DPINST.EXE for Svr 2008 & Vista Driver Install (Windows LongHorn)
\r
1188 ' otherwise use devman.
\r
1190 If VersionNT >= WindowsLongHorn Then
\r
1191 DriverInstall = dpinst_install(WshShell,sInstalldir,localSM,IPOIB,_
\r
1194 DriverInstall = devman_install(WshShell,sInstalldir,have_mthca,_
\r
1195 have_mlx4,localSM,IPOIB,VNIC,SRP)
\r
1198 If DriverInstall <> 0 Then
\r
1199 find_remove_INF_file WshShell,devman,"ib_iou.cat"
\r
1200 find_remove_INF_file WshShell,devman,"ipoib.cat"
\r
1201 find_remove_INF_file WshShell,devman,"mthca.cat"
\r
1202 find_remove_INF_file WshShell,devman,"mlx4"
\r
1209 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
\r
1211 ' Find IBA devices using Devcon
\r
1213 Function Find_IBA_Devices(WshShell,sInstalldir)
\r
1216 Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe findall * | FIND ""IBA""")
\r
1218 ' Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd " & sInstalldir & "IBcore & devman.exe find IBA\*")
\r
1220 ibaDevices = split(ibaDevicesExec.StdOut.ReadAll, vbCrLF)
\r
1222 ' Determine the actual array Size - dump nonessential lines from cmd output.
\r
1225 For each dev in ibaDevices
\r
1226 if (Instr(dev,"IBA\") = 1) Then
\r
1227 arrSize = arrSize + 1
\r
1231 If arrSize = 0 Then
\r
1232 Find_IBA_Devices = Null
\r
1236 'Creating array of IBA\ devices
\r
1238 Redim ibaDev(arrSize - 1)
\r
1240 For each dev in ibaDevices
\r
1241 if (Instr(dev,"IBA\") = 1) Then
\r
1242 ibaDev(index) = dev
\r
1247 Find_IBA_Devices=ibaDev
\r
1252 ' returns an array of all Local Area Connections which
\r
1253 ' were created for IPoIB.
\r
1255 Function Find_IPOIB_LAC()
\r
1256 Dim WinOS,cmd,base,dev
\r
1258 Set WshShell = CreateObject("WScript.Shell")
\r
1259 base = "cmd.exe /c reg query HKLM\SYSTEM\CurrentControlSet\Control\Network"
\r
1260 WinOS = Session.Property("VersionNT")
\r
1262 If (WinOS <> WindowsXP) Then
\r
1264 cmd = base & " /f ""IBA\IPOIB"" /s /d | FIND ""Connection"" "
\r
1267 cmd = base & " /s | FIND ""}\Connection"" "
\r
1270 Set ibaDevicesExec = WshShell.Exec ("cmd.exe /C " & cmd)
\r
1272 ibaDevices = split(ibaDevicesExec.StdOut.ReadAll, vbCrLF)
\r
1274 ' determine the array Size
\r
1277 for each dev in ibaDevices
\r
1278 arrSize = arrSize + 1
\r
1280 'Creating array of Local Area Connections based on IPoIB
\r
1282 Redim ibaDev(arrSize - 1)
\r
1285 For each dev in ibaDevices
\r
1287 ElseIf WinOS <> WindowsXP then
\r
1288 ' ibaDev(index) = dev
\r
1289 delstr = Left(dev,Len(dev)-Len("\Connection"))
\r
1290 ibaDev(index) = delstr
\r
1293 ' XP reg.exe format sucks, unable to filter IBA\IPOIB, so we do
\r
1294 ' it here....sigh.
\r
1295 Set rex = WshShell.Exec ("cmd.exe /C reg.exe query " & dev & _
\r
1296 " /v PnpInstanceID | FIND ""IBA\IPOIB"" ")
\r
1297 resp = split(rex.StdOut.ReadAll, vbCrLF)
\r
1298 For each re in resp
\r
1299 ' msgbox "XP dev " & dev
\r
1300 ' msgbox "XP re " & re
\r
1301 if Instr(re,"IPOIB") Then
\r
1302 delstr = Left(dev,Len(dev)-Len("\Connection"))
\r
1303 ibaDev(index) = delstr
\r
1310 Find_IPOIB_LAC=ibaDev
\r
1315 ' Remove 3rd party (OEM) driver package; files are identified by containing
\r
1316 ' the string LookFor.
\r
1318 Sub find_remove_INF_file(WshShell,exe,LookFor)
\r
1320 Dim cmd,cmdDM,use_dpinst,pfile,found
\r
1322 ' using dpinst.exe[WLH] or devman.exe[wnet/xp]?
\r
1323 use_dpinst = Instr(exe,"dpinst")
\r
1325 cmd = "cmd.exe /c for /f %i in ('findstr /m /c:""" & LookFor _
\r
1326 & """ %WINDIR%\inf\oem*.inf') do @echo %i"
\r
1328 Set infFilesExec = WshShell.Exec ( cmd )
\r
1330 InfFiles = infFilesExec.StdOut.ReadAll
\r
1331 IFILES = Split(InfFiles,vbCrLf)
\r
1333 On Error Resume Next
\r
1334 For Each file in IFILES
\r
1335 If (file <> "") Then
\r
1336 ' most common is devman.exe
\r
1337 cmd = exe & " -f dp_delete " & file
\r
1338 if use_dpinst then
\r
1339 cmdDM = replace(cmd,"dpinst","devman")
\r
1340 cmd = exe & " /U """ & file & """ /S /D"
\r
1342 If sDBG >= "1" Then
\r
1343 msgbox "Found '" & LookFor & _
\r
1344 "' in file" & vbCrLf & " " & file & vbCrLf & _
\r
1345 " " & cmd,,"find_remove_INF_file"
\r
1348 Return = WshShell.Run (cmd, 0, true)
\r
1349 if use_dpinst then
\r
1350 ' use devman.exe to delete all .inf referenced files
\r
1351 Return = WshShell.Run (cmdDM, 0, true)
\r
1353 ' make sure the .inf & .pnf files are removed.
\r
1354 pfile = replace(file,".inf",".pnf")
\r
1360 If sDBG > "1" AND found = 0 Then
\r
1361 msgbox "Did not find " & LookFor,,"find_remove_INF_file"
\r
1367 Sub remove_INF_file(WshShell,exe,file)
\r
1369 Dim cmd,cmdDM,use_dpinst,pfile
\r
1371 ' using dpinst.exe[WLH] or devman.exe[wnet/xp]?
\r
1372 use_dpinst = Instr(exe,"dpinst")
\r
1374 On Error Resume Next
\r
1376 ' most common is devman.exe
\r
1377 cmd = exe & " -f dp_delete " & file
\r
1378 If use_dpinst Then
\r
1379 cmdDM = replace(cmd,"dpinst","devman")
\r
1380 cmd = exe & " /U """ & file & """ /S /D"
\r
1383 If sDBG >= "1" Then
\r
1384 msgbox "Removing driver package " & file & vbCrLf & " " & cmd,,_
\r
1388 Return = WshShell.Run (cmd, 0, true)
\r
1389 if use_dpinst then
\r
1390 ' use devman.exe to delete all .inf referenced files
\r
1391 Return = WshShell.Run (cmdDM, 0, true)
\r
1394 ' make sure the .inf & .pnf files are removed.
\r
1395 pfile = replace(file,".inf",".pnf")
\r
1403 Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)
\r
1405 Dim i,Flist,udfCnt
\r
1407 If IsNull(devInfo) Then
\r
1408 msgbox "cleanup_driver_files <null> devInfo?"
\r
1412 If sDBG >= "1" Then
\r
1413 DisplayDevInfo devInfo,"WinOF Remove Driver Package"
\r
1418 ' Device Install Info
\r
1421 '(2) Fully qualified INF filename
\r
1422 '(3) count of files installed from .inf file.
\r
1423 '(4) thru (3) [fileCount] Fully qualified Installed driver filenames.
\r
1425 remove_INF_file WshShell,tool,devInfo(2)
\r
1427 For i=4 To DevInfo(3) + 3
\r
1428 ' skip the KMDF wdmcoinstaller*.dll file as we do not ref count here
\r
1429 ' and could break other installed KMDF drivers if removed.
\r
1430 If Instr(devinfo(i),"WdfCoInstaller") = 0 Then
\r
1431 DriverFileDelete fso,WshShell,devInfo(i),VersionNT
\r
1432 If sDBG >= "1" Then
\r
1433 If fso.FileExists(devInfo(i)) Then
\r
1434 Flist = Flist & " " & devInfo(i) & vbCrLf
\r
1435 udfCnt = udfCnt + 1
\r
1441 If sDBG >= "1" Then
\r
1442 msgbox devInfo(1) & vbCrLf & devInfo(2) & vbCrLf & _
\r
1443 "Remaining Driver Package Files " & udfCnt & vbCrLf & Flist,,_
\r
1444 "cleanup_driver_files"
\r
1450 ' Not used - run the specified command during next startup.
\r
1452 Function RunAtReboot(name,run_once_cmd)
\r
1454 key_name = "Software\Microsoft\Windows\CurrentVersion\RunOnce"
\r
1455 AddRegStringValue key_name,name,run_once_cmd
\r
1456 msgbox "RunAtReboot( " & name & " , " & run_once_cmd & " )"
\r
1461 Sub DisplayDevInfo(DevInfo,suffix)
\r
1465 If IsNull(DevInfo) Then
\r
1469 For i=4 To DevInfo(3) + 3
\r
1470 devs = devs & " " & DevInfo(i) & vbCRLF
\r
1473 msgbox "[DeviceID] " & DevInfo(0) & vbCRLF &_
\r
1474 "[DeviceName] " & DevInfo(1) & vbCRLF &_
\r
1475 "[INF filename] " & DevInfo(2) & vbCRLF &_
\r
1476 "[INF installed files] " & DevInfo(3) & vbCRLF &_
\r
1481 Function GetDeviceInstallInfo(WshShell,sInstalldir,Dev)
\r
1483 Dim devman,tmp,s,StrStart,StrEnd,FileCnt,INF
\r
1485 devman = "cmd.exe /c cd /d " & sInstalldir & _
\r
1486 "IBcore & devman.exe driverfiles ""@"
\r
1488 Set connExec = WshShell.Exec(devman & Dev & """")
\r
1489 cmdout = split(connExec.StdOut.ReadAll, vbCrLF)
\r
1490 If IsNull(cmdout) Then
\r
1491 GetDeviceInstallInfo = Null
\r
1495 StrStart = InStr(1,cmdout(2),"installed from ") + 15
\r
1496 If StrStart <= 15 Then
\r
1497 GetDeviceInstallInfo = Null
\r
1501 StrEnd = InStr(StrStart,cmdout(2),"[") - 1
\r
1502 INF = mid(cmdout(2),StrStart,StrEnd-StrStart)
\r
1504 StrStart = InStr(StrEnd,cmdout(2),"]. ") + 3
\r
1505 StrEnd = InStr(StrStart,cmdout(2)," file")
\r
1506 FileCnt = CInt(mid(cmdout(2),StrStart,StrEnd-StrStart))
\r
1510 '(2) Fully qualified INF filename
\r
1511 '(3) count of files installed from .inf file.
\r
1512 '(4) thru (3) [fileCount] Fully qualified Installed driver filenames.
\r
1515 Redim ibaDev(3+FileCnt)
\r
1516 ibaDev(0) = cmdout(0)
\r
1517 tmp = ltrim(cmdout(1))
\r
1518 s = Len(tmp) - (Instr(tmp,"Name: ") + 5)
\r
1519 ibaDev(1) = Right(tmp,s)
\r
1521 ibaDev(3) = FileCnt
\r
1523 ' (ibaDev(3) - 1) + 4 == ibaDev(3) + 3
\r
1524 For i=4 To FileCnt + 3
\r
1525 ibaDev(i) = ltrim(cmdout(i-1))
\r
1528 ' DisplayDevInfo ibaDev,"WinOF Device Info"
\r
1530 GetDeviceInstallInfo = ibaDev
\r
1536 ' remove IB I/O Unit driver
\r
1538 Sub Uninstall_IOU(fso,WshShell,devList,sInstalldir,VersionNT)
\r
1542 RemoveDevice fso,WshShell,sInstalldir,devList,"InfiniBand I/O Unit",VersionNT
\r
1544 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1546 If VersionNT >= WindowsLongHorn Then
\r
1547 ' use dpinst.exe instead of devman.exe for Windows LongHorn++
\r
1548 tool = replace(devman,"devman","dpinst")
\r
1553 ' dpinst can install and not load the driver (no srp/vnic)
\r
1554 find_remove_INF_file WshShell,tool,"ib_iou.cat"
\r
1560 ' Remove QLogic VNIC instances
\r
1562 Sub Uninstall_VNIC(fso,WshShell,devices,sInstalldir,VersionNT)
\r
1564 Dim devman,Return,device,dt,sDRIVERS,tool,devInfo
\r
1566 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1568 If IsNull(devices) Then
\r
1569 ' create a list of IBA\* devices via "devcon find"
\r
1570 devices = Find_IBA_Devices(WshShell,sInstalldir)
\r
1571 If IsNull(devices) Then
\r
1577 For each devTarget in devices
\r
1578 If (Instr(devTarget,"IBA\V00066AP00000030")) Then
\r
1579 device = split(devTarget, ":")
\r
1580 dt = rtrim(device(0))
\r
1581 If IsNull(devInfo) Then
\r
1582 devInfo = GetDeviceInstallInfo(WshShell,sInstalldir,dt)
\r
1584 ' disable instance - double quote complex device name for success.
\r
1585 Return = WshShell.Run (devman & "disable ""@" & dt & """", 0, true)
\r
1586 ' Removing the Qlogic Vnic I/O Unit
\r
1587 Return = WshShell.Run (devman & "remove ""@" & dt & """", 0, true)
\r
1591 If VersionNT >= WindowsLongHorn Then
\r
1592 ' use dpinst.exe instead of devman.exe for Windows LongHorn++
\r
1593 tool = replace(devman,"devman","dpinst")
\r
1598 If IsNull(devInfo) Then
\r
1599 find_remove_INF_file WshShell,tool,"netvnic.cat"
\r
1603 cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo
\r
1608 Sub Uninstall_SRP(fso,WshShell,devices,sInstalldir,VersionNT)
\r
1610 Dim devman,devmanRMAT,devmanDAAT,Return,device,sDRIVERS,tool,devInfo
\r
1612 ' QLogic Virtual FC I/O controller or
\r
1613 ' InfiniBand SRP Miniport: IBA\C0100C609EP0108 or IBA\CFF00C609EP0108
\r
1614 ' one driver handles all three.
\r
1615 ' See previous SRP_IDS definition @ Install_SRP.
\r
1617 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1618 devmanRMAT = devman & "remove @"
\r
1619 devmanDAAT = devman & "disable @"
\r
1622 If IsNull(devices) Then
\r
1623 ' create a list of IBA\* devices via "devcon find"
\r
1624 devices = Find_IBA_Devices(WshShell,sInstalldir)
\r
1625 If IsNull(devices) Then
\r
1630 ' Remove SRP devices
\r
1631 ' QLogic Virtual FC I/O controller instance?
\r
1632 ' Either: IBA\C0100C609EP0108 or IBA\CFF00C609EP0108
\r
1633 ' Linux SRP target: IBA\V000002P00005A44
\r
1634 For each ID in SRP_IDS
\r
1635 For each deviceCan in devices
\r
1636 If Instr(deviceCan,ID) <> 0 Then
\r
1637 device = split(deviceCan, ":")
\r
1638 dt = rtrim(device(0))
\r
1639 If IsNull(devInfo) Then
\r
1640 devInfo = GetDeviceInstallInfo(WshShell,sInstalldir,dt)
\r
1642 ' disable the instance
\r
1643 Return = WshShell.Run (devmanDAAT & dt, 0, true)
\r
1644 ' Removing SRP device
\r
1645 Return = WshShell.Run (devmanRMAT & dt, 0, true)
\r
1646 ' msgbox "Uninstall_SRP() " & devmanRMAT & dt & " rc " & Return
\r
1651 If VersionNT >= WindowsLongHorn Then
\r
1652 ' use dpinst.exe instead of devman.exe for Windows LongHorn++
\r
1653 tool = replace(devman,"devman","dpinst")
\r
1658 'No SRP device - check/clear to be safe.
\r
1659 If IsNull(devInfo) Then
\r
1660 find_remove_INF_file WshShell,tool,"ibsrp.cat"
\r
1664 cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo
\r
1669 Sub RemoveDevice(fso,WshShell,sInstalldir,devList,DeviceTag,VersionNT)
\r
1671 dim device,devman,devmanRMAT,devTarget,dt,Return,devInfo
\r
1673 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1674 devmanRMAT = devman & "remove ""@"
\r
1675 devmanDAAT = devman & "disable ""@"
\r
1678 If IsNull(devList) Then
\r
1679 devList = Find_Dev_by_Tag(WshShell,devman,"findall",DeviceTag)
\r
1680 If IsNull(devList) Then
\r
1681 If sDBG > "1" Then
\r
1682 msgbox "No device by tag '" & DeviceTag & "' ?",,"RemoveDevice"
\r
1688 For each devTarget in devList
\r
1689 If Instr(devTarget,DeviceTag) Then
\r
1690 device = split(devTarget, ":")
\r
1691 dt = rtrim(device(0))
\r
1692 If IsNull(devInfo) Then
\r
1693 devInfo = GetDeviceInstallInfo(WshShell,sInstalldir,dt)
\r
1695 Return = WshShell.Run (devmanDAAT & dt & """", 0, true)
\r
1696 Return = WshShell.Run (devmanRMAT & dt & """", 0, true)
\r
1700 ' Only if a device was found
\r
1701 If IsNull(devInfo) Then
\r
1705 If VersionNT >= WindowsLongHorn Then
\r
1706 ' use dpinst.exe instead of devman.exe for Windows LongHorn++
\r
1707 tool = replace(devman,"devman","dpinst")
\r
1712 cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo
\r
1718 Sub remove_all_HCA_devices(fso,WshShell,sInstalldir,VersionNT)
\r
1722 devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "
\r
1724 ' Old (CoInstaller version) ibbus GUID - just in case.
\r
1725 Return = WshShell.Run (devman & "remove {94F41CED-78EB-407C-B5DF-958040AF0FD8",0,true)
\r
1727 RemoveDevice fso,WshShell,sInstalldir,Null,"MLX4\CONNECTX_HCA",VersionNT
\r
1729 ' VEN_15B3 covers devices: mthca & mlx4_bus
\r
1730 RemoveDevice fso,WshShell,sInstalldir,Null,"PCI\VEN_15B3",VersionNT
\r
1732 If VersionNT >= WindowsLongHorn Then
\r
1733 ' use dpinst.exe instead of devman.exe for Windows LongHorn++
\r
1734 tool = "cmd.exe /c cd /d " & sInstalldir & "IBcore & dpinst.exe "
\r
1739 find_remove_INF_file WshShell,tool,"mthca"
\r
1740 find_remove_INF_file WshShell,tool,"mlx4_hca"
\r
1741 find_remove_INF_file WshShell,tool,"mlx4_bus"
\r
1743 ' catch-all cleanup.
\r
1744 find_remove_INF_file WshShell,devman,"Mellanox"
\r
1745 find_remove_INF_file WshShell,devman,"InfiniBand"
\r
1750 Sub Uninstall_IB_Devices(fso,WshShell,sInstalldir,VersionNT)
\r
1754 If (fso.FileExists(sInstalldir & "IBcore\dpinst.exe") = False) Then
\r
1755 Exit Sub ' no reason to continue without the tool.
\r
1758 If (fso.FileExists(sInstalldir & "IBcore\devman.exe") = False) Then
\r
1759 Exit Sub ' no reason to continue without the tool.
\r
1762 ' create a list of IBA\* devices via "devcon find"
\r
1764 devList = Find_IBA_Devices(WshShell,sInstalldir)
\r
1765 If Not IsNull(devices) Then
\r
1767 Uninstall_SRP fso,WshShell,devList,sInstalldir,VersionNT
\r
1769 Uninstall_VNIC fso,WshShell,devList,sInstalldir,VersionNT
\r
1771 ' remove I/O Unit driver
\r
1772 Uninstall_IOU fso,WshShell,devList,sInstalldir,VersionNT
\r
1774 ' remove IPoIB devices
\r
1775 RemoveDevice fso,WshShell,sInstalldir,devList,"IBA\IPOIB",VersionNT
\r
1779 ' stop the openSM service in case it was started.
\r
1780 Return = WshShell.Run ("cmd.exe /c sc.exe stop opensm", 0, true)
\r
1782 ' delete opensm service from registry
\r
1783 Return = WshShell.Run ("cmd.exe /c sc.exe delete opensm", 0, true)
\r
1785 remove_all_HCA_devices fso,WshShell,sInstalldir,VersionNT
\r
1791 ''''''''''' Driver Uninstall ''''''''''''
\r
1793 Sub DriverUninstall()
\r
1794 Dim sInstalldir, WshShell, fso, sVersionNT
\r
1796 sInstalldir = Session.Property("INSTALLDIR")
\r
1798 Set WshShell = CreateObject("WScript.Shell")
\r
1799 Set fso = CreateObject("Scripting.FileSystemObject")
\r
1801 ' WSD is not supported on XP and should NOT have been installed.
\r
1802 ' otherwise, remove the service: ND (Network Direct) then WinSock Direct.
\r
1804 sDBG = Session.Property("DBG")
\r
1805 sVersionNT = Session.Property("VersionNT")
\r
1807 sRemove = Session.Property("REMOVE")
\r
1808 If sRemove = "" Then
\r
1812 If fso.FileExists(sInstalldir & "net\ndinstall.exe") Then
\r
1813 Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _
\r
1814 "net & ndinstall.exe -r", 0, true)
\r
1817 If sVersionNT <> WindowsXP AND fso.FileExists(sInstalldir & "installsp.exe") Then
\r
1818 Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _
\r
1819 " & installsp.exe -r", 0, true)
\r
1822 Uninstall_IB_Devices fso,WshShell,sInstalldir,sVersionNT
\r
1824 ' Remove Service entries from the registry
\r
1826 DeleteRegKey "System\CurrentControlSet\Services\ibbus"
\r
1827 DeleteRegKey "System\CurrentControlSet\Services\mthca"
\r
1828 DeleteRegKey "System\CurrentControlSet\Services\mlx4_bus"
\r
1829 DeleteRegKey "System\CurrentControlSet\Services\mlx4_hca"
\r
1830 DeleteRegKey "System\CurrentControlSet\Services\ipoib"
\r
1831 DeleteRegKey "System\CurrentControlSet\Services\ibiou"
\r
1832 DeleteRegKey "System\CurrentControlSet\Services\ibsrp"
\r
1833 DeleteRegKey "System\CurrentControlSet\Services\qlgcvnic"
\r
1834 DeleteRegKey "System\CurrentControlSet\Services\winverbs"
\r
1837 DeleteRegValue "SYSTEM\CurrentControlSet\Control\CoDeviceInstallers" ,_
\r
1838 "{58517E00-D3CF-40c9-A679-CEE5752F4491}"
\r
1840 DeleteRegKey "SYSTEM\CurrentControlSet\Control\Class\{58517E00-D3CF-40C9-A679-CEE5752F4491}"
\r
1843 DeleteRegValue "SYSTEM\CurrentControlSet\Control\CoDeviceInstallers" ,_
\r
1844 "{31B0B28A-26FF-4dca-A6FA-E767C7DFBA20}"
\r
1846 DeleteRegKey "SYSTEM\CurrentControlSet\Control\Class\{31B0B28A-26FF-4dca-A6FA-E767C7DFBA20}"
\r
1848 DeleteRegKey "SYSTEM\CurrentControlSet\Control\Class\{714995B2-CD65-4a47-BCFE-95AC73A0D780}"
\r
1850 ' In livefish mode, the above does not always work - just in case.
\r
1851 ' remove reg entries for ConnectX, mthca, ibbus, mlx4 & ipoib
\r
1854 "Control\Class\{58517E00-D3CF-40C9-A679-CEE5752F4491}",_
\r
1855 "Control\Class\{31B0B28A-26FF-4dca-A6FA-E767C7DFBA20}",_
\r
1856 "Control\Class\{714995B2-CD65-4a47-BCFE-95AC73A0D780}",_
\r
1857 "Services\ibbus",_
\r
1858 "Services\mthca",_
\r
1859 "Services\mlx4_bus",_
\r
1860 "Services\mlx4_hca",_
\r
1861 "Services\ipoib",_
\r
1862 "Services\EventLog\System\ipoib",_
\r
1863 "Services\ibiou",_
\r
1864 "Services\qlgcvnic",_
\r
1865 "Services\ibsrp",_
\r
1866 "Services\winmad",_
\r
1867 "Services\winverbs" )
\r
1869 base = "reg.exe delete HKLM\SYSTEM\CurrentControlSet\"
\r
1871 ' in livefish mode the delete didn't suceed, delete it in another way
\r
1872 For each ID in nukem
\r
1874 Return = WshShell.Run (base & ID & " /f", 0, true)
\r
1878 ' Cleanup KMDF CoInstaller Driver entries.
\r
1879 Return = WshShell.Run (base & "Control\Wdf\Kmdf\kmdflibrary\versions\1\driverservices /v mlx4_bus /f", 0, true)
\r
1880 Return = WshShell.Run (base & "Control\Wdf\Kmdf\kmdflibrary\versions\1\driverservices /v winverbs /f", 0, true)
\r
1881 Return = WshShell.Run (base & "Control\Wdf\Kmdf\kmdflibrary\versions\1\driverservices /v winmad /f", 0, true)
\r
1884 ' Return = WshShell.Run ("reg.exe delete HKLM\Software\Microsoft\Windows\currentVersion\DIFx\DriverStore\WinVerbs_* /f", 0, true)
\r
1885 ' Return = WshShell.Run ("reg.exe delete HKLM\Software\Microsoft\Windows\currentVersion\DIFx\DriverStore\ipoib_* /f", 0, true)
\r
1888 ' Remove all Local Area Connection registry entries which were constructed
\r
1889 ' for IPoIB. Next WinOF install gets same IPoIB local area connection
\r
1893 IPOIB_LAC = Find_IPOIB_LAC
\r
1895 For each LAC in IPOIB_LAC
\r
1897 Return = WshShell.Run ("reg.exe delete " & LAC & " /f", 0, true)
\r
1898 If Err Then ShowErr
\r
1902 ' remove driver installed files
\r
1903 RemoveDriverFiles fso,WshShell,sVersionNT
\r
1905 Session.Property("REBOOT") = "FORCE"
\r
1910 ' Enable WSD if installsp.exe was installed (feature Winsock direct selected).
\r
1911 ' For Windows XP, this CustomAction should not be called as WSD is not
\r
1912 ' supported on XP.
\r
1915 Dim sInstalldir, WshShell, fso
\r
1917 sInstalldir = Session.Property("INSTALLDIR")
\r
1919 Set WshShell = CreateObject("WScript.Shell")
\r
1920 Set fso = CreateObject("Scripting.FileSystemObject")
\r
1922 If fso.FileExists(sInstalldir & "installsp.exe") Then
\r
1923 ' install the WinSockdirect service
\r
1924 Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir _
\r
1925 & " & installsp.exe -i", 0, true)
\r
1927 If Err Then ShowError
\r
1932 ' This sub will only be called if the feature ND start was selected.
\r
1933 ' See WIX src file - ND_start
\r
1935 Sub ND_StartMeUp()
\r
1936 Dim sInstalldir, WshShell, fso
\r
1938 sInstalldir = Session.Property("INSTALLDIR")
\r
1940 Set WshShell = CreateObject("WScript.Shell")
\r
1941 Set fso = CreateObject("Scripting.FileSystemObject")
\r
1943 ' Start the Network Direct Service if installed
\r
1945 If fso.FileExists(sInstalldir & "net\ndinstall.exe") Then
\r
1946 Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir _
\r
1947 & " & net\ndinstall.exe -i", 0, true)
\r
1948 If Err Then ShowErr2("ND service install failed")
\r
1955 If Err.Number = 0 Then
\r
1958 strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _
\r
1959 Err.Description & vbCrLf & vbCrLf
\r
1965 If Err.Number <> 0 Then
\r
1966 msgbox msg & vbCrLf & "Err # " & Err.Number & vbCrLf & Err.Description
\r
1971 Function ShowErr2(msg)
\r
1972 If Err.Number <> 0 Then
\r
1973 strMsg = vbCrLf & "Err # " & Err.Number & vbCrLf & _
\r
1974 Err.Description & vbCrLf
\r
1975 msgbox msg & strMsg
\r
1977 ShowErr2=Err.Number
\r
1981 ' Convert the disabled OpenSM Windows service to an 'auto' startup on next boot.
\r
1982 ' OpenSM service was created by WIX installer directives - see WOF.wxs file.
\r
1983 ' Performs local service conversion and then starts the local OpenSM service.
\r
1984 ' Routine called from DriverInstall phase 'IF' a local OpenSM service was
\r
1985 ' requested. The point is to get a local OpenSM up and running prior to loading
\r
1986 ' the IOU and SRP/VNIC drivers. Server 2003 IOU driver load fails if OpenSM
\r
1987 ' has not yet registered the IOC?
\r
1989 Sub OpenSM_StartMeUp(WshShell,sInstalldir)
\r
1992 opensmPath = sInstalldir & "opensm.exe"
\r
1994 Return = WshShell.Run ("cmd.exe /c sc.exe config opensm start= auto",0,true)
\r
1995 Return = WshShell.Run ("cmd.exe /c sc.exe start opensm", 0, true)
\r
2001 Sub ScheduleLocalReboot
\r
2003 Set objWMILocator = CreateObject ("WbemScripting.SWbemLocator")
\r
2004 objWMILocator.Security_.Privileges.AddAsString "SeShutdownPrivilege",True
\r
2005 Set objWMIServices = objWMILocator.ConnectServer(strComputerName, _
\r
2006 cWMINameSpace, strUserID, strPassword)
\r
2007 Set objSystemSet = GetObject(_
\r
2008 "winmgmts:{impersonationLevel=impersonate,(Shutdown)}")._
\r
2009 InstancesOf("Win32_OperatingSystem")
\r
2012 For Each objSystem In objSystemSet
\r
2013 objSystem.Win32Shutdown 2+4
\r
2014 objSystem.Win32Shutdown 2+4
\r
2015 objSystem.Win32Shutdown 2+4
\r
2018 'msgbox "Please wait while computer restarts ...",0,"WinOF"
\r
2023 ' Now that WIX+[Windows Installer] handle previous installs, this routine
\r
2024 ' only deletes lingering driver files which were not removed from the last
\r
2026 ' Called in immediate mode, condition: INSTALL=1
\r
2028 Function ChkInstallAndReboot()
\r
2030 Set fso = CreateObject("Scripting.FileSystemObject")
\r
2031 Set WshShell = CreateObject("WScript.Shell")
\r
2033 VersionNT = Session.Property("VersionNT")
\r
2035 ' remove any lingering driver installed files
\r
2036 RemoveDriverFiles fso,WshShell,VersionNT
\r
2038 ChkInstallAndReboot = 0
\r
2044 ' Not Used - idea was to run %SystemRoot%\temp\WinOFcleanup.bat on the next
\r
2045 ' reboot to remove driver files which did not get uninstalled (win2K3 only);
\r
2046 ' script ran, files persisted on Win2K3?
\r
2048 Sub RunOnceCleanup(fso,sInstalldir)
\r
2050 Dim sTemp, cmd, script
\r
2052 On Error Resume Next
\r
2054 If Session.Property("REMOVE") <> "ALL" Then
\r
2056 msgbox "RunOnceCleanup - not remove ALL?"
\r
2060 script = "RunOnceWinOFcleanup.bat"
\r
2061 src = sInstalldir & "IBcore\" & script
\r
2063 If Not fso.FileExists(src) Then
\r
2064 msgbox "Missing " & src
\r
2068 ' copy WinOFclean.bat to %SystemRoot%\temp for runOnce cmd
\r
2069 sTemp = fso.GetSpecialFolder(0) & "\temp\" & script
\r
2070 If fso.FileExists(sTemp) Then
\r
2072 fso.DeleteFile(sTemp),True
\r
2076 fso.CopyFile src, sTemp
\r
2077 If Err.Number = 0 Then
\r
2078 cmd = "cmd.exe /C " & sTemp
\r
2079 RunAtReboot "WinOF", cmd
\r
2080 ' 2nd cmd to remove previous script.
\r
2081 ' XXX cmd = "cmd.exe /C del /F/Q " & sTemp
\r
2082 ' RunAtReboot "WinOF2", cmd
\r
2089 ' WIX has appended [INSTALLDIR] to the system search path via <Environment>.
\r
2090 ' Unfortunately WIX does not _Broadcast_ to all top-level windows the registry
\r
2091 ' Settings for '%PATH%' have changed. Run nsc to do the broadcast.
\r
2093 Sub BcastRegChanged
\r
2095 Set WshShell=CreateObject("WScript.Shell")
\r
2097 sInstalldir = Session.Property("INSTALLDIR")
\r
2099 On Error Resume Next
\r
2100 WshShell.Run "%COMSPEC% /c cd /d " & sInstalldir & " & nsc.exe", 0, true
\r
2102 BcastRegChanged = 0
\r
2107 ' This routine should never be...InstallShield-12 for some reason has
\r
2108 ' decided not to completely remove [INSTALLDIR]? Until such a time
\r
2109 ' that 'why' is understood, this routine removes [INSTALLDIR]! Sigh...
\r
2110 ' nuke some driver files which remain due to devcon device install.
\r
2111 ' Immediate execution; called after MsiCleanupOnSuccess (REMOVE="ALL")
\r
2114 Dim fso, sInstalldir, rc, cmd
\r
2116 Set fso=CreateObject("Scripting.FileSystemObject")
\r
2117 Set WshShell=CreateObject("WScript.Shell")
\r
2119 sInstalldir = Session.Property("INSTALLDIR")
\r
2120 If fso.FolderExists(sInstalldir) Then
\r
2121 cmd = "cmd.exe /c rmdir /S /Q """ & sInstalldir & """"
\r
2122 rc = wshShell.Run(cmd,0,true)
\r
2125 RemoveFolder "C:\IBSDK"
\r
2131 ' NOT USED - deferred action to increment ticks while action is taking place
\r
2133 Function AddProgressInfo( )
\r
2134 Const INSTALLMESSAGE_ACTIONSTART = &H08000000
\r
2135 Const INSTALLMESSAGE_ACTIONDATA = &H09000000
\r
2136 Const INSTALLMESSAGE_PROGRESS = &H0A000000
\r
2138 Set rec = Installer.CreateRecord(3)
\r
2140 rec.StringData(1) = "callAddProgressInfo"
\r
2141 rec.StringData(2) = "Incrementing the progress bar..."
\r
2142 rec.StringData(3) = "Incrementing tick [1] of [2]"
\r
2144 'Message INSTALLMESSAGE_ACTIONSTART, rec
\r
2146 rec.IntegerData(1) = 1
\r
2147 rec.IntegerData(2) = 1
\r
2148 rec.IntegerData(3) = 0
\r
2150 Message INSTALLMESSAGE_PROGRESS, rec
\r
2152 Set progrec = Installer.CreateRecord(3)
\r
2154 progrec.IntegerData(1) = 2
\r
2155 progrec.IntegerData(2) = 5000
\r
2156 progrec.IntegerData(3) = 0
\r
2158 rec.IntegerData(2) = 1500000
\r
2160 For i = 0 To 5000000 Step 5000
\r
2161 rec.IntegerData(1) = i
\r
2162 ' action data appears only if a text control subscribes to it
\r
2163 ' Message INSTALLMESSAGE_ACTIONDATA, rec
\r
2164 Message INSTALLMESSAGE_PROGRESS, progrec
\r
2167 ' return success to MSI
\r
2168 AddProgressInfo = 0
\r
2172 ' Called when .msi 'CHANGE' (ADD/REMOVE) installation was selected.
\r
2173 ' Currently only handles SRP & VNIC
\r
2175 Function InstallChanged
\r
2177 Dim rc, sInstalldir, sAddLocal, sRemove, sDRIVERS, NeedReboot, WLH
\r
2180 sRemove = Session.Property("REMOVE")
\r
2181 If sRemove = "ALL" Then
\r
2185 sDBG = Session.Property("DBG")
\r
2187 Set WshShell=CreateObject("WScript.Shell")
\r
2188 Set fso = CreateObject("Scripting.FileSystemObject")
\r
2192 sInstalldir = Session.Property("INSTALLDIR")
\r
2193 sAddLocal = Session.Property("ADDLOCAL")
\r
2195 ' Flag Windows LongHorn Install (aka Vista | Server 2008)
\r
2196 VersionNT = Session.Property("VersionNT")
\r
2197 If VersionNT >= WindowsLongHorn Then
\r
2203 On Error Resume Next
\r
2205 If (Not IsNull(sAddLocal)) AND (sAddLocal <> "") Then
\r
2206 If Instr(sAddLocal,"fSRP") OR Instr(sAddLocal,"fVNIC") Then
\r
2207 ' IOU driver loaded into driver store when HCA driver installed.
\r
2209 devman_Install_IOU WshShell,sInstalldir
\r
2213 If Instr(sAddLocal,"fSRP") Then
\r
2214 If fso.FileExists(sInstalldir & "SRP\ib_srp.inf") Then
\r
2216 rc = dpinst_Install_SRP(WshShell,sInstalldir)
\r
2218 rc = devman_Install_SRP(WshShell,sInstalldir)
\r
2221 msgbox "ERR: missing " & sInstalldir & "SRP\ib_srp.inf"
\r
2225 If Instr(sAddLocal,"fVNIC") Then
\r
2226 If fso.FileExists(sInstalldir & "qlgcvnic\netvnic.inf") Then
\r
2228 rc = dpinst_Install_VNIC(WshShell,sInstalldir)
\r
2230 devman_Install_VNIC WshShell,sInstalldir
\r
2233 msgbox "Err: missing " & sInstalldir & "qlgcvnic\netvnic.inf"
\r
2238 If (Not IsNull(sRemove)) AND (sRemove <> "") Then
\r
2240 If Instr(sRemove,"fSRP") Then
\r
2241 Uninstall_SRP fso,WshShell,Null,sInstalldir,VersionNT
\r
2242 NeedReboot = NeedReboot + 1
\r
2245 If Instr(sRemove,"fVNIC") Then
\r
2246 Uninstall_VNIC fso,WshShell,Null,sInstalldir,VersionNT
\r
2247 NeedReboot = NeedReboot + 1
\r
2251 If NeedReboot Then
\r
2252 Session.Property("REBOOT") = "FORCE"
\r
2253 InstallChanged = ERROR_SUCCESS_REBOOT_REQUIRED
\r
2254 ' until forced reboot relly works....
\r
2255 msgbox "A system reboot is required to complete this operation." _
\r
2256 & vbCrLf & "Please do so at your earliest convinence."
\r