' Global debug flag: Session.Property from msiexec.exe cmd line DBG=1\r
Dim sDBG\r
\r
+\r
+' Write string to MSI log file\r
+\r
+Function MsiLogInfo(msg)\r
+ Dim rec\r
+ Set rec = Session.Installer.CreateRecord(1) \r
+ rec.StringData(0) = msg\r
+ MsiLogInfo = Session.Message(&H04000000, rec)\r
+End Function\r
+\r
+\r
+Sub ShowError()\r
+ If Err.Number = 0 Then\r
+ Exit Sub\r
+ End if\r
+ strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _\r
+ Err.Description & vbCrLf & vbCrLf\r
+ msgbox strMsg\r
+ MsiLogInfo strMsg\r
+\r
+End Sub\r
+\r
+\r
+Sub ErrMsg(msg)\r
+ If Err.Number <> 0 Then\r
+ msgbox msg & vbCrLf & "Err # " & Err.Number & vbCrLf & Err.Description\r
+ Err.clear\r
+ End if\r
+End Sub\r
+\r
+Function ShowErr2(msg)\r
+ If Err.Number <> 0 Then\r
+ strMsg = vbCrLf & "Err # " & Err.Number & vbCrLf & _\r
+ Err.Description & vbCrLf\r
+ msgbox msg & strMsg\r
+ End if\r
+ ShowErr2=Err.Number\r
+End Function\r
+\r
+\r
Function Architecture()\r
Dim Arch,item\r
For Each item In GetObject("winmgmts:root/cimv2").ExecQuery("SELECT Architecture FROM Win32_Processor")\r
End Function\r
\r
\r
-\r
' A CustomAction (CA) that runs after SetupInitialize which sets up\r
' CustomAction Data for the defered action DriverInstall().\r
' A CA can only see Installer properties through pre-loaded 'CustomActionData'\r
If sDBG >= "1" Then\r
msgbox "Local Subnet Management Service [OpenSM] started.",,_\r
"DriverInstall"\r
+ MsiLogInfo "[DriverInstall] Local Subnet Management Service [OpenSM] started."\r
End If\r
End If\r
\r
\r
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\r
\r
-' Find IBA devices using devman.exe\r
+' called from WIX src to Disable/Remove IB devices so actual driver removal\r
+' can proceed correctly.\r
+' Actual driver file cleanup is handled after DIFxApp processing.\r
+' shutdown NetworkDirect & Winsock Direct providers in\r
+' order to remove their references to the rest of the IB stack such that the\r
+' IB stack/drivers can be removed.\r
+\r
+Sub Remove_IB_Devices() \r
+ Dim WshShell, fso, sInstalldir, sVersionNT, rc\r
+\r
+ Set WshShell = CreateObject("WScript.Shell")\r
+ Set fso = CreateObject("Scripting.FileSystemObject")\r
+\r
+ ' Check if install was done with NODRV=1, if so then nothing to do, exit\r
+ If Session.Property("NODRV") = "1" Then\r
+ Exit Sub\r
+ End If\r
+\r
+ sInstalldir = Session.Property("INSTALLDIR")\r
+ sVersionNT = Session.Property("VersionNT")\r
+\r
+ If fso.FileExists(sInstalldir & "Drivers\net\ndinstall.exe") Then\r
+ rc = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _\r
+ "Drivers\net & ndinstall.exe -q -r", 0, true)\r
+ End If\r
+ \r
+ ' WSD is not supported on XP and should NOT have been installed.\r
+ ' otherwise, remove the WinSock Direct service.\r
+\r
+ If sVersionNT <> WindowsXP Then\r
+ If fso.FileExists(sInstalldir & "installsp.exe") Then\r
+ rc = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _\r
+ " & installsp.exe -r", 0, true)\r
+ End If\r
+ End If\r
+\r
+ Uninstall_IB_Devices fso,WshShell,sInstalldir,sVersionNT\r
+\r
+End Sub\r
+\r
+\r
+' Find all IBA devices [IBA,PCI\VEN_15B3,MLX4] using devman.exe\r
+' In devman.exe output, Device tags all start in col #1.\r
\r
Function Find_IBA_Devices(WshShell,sInstalldir) \r
Dim dev\r
\r
- Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd " & sInstalldir & "Drivers & devman.exe findall * | FIND ""IBA""")\r
+ Set ibaDevicesExec = WshShell.Exec ("cmd.exe /c cd /D " & sInstalldir & "Drivers & devman.exe findall * ")\r
\r
ibaDevices = split(ibaDevicesExec.StdOut.ReadAll, vbCrLF)\r
\r
dim arrSize\r
arrSize = 0\r
For each dev in ibaDevices\r
- if (Instr(dev,"IBA\") = 1) Then\r
+ If (Instr(dev,"IBA\") = 1) Then\r
+ arrSize = arrSize + 1\r
+ ElseIf (Instr(dev,"PCI\VEN_15B3") = 1) Then\r
+ arrSize = arrSize + 1\r
+ ElseIf (Instr(dev,"MLX4") = 1) Then\r
arrSize = arrSize + 1\r
End if\r
Next\r
Redim ibaDev(arrSize - 1)\r
index = 0\r
For each dev in ibaDevices\r
- if (Instr(dev,"IBA\") = 1) Then\r
+ If (Instr(dev,"IBA\") = 1) Then\r
+ ibaDev(index) = dev\r
+ index = index + 1\r
+ ElseIf (Instr(dev,"PCI\VEN_15B3") = 1) Then\r
+ ibaDev(index) = dev\r
+ index = index + 1\r
+ ElseIf (Instr(dev,"MLX4") = 1) Then\r
ibaDev(index) = dev\r
index = index + 1\r
End if\r
End Sub\r
\r
\r
-\r
Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)\r
\r
Dim i,Flist,udfCnt\r
' remove IB I/O Unit driver\r
\r
Sub Uninstall_IOU(fso,WshShell,devList,sInstalldir,VersionNT)\r
- Dim tool\r
\r
RemoveDevice fso,WshShell,sInstalldir,devList,"InfiniBand I/O Unit",VersionNT\r
\r
- tool = "cmd.exe /c cd /d " & sInstalldir & "Drivers & dpinst.exe "\r
-\r
- ' dpinst (loads the driver store) not load the driver (no srp/vnic)\r
-\r
- find_remove_INF_file WshShell,tool,"ib_iou.cat"\r
-\r
End Sub\r
\r
\r
End if\r
Next\r
\r
- ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
- tool = replace(devman,"devman","dpinst")\r
-\r
- If IsNull(devInfo) Then\r
- find_remove_INF_file WshShell,tool,"netvnic.cat"\r
- Exit Sub\r
- End If\r
-\r
- cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo\r
-\r
End Sub\r
\r
\r
Next\r
Next\r
\r
- ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
- tool = replace(devman,"devman","dpinst")\r
-\r
- 'No SRP device - check/clear to be safe.\r
- If IsNull(devInfo) Then\r
- find_remove_INF_file WshShell,tool,"ibsrp.cat"\r
- Exit Sub\r
- End If\r
-\r
- cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo\r
-\r
End Sub\r
\r
\r
End if\r
Next\r
\r
- ' Only if a device was found\r
- If IsNull(devInfo) Then\r
- Exit Sub\r
- End If\r
-\r
- ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
- tool = replace(devman,"devman","dpinst")\r
-\r
- cleanup_driver_files fso,WshShell,sInstalldir,tool,VersionNT,devInfo\r
-\r
-End Sub\r
-\r
-\r
-\r
-Sub remove_all_HCA_devices(fso,WshShell,sInstalldir,VersionNT)\r
-\r
- Dim devman,tool\r
-\r
- devman = "cmd.exe /c cd /d " & sInstalldir & "Drivers & devman.exe "\r
-\r
- ' Old (CoInstaller version) ibbus GUID - just in case.\r
- Return = WshShell.Run (devman & "remove {94F41CED-78EB-407C-B5DF-958040AF0FD8",0,true)\r
-\r
- RemoveDevice fso,WshShell,sInstalldir,Null,"MLX4\CONNECTX_HCA",VersionNT\r
-\r
- ' VEN_15B3 covers devices: mthca & mlx4_bus\r
- RemoveDevice fso,WshShell,sInstalldir,Null,"PCI\VEN_15B3",VersionNT\r
-\r
- ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
- tool = "cmd.exe /c cd /d " & sInstalldir & "Drivers & dpinst.exe "\r
-\r
- find_remove_INF_file WshShell,tool,"mthca"\r
- find_remove_INF_file WshShell,tool,"mlx4_hca"\r
- find_remove_INF_file WshShell,tool,"mlx4_bus"\r
-\r
- ' catch-all cleanup.\r
- find_remove_INF_file WshShell,devman,"Mellanox"\r
- find_remove_INF_file WshShell,devman,"InfiniBand"\r
-\r
End Sub\r
\r
\r
Dim devList\r
\r
If (fso.FileExists(sInstalldir & "Drivers\dpinst.exe") = False) Then\r
+ msgbox "Uninstall_IB_Devices() Error " & sInstalldir & _\r
+ "Drivers\dpinst.exe Not Found?"\r
Exit Sub ' no reason to continue without the tool.\r
End if\r
\r
' create a list of IBA\* devices via "devcon find"\r
\r
devList = Find_IBA_Devices(WshShell,sInstalldir)\r
- If Not IsNull(devices) Then\r
+ If Not IsNull(devList) Then\r
\r
Uninstall_SRP fso,WshShell,devList,sInstalldir,VersionNT\r
\r
' remove IPoIB devices\r
RemoveDevice fso,WshShell,sInstalldir,devList,"IBA\IPOIB",VersionNT\r
\r
- End If\r
+ Else\r
+ msgbox "Uninstall_IB_Devices() <NULL> devList?"\r
+ End If\r
\r
' stop the openSM service in case it was started.\r
Return = WshShell.Run ("cmd.exe /c sc.exe stop opensm", 0, true)\r
' delete opensm service from registry\r
Return = WshShell.Run ("cmd.exe /c sc.exe delete opensm", 0, true)\r
\r
- remove_all_HCA_devices fso,WshShell,sInstalldir,VersionNT\r
+ ' remove HCA devices\r
+\r
+ RemoveDevice fso,WshShell,sInstalldir,devList,"MLX4\CONNECTX_HCA",VersionNT\r
+\r
+ ' VEN_15B3 covers devices: mthca & mlx4_bus\r
+ RemoveDevice fso,WshShell,sInstalldir,devList,"PCI\VEN_15B3",VersionNT\r
\r
End Sub\r
\r
\r
\r
-''''''''''' Driver Uninstall ''''''''''''\r
+''''''''''' Driver Cleanup ''''''''''''\r
+' called from WIX src to cleanup after IB driver uninstall.\r
+' Assumption is NetworkDirect and Winsock Direct have been shutdown to remove\r
+' their IB stack references.\r
\r
-Sub DriverUninstall() \r
- Dim sInstalldir, WshShell, fso, sVersionNT\r
+Sub IB_DriverCleanup() \r
+ Dim sInstalldir, WshShell, fso, sVersionNT, sRemove,devman, tool\r
\r
sInstalldir = Session.Property("INSTALLDIR")\r
\r
sRemove = "ALL"\r
End If\r
\r
- If fso.FileExists(sInstalldir & "Drivers\net\ndinstall.exe") Then\r
- Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _\r
- "Drivers\net & ndinstall.exe -q -r", 0, true)\r
- End If\r
- \r
- ' WSD is not supported on XP and should NOT have been installed.\r
- ' otherwise, remove the service: ND (Network Direct) then WinSock Direct.\r
-\r
- If sVersionNT <> WindowsXP AND fso.FileExists(sInstalldir & "installsp.exe") Then\r
- Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _\r
- " & installsp.exe -r", 0, true)\r
- End If\r
-\r
- Uninstall_IB_Devices fso,WshShell,sInstalldir,sVersionNT\r
-\r
' Remove Service entries from the registry\r
\r
DeleteRegKey "System\CurrentControlSet\Services\ibbus"\r
' Return = WshShell.Run ("reg.exe delete HKLM\Software\Microsoft\Windows\currentVersion\DIFx\DriverStore\ipoib_* /f", 0, true)\r
'\r
\r
- ' Remove all Local Area Connection registry entries which were constructed\r
+ ' Remove all Local Area Connection Registry entries which were constructed\r
' for IPoIB. Next WinOF install gets same IPoIB local area connection\r
' assignment.\r
\r
End if\r
Next\r
\r
+ Session.Property("REBOOT") = "FORCE"\r
+ err.clear \r
+\r
+ ' cleanup INF files\r
+\r
+ If (fso.FileExists(sInstalldir & "Drivers\dpinst.exe") = False) Then\r
+ Exit Sub ' no reason to continue without the tool.\r
+ End if\r
+\r
+ devman = "cmd.exe /c cd /d " & sInstalldir & "Drivers & devman.exe "\r
+\r
+ ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
+ tool = "cmd.exe /c cd /d " & sInstalldir & "Drivers & dpinst.exe "\r
+\r
+ find_remove_INF_file WshShell,tool,"mthca"\r
+ find_remove_INF_file WshShell,tool,"mlx4_hca"\r
+ find_remove_INF_file WshShell,tool,"mlx4_bus"\r
+\r
+ ' catch-all cleanup.\r
+ find_remove_INF_file WshShell,devman,"Mellanox"\r
+ find_remove_INF_file WshShell,devman,"InfiniBand"\r
+\r
' remove driver installed files\r
RemoveDriverFiles fso,WshShell,sVersionNT \r
\r
- Session.Property("REBOOT") = "FORCE" \r
err.clear \r
+\r
End Sub\r
\r
\r
Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir _\r
& " & installsp.exe -i", 0, true)\r
End If\r
- If Err Then ShowError\r
\r
End Sub\r
\r
End Sub\r
\r
\r
-Sub ShowError()\r
- If Err.Number = 0 Then\r
- Exit Sub\r
- End if\r
- strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _\r
- Err.Description & vbCrLf & vbCrLf\r
- msgbox strMsg\r
-End Sub\r
-\r
-\r
-Sub ErrMsg(msg)\r
- If Err.Number <> 0 Then\r
- msgbox msg & vbCrLf & "Err # " & Err.Number & vbCrLf & Err.Description\r
- Err.clear\r
- End if\r
-End Sub\r
-\r
-Function ShowErr2(msg)\r
- If Err.Number <> 0 Then\r
- strMsg = vbCrLf & "Err # " & Err.Number & vbCrLf & _\r
- Err.Description & vbCrLf\r
- msgbox msg & strMsg\r
- End if\r
- ShowErr2=Err.Number\r
-End Function\r
-\r
\r
' Convert the disabled OpenSM Windows service to an 'auto' startup on next boot.\r
' OpenSM service was created by WIX installer directives - see WOF.wxs file.\r
' uninstall.\r
' Called in immediate mode, condition: INSTALL=1\r
\r
-Function ChkInstallAndReboot()\r
+Function ChkPreviousInstall()\r
\r
Set fso = CreateObject("Scripting.FileSystemObject") \r
Set WshShell = CreateObject("WScript.Shell")\r
' remove any lingering driver installed files\r
RemoveDriverFiles fso,WshShell,VersionNT \r
\r
- ChkInstallAndReboot = 0\r
+ ChkPreviousInstall = 0\r
\r
End Function\r
\r
rc = wshShell.Run(cmd,0,true)\r
End if\r
\r
- RemoveFolder "C:\IBSDK"\r
+ If fso.FolderExists("C:\IBSDK") Then\r
+ RemoveFolder "C:\IBSDK"\r
+ End if\r
\r
End Sub\r
\r