[WinOF] unified msiexec cmd-line DGB=1 to use the same sDBG global for install &...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 22 Jan 2009 21:58:19 +0000 (21:58 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 22 Jan 2009 21:58:19 +0000 (21:58 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1863 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

WinOF/WIX/CustomActions.vbs

index 694feff..b010abd 100644 (file)
@@ -38,6 +38,8 @@ Const WindowsXP                       ="501"
 Const WindowsLongHorn  ="600"\r
 Const Windows7                 ="700"\r
 \r
+' Global debug flag: Session.Property from msiexec.exe cmd line DBG=1\r
+Dim sDBG\r
 \r
 Function Architecture()\r
       Dim Arch,item\r
@@ -115,7 +117,7 @@ Sub WinOF_setup
                End If\r
        End If\r
 \r
-       If Session.Property("OSM") = "1" Then\r
+       If Session.Property("OSM") = "1" OR Session.Property("OSMS") = "1" Then\r
                AddLocal = AddLocal & ",fOSMS"\r
        End If\r
 \r
@@ -167,7 +169,7 @@ Function FileDeleteUntilFree(filename)
        Loop \r
 End Function\r
 \r
-Function FileDelete(filename)\r
+Sub FileDelete(filename)\r
     Dim fso\r
     Set fso = CreateObject("Scripting.FileSystemObject")\r
     Err.clear\r
@@ -178,12 +180,13 @@ Function FileDelete(filename)
                    ErrMsg ("Could not delete: " & filename)\r
         End If \r
     End If\r
-End Function\r
+End Sub\r
+\r
 \r
 Sub FileDeleteQ(fso,filename)\r
     Err.clear\r
     If fso.FileExists(filename) Then\r
-'          On Error Resume Next \r
+           On Error Resume Next \r
            fso.DeleteFile(filename),True\r
            If (Err And Err.Number <> 70) Then  ' tolerate protection errors\r
                    ErrMsg ("Could not delete: " & filename)\r
@@ -648,9 +651,12 @@ Sub devman_Install_VNIC(WshShell,sInstalldir)
        ' Display error number and description if applicable\r
        If rc <> 0 Then\r
                msgbox "Install_VNIC Err(" & rc & ") - devman update qlgcvnic.sys " _\r
-                               & devID\r
+                               & devID,,"devman_install_VNIC"\r
        Else\r
                rc = WshShell.Run (devmanQL & "enable " & devID, 0, true)\r
+               If sDBG >= "1" Then\r
+                       msgbox "VNIC Install OK",,"devman_Install_VNIC"\r
+               End If\r
        End if\r
 \r
 End Sub\r
@@ -668,9 +674,11 @@ Function dpinst_Install_VNIC(WshShell,sInstalldir)
                                " /SE /SW"\r
        rc = WshShell.Run (cmd,0,true)\r
        If (rc AND DPINST_INSTALLED) = 0 Then\r
-               dpinst_err "qlgcvnic Install failed",cmd,rc\r
+               dpinst_status "qlgcvnic Install failed",cmd,rc,"dpinst_Install_VNIC"\r
                dpinst_Install_VNIC = rc\r
-       End if\r
+       ElseIf sDBG >= "1" Then\r
+               dpinst_status "qlgcvnic Install OK.",cmd,rc,"dpinst_Install_VNIC"\r
+       End If\r
 \r
 End Function\r
 \r
@@ -702,7 +710,8 @@ Function devman_Install_SRP(WshShell,sInstalldir)
 \r
        Devices = Find_IBA_Devices(WshShell,sInstalldir) \r
        If IsNull(Devices) Then\r
-               msgbox "devman_Install_SRP() missing IBA\* devices?"\r
+               msgbox "missing SRP [IBA\*] devices?",,"devman_Install_SRP"\r
+               devman_Install_SRP = -1\r
                Exit Function\r
        End If\r
 \r
@@ -715,6 +724,8 @@ Function devman_Install_SRP(WshShell,sInstalldir)
                                If rc <> 0 Then\r
                                        msgbox "Install_SRP Err(" & rc _\r
                                                        & ") devman update ib_srp.inf " & ID\r
+                               ElseIf sDBG >= "1" Then\r
+                                       msgbox "SRP install OK.",,"devman_Install_SRP"\r
                                End If\r
                                Exit For\r
                        End If\r
@@ -743,8 +754,10 @@ Function dpinst_Install_SRP(WshShell,sInstalldir)
        cmd = dpinstSRP & "/S /F /SA /PATH """ & sInstalldir & "SRP""" & " /SE /SW"\r
        rc = WshShell.Run (cmd,0,true)\r
        If (rc AND DPINST_INSTALLED) = 0 Then\r
-               dpinst_err "SRP Install failed",cmd,rc\r
+               dpinst_status "SRP Install failed",cmd,rc,"dpinst_Install_SRP"\r
                dpinst_Install_SRP = rc\r
+       ElseIf sDBG >= "1" Then\r
+               dpinst_status "SRP Install OK.",cmd,rc,"dpinst_Install_SRP"\r
        End if\r
 \r
 End Function\r
@@ -799,13 +812,13 @@ Const ERROR_SUCCESS_REBOOT_REQUIRED = 3010 ' restart required
 \r
 Const DPINST_INSTALLED = &H000000FF\r
 \r
-Sub dpinst_err(umsg,cmd,err)\r
+Sub dpinst_status(umsg,cmd,err,title)\r
 \r
        Dim I,S(4)\r
 \r
        msg = umsg & " (status 0x" & Hex(err) & ") " & vbCrLf & vbCrLf & _\r
                        cmd & vbCrLf & _\r
-                       "  See %windir%dpinst.log for details" & vbCrLf & vbCrLf\r
+                       "  See %windir%\dpinst.log for details" & vbCrLf & vbCrLf\r
        For I = 0 To 3\r
                S(I) = (err AND 255)\r
                err = err / 256\r
@@ -814,16 +827,19 @@ Sub dpinst_err(umsg,cmd,err)
        msg = msg & S(0) & " driver packages installed on a device" & vbcrlf & _\r
                S(1) & " driver packages copied to the driver store and not installed on a device" & vbcrlf & _\r
                S(2) &   " driver packages not installed on a device" & vbcrlf\r
+       if S(3) = &H80 then\r
+            msg = msg & "[0x" & Hex(S(3)) & "] A driver package could not be installed." & vbcrlf\r
+       end if\r
        if S(3) = &H40 then\r
             msg = msg & "[0x" & Hex(S(3)) & "] 0x40 reboot required." & vbcrlf\r
        end if\r
 \r
-       msgbox msg,,"WinOF Installer"\r
+       msgbox msg,,title\r
  \r
 End Sub\r
 \r
 \r
-Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP,DBG)\r
+Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP)\r
 \r
        Dim dpinst,dpinstNET,cmd,rc\r
 \r
