home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp2.jacobs.com
/
2015.02.ftp2.jacobs.com.tar
/
ftp2.jacobs.com
/
pub
/
MicrosoftUAG
/
UAG2010_ClientSetup.msi
/
Binary.UninstallCommand
< prev
Wrap
Text File
|
2014-06-26
|
3KB
|
84 lines
'Install/Ininstall mode definition bits
'#define INSTALL_MODE_SHOW_UI 0x00000001
'#define INSTALL_MODE_FORCE_REBOOT 0x00000002
'#define INSTALL_MODE_SUPRESS_REBOOT 0x00000004
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
on error resume next
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Forefront UAG endpoint components 3.1.0"
strValueName = "UninstallString"
'Get uninstall command from the registry
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'if the registry value exists change the command to perform silent uninstall
If len(strValue)>0 Then
lastBlankPos = InStrRev(strValue, " ")
If Session.Property("UILevel") > 2 Then
' show UI
strUninstallCommand = strValue
ElseIf Session.Property("REBOOT") = "SUPPRESS" OR Session.Property("REBOOT") = "Suppress" Then
' supress reboot
strUninstallCommand = Left(strValue, lastBlankPos-2) & "4 " & Right(strValue, Len(strValue)-lastBlankPos)
ElseIf Session.Property("REBOOT") = "FORCE" OR Session.Property("REBOOT") = "Force" Then
' Force reboot w/o the reboot prompt
strUninstallCommand = Left(strValue, lastBlankPos-2) & "2 " & Right(strValue, Len(strValue)-lastBlankPos)
Else
' Show reboot prompt
strUninstallCommand = Left(strValue, lastBlankPos-2) & "0 " & Right(strValue, Len(strValue)-lastBlankPos)
End If
End If
'Save an uninstall command as MSI property
If len(strUninstallCommand)>0 Then
Session.Property("UninstallCommand") = strUninstallCommand
End If
'===================================================================================
'Get last installation error from the registry and prepare MSI exit code accordingly
'===================================================================================
'Silent Install/Uninstall return codes
'#define INST_ERR_OK 0
'#define INST_ERR_REBOOT_REQUIRED 1
'#define INST_ERR_REBOOT_FORCED 2
'#define INST_ERR_PENDING_UNINSTALL_REBOOT 3
const ERROR_INSTALL_FAILURE = 1603
const ERROR_SUCCESS = 0
Function ProcessLastInstallError
On Error Resume Next
'erase REBOOT property
Session.Property("REBOOT")=""
Session.Property("REBOOTPROMPT")="Suppress"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\WhaleCom\Client\CompMgr"
strValueName = "LastInstallError"
'Get uninstall command from the registry
dwValue = 0
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'if the registry value exists perform property changes and return
If dwValue>0 Then
'if error code is 10 or greater there is a real error - return
If dwValue>=10 Then
ProcessLastInstallError=ERROR_INSTALL_FAILURE
Exit Function
End If
If dwValue=1 OR dwValue=3 Then
Session.Property("REBOOT")="ReallySuppress"
ElseIf dwValue=2 Then
Session.Property("REBOOT")="Force"
End If
End If
ProcessLastInstallError=ERROR_SUCCESS
End Function