From: stansmith Date: Thu, 16 Aug 2007 00:04:13 +0000 (+0000) Subject: [WinOF] general cleanup. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=a1578aa33e30ff6e1466d20bf45478cbff23ff1f;p=~shefty%2Frdma-win.git [WinOF] general cleanup. cleanup whitespace vs. tab formatting, clean out commented out debug code. git-svn-id: svn://openib.tc.cornell.edu/gen1@769 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/WinOF/WIX/CustomActions.vbs b/branches/WinOF/WIX/CustomActions.vbs index aacca232..39854c57 100644 --- a/branches/WinOF/WIX/CustomActions.vbs +++ b/branches/WinOF/WIX/CustomActions.vbs @@ -131,6 +131,10 @@ Function FileMove(filename,destination) End Function +' Attempt to clean out driver installed files which fail to be uninstalled +' when the driver is uninstalled. Win2K3/x64 files persist, XP & Win2K3/x86 +' the driver files are correctly remove? + Function RemoveDriverFiles() Dim Win Dim sDRIVERS @@ -163,11 +167,6 @@ Function RemoveDriverFiles() End If sDRIVERS = sDRIVERS & "drivers\" -' msgbox "RM sDrivers " & sDRIVERS & " sSystemFolder " & sSystemFolder & " sSystem64Folder " & sSystem64Folder -' msgbox " sDrivers " & sDRIVERS -' msgbox " sSystemFolder " & sSystemFolder -' msgbox " sSystem64Folder " & sSystem64Folder - FileDelete(sDRIVERS & "ibbus.sys") FileDelete(sDRIVERS & "mthca.sys") FileDelete(sDRIVERS & "ipoib.sys") @@ -175,7 +174,6 @@ Function RemoveDriverFiles() FileDelete(sDRIVERS & "vnic.sys") If (MTARCH="amd64") Then -if False Then ' System64Folder = System32, SystemFolder = Syswow64 ' check/remove from .dll cache prior to removal from system32\ Dim dllCache @@ -201,7 +199,6 @@ if False Then FileDelete(sSystem64Folder & "ibwsd.dll") FileDelete(sSystem64Folder & "ibsrp.dll") FileDelete(sSystem64Folder & "ibsrpd.dll") -End if End If ' MTARCH=x86 SystemFolder = System32 @@ -704,11 +701,11 @@ End Function ' Not used - run the specified command during next startup. -Function RunAtReboot(run_once_cmd) +Function RunAtReboot(name,run_once_cmd) dim key_name key_name = "Software\Microsoft\Windows\CurrentVersion\RunOnce" - AddRegStringValue key_name,"WinOF",run_once_cmd - msgbox "RunAtReboot() " & run_once_cmd + AddRegStringValue key_name,name,run_once_cmd + msgbox "RunAtReboot( " & name & " , " & run_once_cmd & " )" RunAtReboot = 0 End Function @@ -925,7 +922,7 @@ Sub OpensmServiceEvent() ' opensm.exe is required If Not fso.FileExists(opensmPath) Then - Exit Sub + Exit Sub End if sc = "sc.exe create opensm binPath= """ &opensmPath _ @@ -933,11 +930,11 @@ Sub OpensmServiceEvent() ' start opesm as a Service? If fso.FileExists(opensmService) Then - StartMeUp = True - sc = sc & "start= auto" + StartMeUp = True + sc = sc & "start= auto" Else - StartMeUp = False - sc = sc & "start= disabled" + StartMeUp = False + sc = sc & "start= disabled" End if Return = WshShell.Run ("cmd.exe /c " & sc, 0, true) sc = "sc.exe description opensm ""Configures and manage the InfiniBand Subnet"" " @@ -1066,7 +1063,7 @@ Function ChkInstallAndReboot() ,13,"WinOF - Existing InfiniBand installation Detected") 'run_once_cmd = Session.Property("SETUPEXEDIR") & "\setup.exe" - 'RunAtReboot(run_once_cmd) + 'RunAtReboot "WinOF", run_once_cmd ' the _Driver Uninstall call sets reboot=force. The ForceReboot action ' following this CustomAction will fire when reboot is set =force. @@ -1085,6 +1082,42 @@ Function ChkInstallAndReboot() End Function +' Not Used - idea was to run %SystemRoot%\temp\WinOFcleanup.bat on the next +' reboot to remove driver files which did not get uninstalled (win2K3 only); +' script ran, files persisted on Win2K3? WIX call to invoke this Sub were +' removed. + +Sub RunOnceCleanup + Dim fso, sInstalldir, sTemp, cmd + Set fso=CreateObject("Scripting.FileSystemObject") + + On Error Resume Next + + sInstalldir = Session.Property("REMOVE") + If sInstalldir <> "ALL" Then + Exit Sub + End if + + sInstalldir = Session.Property("INSTALLDIR") + + If Not fso.FileExists(sInstalldir & "WinOFclean.bat") Then + Exit Sub + End if + + ' copy WinOFclean.bat to %SystemRoot%\temp for runOnce cmd + sTemp = fso.GetSpecialFolder(0) & "\temp\WinOFclean.bat" + Err.clear + fso.CopyFile sInstalldir & "WinOFclean.bat", sTemp + If Err.Number = 0 Then + cmd = "cmd.exe /C " & sTemp + RunAtReboot "WinOF", cmd + ' 2nd cmd to remove previous script. + cmd = "cmd.exe /C del /F/Q " & sTemp + RunAtReboot "WinOF2", cmd + End if + +End Sub + ' This routine should never be...InstallShield-12 for some reason has ' decided not to completely remove [INSTALLDIR]? Until such a time