@@ -842,13 +858,12 @@ Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP,DBG)
        rc = WshShell.Run (cmd,0,true)\r
 \r
        If (rc AND DPINST_INSTALLED) = 0 Then\r
-               dpinst_err "dpinst_install: HCA driver Install failed",cmd,rc\r
+               dpinst_status "HCA driver Install failed",cmd,rc,"dpinst_install"\r
                dpinst_install=ERROR_INSTALL_FAILURE\r
                Exit Function\r
-       End if\r
-\r
-       If DBG = "1" Then\r
-               dpinst_err "dpinst_install: HCA Install Status",cmd,rc\r
+       ElseIf sDBG >= "1" Then\r
+               dpinst_status "IB Core Drivers [HCA] Install OK.",cmd,rc,_\r
+                                               "dpinst_install"\r
        End If\r
 \r
     ' Check/install IPoIB driver\r
@@ -857,19 +872,22 @@ Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP,DBG)
                                " /SE /SW"\r
                rc = WshShell.Run (cmd,0,true)\r
                If (rc AND DPINST_INSTALLED) = 0 Then\r
-                       dpinst_err "dpinst_install: IPoIB Install failed",cmd,rc\r
+                       dpinst_status "IPoIB Install failed",cmd,rc,"dpinst_install"\r
                        dpinst_install=ERROR_INSTALL_FAILURE\r
                        Exit Function\r
