[OFED] simplify code - remove wide-spread VersionNT usage. When checking if HCA insta...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 18 Mar 2010 18:16:19 +0000 (18:16 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 18 Mar 2010 18:16:19 +0000 (18:16 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2741 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

OFED/WIX/CustomActions.vbs

index 52df81f..968b376 100644 (file)
@@ -1,5 +1,5 @@
 '/*\r
-' * Copyright (c) 2008 Intel Corporation.  All rights reserved.\r
+' * Copyright (c) 2010 Intel Corporation.  All rights reserved.\r
 ' *\r
 ' * This software is available to you under the OpenIB.org BSD license\r
 ' * below:\r
@@ -121,7 +121,7 @@ End Function
 ' A CA can only see Installer properties through pre-loaded 'CustomActionData'\r
 \r
 Sub WinOF_setup\r
-       dim VersionNT,Installed,AddLocal,use_this_HCA\r
+       dim VersionNT,Installed,AddLocal\r
 \r
        VersionNT = Session.Property("VersionNT")\r
        Installed = Session.Property("Installed")\r
@@ -133,7 +133,10 @@ Sub WinOF_setup
 \r
        If AddLocal = "" AND Installed = "" Then\r
                ' Enable default features.\r
-               AddLocal = "IBcore,hca_mthca,fIPoIB,fWSD,fDAPL,fDatBASIC1,fDatBASIC2" \r
+               AddLocal = "IBcore,fIPoIB,fDAPL,fDatBASIC1,fDatBASIC2,fND" \r
+               If VersionNT <> WindowsXP Then\r
+                       AddLocal = AddLocal & ",fWSD"\r
+               End If\r
        End If\r
 \r
        If Session.Property("OSM") = "1" OR Session.Property("OSMS") = "1" Then\r
@@ -230,7 +233,7 @@ Function FileMove(filename,destination)
 End Function\r
 \r
 \r
-Sub DriverFileDelete(fso,WshShell,filename,VersionNT)\r
+Sub DriverFileDelete(fso,WshShell,filename)\r
     Err.clear\r
     If fso.FileExists(filename) Then\r
                ' allow continuation after 'permission denied' error\r
@@ -311,7 +314,7 @@ End Sub
 ' Attempt to clean out driver installed files which fail to be uninstalled\r
 ' when the driver is uninstalled.\r
  \r
-Sub RemoveDriverFiles(fso,WshShell,VersionNT)\r
+Sub RemoveDriverFiles(fso,WshShell)\r
 \r
     Dim Win, sDRIVERS, sSYS32, sSYSWOW64\r
     Dim CheckMode, PropArray, sTemp\r
@@ -327,65 +330,66 @@ Sub RemoveDriverFiles(fso,WshShell,VersionNT)
        sSYSWOW64 = Win & "SysWOW64\"\r
     sDRIVERS = sSYS32 & "drivers\"\r
 \r
-    DriverFileDelete fso,WshShell,sDRIVERS & "ibbus.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "mthca.sys",VersionNT\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "ibbus.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "mthca.sys"\r
     FileDeleteQ fso,sDRIVERS & "mthca.sy1"\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_bus.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_hca.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "winverbs.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "winverbsd.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "winmad.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "winmadd.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "ipoib.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "ibiou.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "ibsrp.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "vnic.sys",VersionNT\r
-    DriverFileDelete fso,WshShell,sDRIVERS & "qlgcvnic.sys",VersionNT\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_bus.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "mlx4_hca.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "winverbs.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "winverbsd.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "winmad.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "winmadd.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "ipoib.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "ibiou.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "ibsrp.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "vnic.sys"\r
+    DriverFileDelete fso,WshShell,sDRIVERS & "qlgcvnic.sys"\r
     \r
-    DriverFileDelete fso,WshShell,sSYS32 & "libibverbs.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "libibverbsd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "winmad.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "winmadd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "winverbs.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "winverbsd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibal.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibald.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibal32.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibal32d.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "complib.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "complibd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "cl32.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "cl32d.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mthcau.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mthcaud.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mthca32.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mthca32d.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mlx4ud.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32d.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibsrp.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibsrpd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "IbInstaller.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibwsd.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibndprov.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ibndprov32.dll",VersionNT\r
-    DriverFileDelete fso,WshShell,sSYS32 & "ndinstall.exe",VersionNT\r
+    DriverFileDelete fso,WshShell,sSYS32 & "libibverbs.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "libibverbsd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "winmad.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "winmadd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "winverbs.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "winverbsd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibal.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibald.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibal32.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibal32d.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "complib.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "complibd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "cl32.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "cl32d.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mthcau.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mthcaud.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mthca32.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mthca32d.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mlx4ud.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "mlx4u32d.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibsrp.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibsrpd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "IbInstaller.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibwsd.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ibndprov.dll"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "ndinstall.exe"\r
+    DriverFileDelete fso,WshShell,sSYS32 & "wvndpov.dll"\r
 \r
        If fso.FolderExists(sSYSWOW64) Then\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibal.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibald.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "complib.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "complibd.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcau.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcaud.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4u.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4ud.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrp.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrpd.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "IbInstaller.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibwsd.dll",VersionNT\r
-               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibndprov.dll",VersionNT\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibal.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibald.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "complib.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "complibd.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcau.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "mthcaud.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4u.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "mlx4ud.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrp.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibsrpd.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "IbInstaller.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibwsd.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "ibndprov.dll"\r
+               DriverFileDelete fso,WshShell,sSYSWOW64 & "wvndprov.dll"\r
        End If\r
 \r
        If fso.FolderExists(Win & "lastgood" ) Then\r
@@ -399,10 +403,12 @@ Sub RemoveDriverFiles(fso,WshShell,VersionNT)
        FileDeleteQ fso,Win & "lastgood\system32\winmadd.dll"\r
 \r
        FileDeleteQ fso,Win & "lastgood\system32\ibndprov.dll"\r
+       FileDeleteQ fso,Win & "lastgood\system32\wvndprov.dll"\r
        FileDeleteQ fso,Win & "lastgood\system32\ndinstall.exe"\r
        FileDeleteQ fso,Win & "lastgood\system32\ibwsd.dll"\r
 \r
        FileDeleteQ fso,Win & "lastgood\SysWOW64\ibndprov.dll"\r
+       FileDeleteQ fso,Win & "lastgood\SysWOW64\wvndprov.dll"\r
        FileDeleteQ fso,Win & "lastgood\SysWOW64\ibwsd.dll"\r
        FileDeleteQ fso,Win & "lastgood\SysWOW64\mthcau.dll"\r
        FileDeleteQ fso,Win & "lastgood\SysWOW64\mthcaud.dll"\r
@@ -767,7 +773,7 @@ Function DriverInstall()
     ' Get the value of INSTALLDIR - see WinOF_Setup\r
     CheckMode = Session.Property("CustomActionData")\r
 \r
-    If Not CheckMode = "" Then\r
+    If CheckMode <> "" Then\r
         'in defered action this is the way to pass arguments.\r
            PropArray = Split(Session.Property("CustomActionData"), ";")\r
     Else\r
@@ -819,23 +825,6 @@ Function DriverInstall()
                End If\r
        End If\r
 \r
-       ' HCA load failure?\r
-       ' Check for [SystemFolder]\complib.dll. If not preset then ConnectX HCA\r
-       ' driver failed to install; see mlx4_hca.inf. Complib.dll absence occurs\r
-       ' when ConnectX bus driver detects invalid Firmware hence does not create\r
-       ' the PDO for the ConnectX HCA device so PNP never loads the HCA driver and\r
-       ' complib.dll never gets installed.\r
-\r
-       If Not fso.FileExists(PropArray(1) & "complib.dll") Then\r
-               ' 10 sec timeout warning box.\r
-               WshShell.Popup "WARNING: Possible HCA Driver Startup Failure." _\r
-                       & vbCrLf & "  Consult the Windows System Event log! (mlx4_bus)",_\r
-                       10,"WinOF DriverInstall",vbInformation+vbSystemModal\r
-\r
-               MsiLogInfo "[DriverInstall] *** Possible HCA Driver Startup Failure" & _\r
-                                       vbCrLf & "[DriverInstall] ***   Consult System Event Log."\r
-       End If\r
-\r
        DriverInstall = 0\r
 \r
 End Function\r
@@ -852,7 +841,7 @@ End Function
 ' IB stack/drivers can be removed.\r
 \r
 Sub Remove_IB_Devices()  \r
-       Dim WshShell, fso, sInstalldir, sVersionNT, rc\r
+       Dim WshShell, fso, sInstalldir, winDir, sVersionNT, rc\r
 \r
        Set WshShell = CreateObject("WScript.Shell")\r
        Set fso = CreateObject("Scripting.FileSystemObject")\r
@@ -864,10 +853,11 @@ Sub Remove_IB_Devices()
 \r
        sInstalldir = Session.Property("INSTALLDIR")\r
        sVersionNT = Session.Property("VersionNT")\r
+       winDir = Session.Property("WindowsFolder")\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
+       If fso.FileExists(winDir & "system32\ndinstall.exe") Then\r
+           cmd = "ndinstall -q -r winverbs & ndinstall -q -r ibal"\r
+           rc = WshShell.Run ("cmd.exe /c " & cmd, 0, true)\r
        End If\r
        \r
        ' WSD is not supported on XP and should NOT have been installed.\r
@@ -880,7 +870,7 @@ Sub Remove_IB_Devices()
                End If\r
        End If\r
 \r
-       Uninstall_IB_Devices fso,WshShell,sInstalldir,sVersionNT\r
+       Uninstall_IB_Devices fso,WshShell,sInstalldir\r
 \r
 End Sub\r
 \r
@@ -1085,7 +1075,7 @@ Sub remove_INF_file(WshShell,exe,file)
 End Sub\r
 \r
 \r
-Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)\r
+Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,devInfo)\r
 \r
        Dim i,Flist,udfCnt\r
 \r