-               End if\r
-    End If\r
 \r
-       If DBG = "1" Then\r
-               dpinst_err "dpinst_install: IPoIB Install status",cmd,rc\r
-       End If\r
+               ElseIf sDBG >= "1" Then\r
+                       dpinst_status "IPoIB Install OK.",cmd,rc,"dpinst_install"\r
+               End If\r
+    End If\r
     \r
        ' Start the Local OpenSM Subnet Manager service?\r
        If localSM Then\r
                OpenSM_StartMeUp WshShell,sInstalldir\r
+               If sDBG >= "1" Then\r
+                       msgbox "Local Subnet Management Service [OpenSM] started.",,_\r
+                                       "dpinst_install"\r
+               End If\r
        End If\r
 \r
        ' IOU driver is installed (loaded into driver store) by default as the\r
@@ -877,16 +895,10 @@ Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP,DBG)
 \r
        If VNIC Then\r
                rc = dpinst_Install_VNIC(WshShell,sInstalldir)\r
-               If DBG = "1" Then\r
-                       dpinst_err "dpinst_install: qlgcvnic Install status",cmd,rc\r
-               End If\r
     End If\r
     \r
        If SRP Then\r
                rc = dpinst_Install_SRP(WshShell,sInstalldir)\r
-               If DBG = "1" Then\r
-                       dpinst_err "dpinst_install: SRP Install status",cmd,rc\r
-               End If\r
     End If\r
     \r
        dpinst_install = 0\r
@@ -894,7 +906,7 @@ Function dpinst_install(WshShell,sInstalldir,localSM,IPOIB,VNIC,SRP,DBG)
 End Function\r
 \r
 \r
-Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,VNIC,SRP,DBG)\r
+Function devman_install(WshShell,sInstalldir,have_mthca,have_mlx4,localSM,IPOIB,VNIC,SRP)\r
 \r
        Dim devman,cmd,Return,rc\r
 \r
@@ -907,7 +919,7 @@ Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,V
         Exit Function\r
     End If\r
 \r
-    devman = "cmd.exe /c cd /d " & Installdir & "IBcore & devman.exe "\r
+    devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "\r
 \r
        dev_list = Find_Dev_by_Tag(WshShell,devman,"find","VEN_15B3")\r
 \r
@@ -1004,22 +1016,28 @@ Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,V
 \r
        ' an HCA driver is 'required'.\r
 \r
-    if DrvInstalled = false Then\r
-        msgbox "Driver Install - No HCA Driver Selected to Install?" & _\r
-               "   Aborting Installation."\r
+    If DrvInstalled = false Then\r
+        msgbox "No HCA Driver Selected to Install? Aborting Installation.",,_\r
+                               "devman_install"\r
         ' Force installer cleanup (real magic).\r
         devman_install=ERROR_INSTALL_SOURCE_ABSENT\r
         Exit Function\r
+       ElseIf sDBG >= "1" Then\r
+               msgbox "IB Core Drivers [HCA] installed OK.",,"devman_install"\r
     End if\r
 \r
        ' Start a Local OpenSM Subnet Manager service?\r
        If localSM Then\r
                OpenSM_StartMeUp WshShell,sInstalldir\r
+               If sDBG >= "1" Then\r
+                       msgbox "Local Subnet Management Service [OpenSM] started.",,_\r
+                                       "devman_install"\r
+               End If\r
        End If\r
 \r
     ' Check/install IPoIB driver\r
        If IPOIB Then\r
-       devmanNET = "cmd.exe /c cd /d " & Installdir & _\r
+       devmanNET = "cmd.exe /c cd /d " & sInstalldir & _\r
                                        "net & ..\IBcore\devman.exe "\r
                cmd = devmanNET & "update netipoib.inf IBA\IPoIB"\r
                rc = WshShell.Run (cmd,0,true)\r
@@ -1027,11 +1045,10 @@ Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,V
                        msgbox "IPoIB Install Err(" & rc & ") " & cmd\r
             devman_install=ERROR_INSTALL_FAILURE\r
             Exit Function\r
+               ElseIf sDBG >= "1" Then\r
+                       msgbox "IPoIB Install OK.",,"devman_install"\r
                End If\r
     End If\r
-       If DBG = "1" Then\r
-               msgbox "devman_install: IPoIB driver Installed.",,"WinOF Installer"\r
-       End If\r
     \r
        ' IB I/O Unit driver installed only if required by VNIC or SRP.\r
 \r
@@ -1041,18 +1058,20 @@ Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,V
                        msgbox "IOU Install Err(" & rc & ") update ib_iou.inf IBA\IB_IOU"\r
             devman_install=ERROR_INSTALL_FAILURE\r
             Exit Function\r
-               End if\r
+               ElseIf sDBG >= "1" Then\r
+                       msgbox "IOU driver Install OK.",,"devman_install"\r
+               End If\r
     End If\r
 \r
     ' Install Qlogic VNIC Driver?\r
        If VNIC Then\r
-               devman_Install_VNIC WshShell,Installdir\r
+               devman_Install_VNIC WshShell,sInstalldir\r
     End if\r
        \r
     ' Install SRP (SCSI RDMA Protocol) Driver?\r
     If SRP Then\r
                For cnt=1 To 3\r
-                       rc = devman_Install_SRP(WshShell,Installdir)\r
+                       rc = devman_Install_SRP(WshShell,sInstalldir)\r
                        If rc <> -1 Then\r
                                Exit For\r
                        End If\r
@@ -1060,8 +1079,8 @@ Function devman_install(WshShell,Installdir,have_mthca,have_mlx4,localSM,IPOIB,V
                                                "WinOF - SRP Install"\r
                Next\r
                If rc = -1 Then\r
-                       msgbox "WinOF: Missing SRP devices?" & vbCrLf _\r
-                               & "cd /d " & Installdir & "SRP" & vbCrLf _\r
+                       msgbox "WinOF: Missing SRP device?" & vbCrLf _\r
+                               & "cd /d " & sInstalldir & "SRP" & vbCrLf _\r
                                & "..\IBcore\devman find IBA\*" & vbCrLf _\r
                                & "..\IBcore\devman update ib_srp.inf found-SRP-DevID" & vbCrLf\r
                End If\r
@@ -1114,7 +1133,7 @@ Function DriverInstall()
     sInstalldir = PropArray(0)\r
        VersionNT       = PropArray(4)\r
        InstallThis     = PropArray(5)\r
-       DBG     = PropArray(8)\r
+       sDBG            = PropArray(8) ' set global debug flag.\r
 \r
     devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "\r
 \r
@@ -1170,10 +1189,10 @@ Function DriverInstall()
 \r
        If VersionNT >= WindowsLongHorn Then\r
            DriverInstall = dpinst_install(WshShell,sInstalldir,localSM,IPOIB,_\r
-                                                                               VNIC,SRP,DBG)\r
+                                                                               VNIC,SRP)\r
        Else\r
            DriverInstall = devman_install(WshShell,sInstalldir,have_mthca,_\r
-                                                                               have_mlx4,localSM,IPOIB,VNIC,SRP,DBG)\r
+                                                                               have_mlx4,localSM,IPOIB,VNIC,SRP)\r
        End If\r
 \r
        If DriverInstall <> 0 Then\r
@@ -1293,11 +1312,12 @@ Function Find_IPOIB_LAC()
 End Function\r
 \r
 \r
-' Remove 3rd party (OEM) driver package, identified by the string LookFor.\r
+' Remove 3rd party (OEM) driver package; files are identified by containing\r
+' the string LookFor.\r
 \r
-Function find_remove_INF_file(WshShell,exe,LookFor)\r
+Sub find_remove_INF_file(WshShell,exe,LookFor)\r
 \r