@@ -1113,7 +1103,7 @@ Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)
                ' skip the KMDF wdmcoinstaller*.dll file as we do not ref count here\r
                ' and could break other installed KMDF drivers if removed.\r
                If Instr(devinfo(i),"WdfCoInstaller") = 0 Then\r
-               DriverFileDelete fso,WshShell,devInfo(i),VersionNT\r
+               DriverFileDelete fso,WshShell,devInfo(i)\r
                        If sDBG >= "1" Then\r
                                If fso.FileExists(devInfo(i)) Then\r
                                        Flist = Flist & "  " & devInfo(i) & vbCrLf\r
@@ -1220,9 +1210,9 @@ End Function
 \r
 ' remove IB I/O Unit driver\r
 \r
-Sub    Uninstall_IOU(fso,WshShell,devList,sInstalldir,VersionNT)\r
+Sub    Uninstall_IOU(fso,WshShell,devList,sInstalldir)\r
 \r
-       RemoveDevice fso,WshShell,sInstalldir,devList,"InfiniBand I/O Unit",VersionNT\r
+       RemoveDevice fso,WshShell,sInstalldir,devList,"InfiniBand I/O Unit"\r
 \r
 End Sub\r
 \r
@@ -1230,7 +1220,7 @@ End Sub
 \r
 ' Remove QLogic VNIC instances\r
 \r