-    Dim cmd,cmdDM,use_dpinst,pfile\r
+    Dim cmd,cmdDM,use_dpinst,pfile,found\r
 \r
        ' using dpinst.exe[WLH] or devman.exe[wnet/xp]?\r
        use_dpinst = Instr(exe,"dpinst")\r
@@ -1309,18 +1329,22 @@ Function find_remove_INF_file(WshShell,exe,LookFor)
 \r
     InfFiles = infFilesExec.StdOut.ReadAll\r
     IFILES = Split(InfFiles,vbCrLf)\r
-' msgbox "remove_INF_File LookFor " & LookFor \r
+       found = 0\r
        On Error Resume Next \r
     For Each file in IFILES\r
         If (file <> "") Then\r
-'                      msgbox "find_remove_INF_file(" & LookFor & ") " & file\r
                        ' most common is devman.exe \r
                cmd = exe & " -f dp_delete " & file\r
                        if use_dpinst then\r
-                               cmdDM = cmd\r
+                               cmdDM = replace(cmd,"dpinst","devman")\r
                                cmd = exe & " /U """ & file & """ /S /D"\r
                        end if\r
-' msgbox cmd \r
+                       If sDBG >= "1" Then\r
+                               msgbox "Found '" & LookFor & _\r
+                                               "' in file" & vbCrLf & "  " & file & vbCrLf & _\r
+                                               "  " & cmd,,"find_remove_INF_file"\r
+                               found = 1\r
+                       End If\r
                Return = WshShell.Run (cmd, 0, true)\r
                        if use_dpinst then\r
                                ' use devman.exe to delete all .inf referenced files\r
@@ -1333,30 +1357,34 @@ Function find_remove_INF_file(WshShell,exe,LookFor)
         End IF\r
     Next\r
 \r
-       find_remove_INF_file = 0\r
+       If sDBG > "1" AND found = 0 Then\r
+               msgbox "Did not find " & LookFor,,"find_remove_INF_file" \r
+       End If\r
 \r
-End Function\r
+End Sub\r
 \r
 \r
-Function remove_INF_file(WshShell,exe,file)\r
+Sub remove_INF_file(WshShell,exe,file)\r
 \r
     Dim cmd,cmdDM,use_dpinst,pfile\r
 \r
        ' using dpinst.exe[WLH] or devman.exe[wnet/xp]?\r
        use_dpinst = Instr(exe,"dpinst")\r
 \r
-' msgbox "remove_INF_File file " & file \r
-\r
        On Error Resume Next \r
 \r
        ' most common is devman.exe \r
        cmd = exe & " -f dp_delete " & file\r
        If use_dpinst Then\r
-               cmdDM = cmd\r
+               cmdDM = replace(cmd,"dpinst","devman")\r
                cmd = exe & " /U """ & file & """ /S /D"\r
        end if\r
 \r
-' msgbox cmd \r
+       If sDBG >= "1" Then\r
+               msgbox "Removing driver package " & file & vbCrLf & "  " & cmd,,_\r
+                               "remove_INF_file"\r
+       end if\r
+\r
        Return = WshShell.Run (cmd, 0, true)\r
        if use_dpinst then\r
                ' use devman.exe to delete all .inf referenced files\r
@@ -1368,9 +1396,7 @@ Function remove_INF_file(WshShell,exe,file)
        FileDelete file\r
        FileDelete pfile\r
 \r
-       find_remove_INF_file = 0\r
-\r
-End Function\r
+End Sub\r
 \r
 \r
 \r
@@ -1383,9 +1409,8 @@ Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)
                Exit Sub\r
        End If\r
 \r
-       DBG = Session.Property("DBG")\r
-       If DBG = "1" Then\r
-               DisplayDevInfo devInfo\r
+       If sDBG >= "1" Then\r
+               DisplayDevInfo devInfo,"WinOF Remove Driver Package"\r
                udfCnt = 0\r
                Flist = ""\r
        End If\r
@@ -1404,7 +1429,7 @@ Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)
                ' 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
-                       If DBG = "1" Then\r
+                       If sDBG >= "1" Then\r
                                If fso.FileExists(devInfo(i)) Then\r
                                        Flist = Flist & "  " & devInfo(i) & vbCrLf\r
                                        udfCnt = udfCnt + 1\r
@@ -1413,8 +1438,10 @@ Sub cleanup_driver_files(fso,WshShell,sInstalldir,tool,VersionNT,devInfo)
                End If\r
        Next\r
 \r
-       If DBG = "1" Then\r
-               msgbox "Remaining Driver files " & udfCnt & vbCrLf & Flist\r
+       If sDBG >= "1" Then\r
+               msgbox devInfo(1) & vbCrLf & devInfo(2) & vbCrLf & _\r
+                       "Remaining Driver Package Files " & udfCnt & vbCrLf & Flist,,_\r
+                       "cleanup_driver_files"\r
        End If\r
 \r
 End Sub\r
@@ -1431,7 +1458,7 @@ Function RunAtReboot(name,run_once_cmd)
 End Function\r
 \r
 ' DEBUG\r
-Sub DisplayDevInfo(DevInfo)\r
+Sub DisplayDevInfo(DevInfo,suffix)\r
 \r
        Dim i,devs\r
 \r
@@ -1447,7 +1474,7 @@ Sub DisplayDevInfo(DevInfo)
                        "[DeviceName]   " & DevInfo(1) & vbCRLF &_\r
                        "[INF filename] " & DevInfo(2) & vbCRLF &_\r
                        "[INF installed files] " & DevInfo(3) & vbCRLF &_\r
-                       devs\r
+                       devs,,suffix\r
 End Sub\r
 \r
 \r
@@ -1498,7 +1525,7 @@ Function GetDeviceInstallInfo(WshShell,sInstalldir,Dev)
                ibaDev(i) = ltrim(cmdout(i-1))\r
        Next\r
 \r
-'      DisplayDevInfo(ibaDev)\r
+'      DisplayDevInfo ibaDev,"WinOF Device Info"\r
 \r
        GetDeviceInstallInfo = ibaDev\r
 \r
@@ -1508,11 +1535,11 @@ End Function
 \r
 ' remove IB I/O Unit driver\r
 \r
-Sub    Uninstall_IOU(fso,WshShell,devList,Installdir,VersionNT)\r
+Sub    Uninstall_IOU(fso,WshShell,devList,sInstalldir,VersionNT)\r
 \r
        Dim devman,tool\r
 \r
-       RemoveDevice fso,WshShell,Installdir,devList,"InfiniBand I/O Unit",VersionNT\r
+       RemoveDevice fso,WshShell,sInstalldir,devList,"InfiniBand I/O Unit",VersionNT\r
 \r
        devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & devman.exe "\r
 \r
@@ -1542,7 +1569,6 @@ Sub Uninstall_VNIC(fso,WshShell,devices,sInstalldir,VersionNT)
                ' create a list of IBA\* devices via "devcon find"\r
                devices = Find_IBA_Devices(WshShell,sInstalldir)\r
                If IsNull(devices) Then\r
-                       msgbox "Uninstall_VNIC - unable to find IBA devices?"\r
                        Exit Sub\r
                End If\r
        End If\r
@@ -1597,7 +1623,6 @@ Sub Uninstall_SRP(fso,WshShell,devices,sInstalldir,VersionNT)
                ' create a list of IBA\* devices via "devcon find"\r
                devices = Find_IBA_Devices(WshShell,sInstalldir)\r
                If IsNull(devices) Then\r
-                       msgbox "Uninstall_SRP - unable to find IBA devices?"\r
                        Exit Sub\r
                End If\r
        End If\r
@@ -1653,6 +1678,9 @@ Sub RemoveDevice(fso,WshShell,sInstalldir,devList,DeviceTag,VersionNT)
        If IsNull(devList) Then\r
                devList = Find_Dev_by_Tag(WshShell,devman,"findall",DeviceTag)\r
                If IsNull(devList) Then\r
+                       If sDBG > "1" Then\r
+                               msgbox "No device by tag '" & DeviceTag & "' ?",,"RemoveDevice"\r
+                       End If\r
                        Exit Sub\r
                End If\r
        End If\r
@@ -1691,7 +1719,7 @@ Sub remove_all_HCA_devices(fso,WshShell,sInstalldir,VersionNT)
 \r
        Dim devman,tool\r
 \r
-       devman = "cmd.exe /c cd /d " & Installdir & "IBcore & devman.exe "\r
+       devman = "cmd.exe /c cd /d " & sInstalldir & "IBcore & 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
@@ -1703,7 +1731,7 @@ Sub remove_all_HCA_devices(fso,WshShell,sInstalldir,VersionNT)
 \r
        If VersionNT >= WindowsLongHorn Then\r
                ' use dpinst.exe instead of devman.exe for Windows LongHorn++\r
-               tool = replace(devman,"devman","dpinst")\r
+               tool = "cmd.exe /c cd /d " & sInstalldir & "IBcore & dpinst.exe "\r
        Else\r
                tool = devman\r
        End If\r
@@ -1713,38 +1741,38 @@ Sub remove_all_HCA_devices(fso,WshShell,sInstalldir,VersionNT)
        find_remove_INF_file WshShell,tool,"mlx4_bus"\r
 \r
        ' catch-all cleanup.\r
-       find_remove_INF_file WshShell,tool,"Mellanox"\r
-       find_remove_INF_file WshShell,tool,"InfiniBand"\r
+       find_remove_INF_file WshShell,devman,"Mellanox"\r
+       find_remove_INF_file WshShell,devman,"InfiniBand"\r
 \r
 End Sub\r
 \r
 \r
-Function Uninstall_IB_Devices(fso,WshShell,Installdir,VersionNT)\r
+Sub Uninstall_IB_Devices(fso,WshShell,sInstalldir,VersionNT)\r
 \r
        Dim devList\r
 \r
-       If (fso.FileExists(Installdir & "IBcore\dpinst.exe") = False) Then\r
-           Exit Function ' no reason to continue without the tool.\r
+       If (fso.FileExists(sInstalldir & "IBcore\dpinst.exe") = False) Then\r
+           Exit Sub ' no reason to continue without the tool.\r
        End if\r
 \r
-       If (fso.FileExists(Installdir & "IBcore\devman.exe") = False) Then\r
-           Exit Function ' no reason to continue without the tool.\r
+       If (fso.FileExists(sInstalldir & "IBcore\devman.exe") = False) Then\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,Installdir)\r
+       devList = Find_IBA_Devices(WshShell,sInstalldir)\r
        If Not IsNull(devices) Then\r
 \r
-               Uninstall_SRP fso,WshShell,devList,Installdir,VersionNT\r
+               Uninstall_SRP fso,WshShell,devList,sInstalldir,VersionNT\r
 \r
-               Uninstall_VNIC fso,WshShell,devList,Installdir,VersionNT\r
+               Uninstall_VNIC fso,WshShell,devList,sInstalldir,VersionNT\r
 \r
                ' remove I/O Unit driver\r
-               Uninstall_IOU fso,WshShell,devList,Installdir,VersionNT\r
+               Uninstall_IOU fso,WshShell,devList,sInstalldir,VersionNT\r
 \r
                ' remove IPoIB devices\r
-               RemoveDevice fso,WshShell,Installdir,devList,"IBA\IPOIB",VersionNT\r
+               RemoveDevice fso,WshShell,sInstalldir,devList,"IBA\IPOIB",VersionNT\r
 \r
        End If\r
 \r
@@ -1754,11 +1782,9 @@ Function Uninstall_IB_Devices(fso,WshShell,Installdir,VersionNT)
        ' 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,Installdir,VersionNT\r
-\r
-       Uninstall_IB_Devices = 0\r
+       remove_all_HCA_devices fso,WshShell,sInstalldir,VersionNT\r
 \r
-End Function\r
+End Sub\r
 \r
 \r
 \r
@@ -1775,7 +1801,9 @@ Sub DriverUninstall()
        ' 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
+       sDBG = Session.Property("DBG")\r
        sVersionNT = Session.Property("VersionNT")\r
+\r
        sRemove = Session.Property("REMOVE")\r
        If sRemove = "" Then\r
                sRemove = "ALL"\r
@@ -1783,7 +1811,7 @@ Sub DriverUninstall()
 \r
        If fso.FileExists(sInstalldir & "net\ndinstall.exe") Then\r
            Return = WshShell.Run ("cmd.exe /c cd /d " & sInstalldir & _\r
-                                  " & net\ndinstall.exe -r", 0, true)\r
+                                  "net & ndinstall.exe -r", 0, true)\r
        End If\r
        \r
        If sVersionNT <> WindowsXP AND fso.FileExists(sInstalldir & "installsp.exe") Then\r
@@ -2005,7 +2033,7 @@ Function ChkInstallAndReboot()
        VersionNT = Session.Property("VersionNT")\r
 \r
        ' remove any lingering driver installed files\r
-       RemoveDriverFiles fso,WshShell,sVersionNT \r
+       RemoveDriverFiles fso,WshShell,VersionNT \r
        \r
        ChkInstallAndReboot = 0\r
 \r
@@ -2063,13 +2091,13 @@ End Sub
 ' Settings for '%PATH%' have changed. Run nsc to do the broadcast.\r
  \r
 Sub BcastRegChanged\r
-    Dim sInstallDir\r
+    Dim sInstalldir\r
     Set WshShell=CreateObject("WScript.Shell")\r
 \r
-    sInstallDir = Session.Property("INSTALLDIR")\r
+    sInstalldir = Session.Property("INSTALLDIR")\r
 \r
        On Error Resume Next \r
-    WshShell.Run "%COMSPEC% /c cd /d " & sInstallDir & " & nsc.exe", 0, true\r
+    WshShell.Run "%COMSPEC% /c cd /d " & sInstalldir & " & nsc.exe", 0, true\r
     Err.clear\r
     BcastRegChanged = 0\r
 \r
@@ -2083,14 +2111,14 @@ End Sub
 ' Immediate execution; called after MsiCleanupOnSuccess (REMOVE="ALL")\r
 \r
 Sub HammerTime\r
-    Dim fso, sInstallDir, rc, cmd\r
+    Dim fso, sInstalldir, rc, cmd\r
 \r
     Set fso=CreateObject("Scripting.FileSystemObject") \r
     Set WshShell=CreateObject("WScript.Shell")\r
 \r
-    sInstallDir = Session.Property("INSTALLDIR")\r
-    If fso.FolderExists(sInstallDir) Then\r
-        cmd = "cmd.exe /c rmdir /S /Q """ & sInstallDir & """"\r
+    sInstalldir = Session.Property("INSTALLDIR")\r
+    If fso.FolderExists(sInstalldir) Then\r
+        cmd = "cmd.exe /c rmdir /S /Q """ & sInstalldir & """"\r
         rc = wshShell.Run(cmd,0,true)\r
     End if\r
 \r
@@ -2146,7 +2174,7 @@ End Function
 \r
 Function InstallChanged\r
 \r
-    Dim rc, sInstallDir, sAddLocal, sRemove, sDRIVERS, NeedReboot, WLH\r
+    Dim rc, sInstalldir, sAddLocal, sRemove, sDRIVERS, NeedReboot, WLH\r
     Err.clear\r
 \r
     sRemove = Session.Property("REMOVE")\r
@@ -2154,6 +2182,8 @@ Function InstallChanged
                Exit Function\r
        End If\r
 \r
+    sDBG = Session.Property("DBG")\r
+\r
     Set WshShell=CreateObject("WScript.Shell")\r
     Set fso = CreateObject("Scripting.FileSystemObject")\r
 \r