-Sub Uninstall_VNIC(fso,WshShell,devices,sInstalldir,VersionNT)\r
+Sub Uninstall_VNIC(fso,WshShell,devices,sInstalldir)\r
 \r
        Dim devman,Return,device,dt,sDRIVERS,tool,devInfo\r
 \r
@@ -1275,7 +1265,7 @@ SRP_IDS = Array(_
                        "IBA\V000006P00006282")\r
 \r
 \r
-Sub Uninstall_SRP(fso,WshShell,devices,sInstalldir,VersionNT)\r
+Sub Uninstall_SRP(fso,WshShell,devices,sInstalldir)\r
 \r
        Dim devman,devmanRMAT,devmanDAAT,Return,device,sDRIVERS,tool,devInfo\r
 \r
@@ -1321,7 +1311,7 @@ Sub Uninstall_SRP(fso,WshShell,devices,sInstalldir,VersionNT)
 End Sub\r
 \r
 \r
-Sub RemoveDevice(fso,WshShell,sInstalldir,devList,DeviceTag,VersionNT)\r
+Sub RemoveDevice(fso,WshShell,sInstalldir,devList,DeviceTag)\r
 \r
        dim device,devman,devmanRMAT,devTarget,dt,Return,devInfo\r
 \r
@@ -1355,7 +1345,7 @@ Sub RemoveDevice(fso,WshShell,sInstalldir,devList,DeviceTag,VersionNT)
 End Sub\r
 \r
 \r
-Sub Uninstall_IB_Devices(fso,WshShell,sInstalldir,VersionNT)\r
+Sub Uninstall_IB_Devices(fso,WshShell,sInstalldir)\r
 \r
        Dim devList\r
 \r
@@ -1373,19 +1363,15 @@ Sub Uninstall_IB_Devices(fso,WshShell,sInstalldir,VersionNT)
 \r
        devList = Find_IBA_Devices(WshShell,sInstalldir)\r
        If Not IsNull(devList) Then\r
+               Uninstall_SRP fso,WshShell,devList,sInstalldir\r
 \r
-               Uninstall_SRP fso,WshShell,devList,sInstalldir,VersionNT\r
-\r
-               Uninstall_VNIC fso,WshShell,devList,sInstalldir,VersionNT\r
+               Uninstall_VNIC fso,WshShell,devList,sInstalldir\r
 \r
                ' remove I/O Unit driver\r
-               Uninstall_IOU fso,WshShell,devList,sInstalldir,VersionNT\r
+               Uninstall_IOU fso,WshShell,devList,sInstalldir\r
 \r
                ' remove IPoIB devices\r
-               RemoveDevice fso,WshShell,sInstalldir,devList,"IBA\IPOIB",VersionNT\r
-\r
-       Else\r
-        msgbox "Uninstall_IB_Devices() <NULL> devList?"\r
+               RemoveDevice fso,WshShell,sInstalldir,devList,"IBA\IPOIB"\r
     End If\r
 \r
        ' stop the openSM service in case it was started.\r
@@ -1396,10 +1382,11 @@ Sub Uninstall_IB_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
+       If Not IsNull(devList) Then\r
+           RemoveDevice fso,WshShell,sInstalldir,devList,"MLX4\CONNECTX_HCA"\r
+           ' VEN_15B3 covers devices: mthca & mlx4_bus\r
+           RemoveDevice fso,WshShell,sInstalldir,devList,"PCI\VEN_15B3"\r
+    End If\r
 \r
 End Sub\r
 \r
@@ -1411,7 +1398,7 @@ End Sub
 ' their IB stack references.\r
 \r
 Sub IB_DriverCleanup()  \r
-       Dim sInstalldir, WshShell, fso, sVersionNT, sRemove,devman, tool\r
+       Dim sInstalldir, WshShell, fso, sRemove,devman, tool\r
 \r
        sInstalldir = Session.Property("INSTALLDIR")\r
 \r
@@ -1424,7 +1411,6 @@ Sub IB_DriverCleanup()
        End If\r
 \r
        sDBG = Session.Property("DBG")\r
-       sVersionNT = Session.Property("VersionNT")\r
 \r
        sRemove = Session.Property("REMOVE")\r
        If sRemove = "" Then\r
@@ -1536,13 +1522,82 @@ Sub IB_DriverCleanup()
        find_remove_INF_file WshShell,devman,"InfiniBand"\r
 \r
        ' remove driver installed files\r
-       RemoveDriverFiles fso,WshShell,sVersionNT \r
+       RemoveDriverFiles fso,WshShell\r
        \r
        err.clear \r
 \r
 End Sub\r
 \r
 \r
+' HCA load failure?\r
+' Check for [SystemFolder]\complib.dll. If not preset then ConnectX HCA\r
+' driver failed to install; see mlx4_hca.inf. Complib.dll absence occurs\r
+' when ConnectX bus driver detects invalid Firmware hence does not create\r
+' the PDO for the ConnectX HCA device so PNP never loads the HCA driver and\r
+' complib.dll never gets installed.\r
+' If features[IPoIB+(WinSockDirect OR NetworkDirect)] are installed, then\r
+' wait for IPoIB device to appear in order to ensure WSD and/or ND provider\r
+' instal success.\r
+\r
+Sub CheckDriversOK()\r
+    Dim winDir, WshShell, fso, AddLocal, too_long\r
+\r
+       Set WshShell = CreateObject("WScript.Shell")\r
+       Set fso = CreateObject("Scripting.FileSystemObject")\r
+\r
+       winDir = Session.Property("WindowsFolder")\r
+       sInstalldir = Session.Property("INSTALLDIR")\r
+       devman = "cmd.exe /c cd /d " & sInstalldir & "Drivers & devman.exe "\r
+       AddLocal = Session.Property("ADDLOCAL")\r
+\r
+       ' Check if HCA driver installed OK.\r
+       If Not fso.FileExists(winDir & "system32\complib.dll") Then\r
+               ' SW only install, such that there are no hardware HCAs avaiable?\r
+               devList = Find_Dev_by_Tag(WshShell,devman,"find","PCI\VEN_15B3")\r
+               If IsNull(devList) Then\r
+                       Exit Sub\r
+               End If\r
+\r
+               ' 10 sec timeout warning box.\r
+               WshShell.Popup "WARNING: Possible HCA Driver Startup Failure." _\r
+                       & vbCrLf & "  Consult the Windows System Event log! (mlx4_bus)",_\r
+                       10,"WinOF-Install CheckDriversOK",vbInformation+vbSystemModal\r
+\r
+               MsiLogInfo "[CheckDriversOK] ** Possible HCA Driver Startup Failure" & _\r
+                                       vbCrLf & "[CheckDriversOK] **   Consult System Event Log."\r
+           Exit Sub\r
+       End If\r
+\r
+       ' empty string implies default install Features which include IPoIB+WSD+ND.\r
+       If AddLocal <> "" Then\r
+               ' No wait if !IPoIB OR (!WinSockDirect AND !NetworkDirect)\r
+               If Instr(AddLocal,"fIPoIB") = 0 Then\r
+                       Exit Sub\r
+               End If\r
+               If Instr(AddLocal,"fWSD") = 0 AND Instr(AddLocal,"fND") = 0 Then\r
+                       Exit Sub\r
+               End If\r
+       End If\r
+\r
+       ' wait for IPoIB driver to start so ND and/or WSD can install\r
+\r
+       devList = Find_Dev_by_Tag(WshShell,devman,"find","IBA\IPOIB")\r
+    too_long = 0\r
+\r
+       Do While IsNull(devList)\r
+      WScript.Sleep 1000    ' milliseconds\r
+      ' Wait for device IPoIB to appear as it's required for WSD/ND install.\r
+         too_long = too_long\r
+         if too_long > 30 then\r
+               exit Do\r
+         End If\r
+         err.clear \r
+         devList = Find_Dev_by_Tag(WshShell,devman,"find","IBA\IPOIB")\r
+       Loop \r
+\r
+End Sub\r
+\r
+\r
 ' Enable WSD if installsp.exe was installed (feature Winsock direct selected).\r
 ' For Windows XP, this CustomAction should not be called as WSD is not\r
 ' supported on XP.\r
@@ -1573,18 +1628,23 @@ End Sub
 ' See WIX src file - ND_start\r
 \r
 Sub ND_StartMeUp()\r
-    Dim Ret, sInstalldir, WshShell, fso\r
+    Dim Ret, sInstalldir, NDprovider, winDir, WshShell, fso\r
 \r
     sInstalldir = Session.Property("INSTALLDIR")\r
 \r
     Set WshShell = CreateObject("WScript.Shell")\r
     Set fso = CreateObject("Scripting.FileSystemObject")\r
+       winDir = Session.Property("WindowsFolder")\r
 \r
     ' Start the Network Direct Service if installed\r
-\r
-    If fso.FileExists(sInstalldir & "Drivers\net\ndinstall.exe") Then\r
-        Ret = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir _\r
-                              & " & Drivers\net\ndinstall.exe -q -i", 0, true)\r
+    If fso.FileExists(winDir & "system32\ndinstall.exe") Then\r
+           ' ia64 only supports the ND/winverbs provider, otherwise use\r
+        ' ND/ibal provider.\r
+           NDprovider = "ibal"\r
+           If Architecture() = "ia64" Then\r
+                   NDprovider = "winverbs"\r
+           End If\r
+        Ret = WshShell.Run ("cmd.exe /c ndinstall -q -i " & NDprovider, 0, true)\r
         If Ret Then ShowErr2("ND service provider install failed")\r
     End If\r
 \r
@@ -1646,10 +1706,8 @@ Function ChkPreviousInstall()
                Exit Function\r
        End If\r
 \r
-       VersionNT = Session.Property("VersionNT")\r
-\r
        ' remove any lingering driver installed files\r
-       RemoveDriverFiles fso,WshShell,VersionNT \r
+       RemoveDriverFiles fso,WshShell\r
        \r
        ChkPreviousInstall = 0\r
 \r
@@ -1809,8 +1867,6 @@ Function InstallChanged
 \r
     sInstalldir = Session.Property("INSTALLDIR")\r
 \r
-       VersionNT = Session.Property("VersionNT")\r
-\r
        On Error Resume Next \r
 \r
        ' Nothing to do for ADD as DIFxAPP has loaded drivers into Driver Store.\r
@@ -1820,12 +1876,12 @@ Function InstallChanged
        If (Not IsNull(sRemove)) AND (sRemove <> "") Then\r
 \r
                If Instr(sRemove,"fSRP") Then\r
-                       Uninstall_SRP fso,WshShell,Null,sInstalldir,VersionNT\r
+                       Uninstall_SRP fso,WshShell,Null,sInstalldir\r
                        NeedReboot = NeedReboot + 1\r
                End If\r
 \r
                If Instr(sRemove,"fVNIC") Then\r
-                       Uninstall_VNIC fso,WshShell,Null,sInstalldir,VersionNT\r
+                       Uninstall_VNIC fso,WshShell,Null,sInstalldir\r
                        NeedReboot = NeedReboot + 1\r
                End If\r
        End If\r