Functions | |
CA_API UINT __stdcall | CheckPrivilege (MSIHANDLE hInstall) |
Custom action to verify whether user has a certain privilege. |
CA_API UINT __stdcall CheckPrivilege | ( | MSIHANDLE | hInstall | ) |
Custom action to verify whether user has a certain privilege.
ComputerName | Local computer name, inherited from MSI properties. |
LOGON_USERNAME | Username |
LOGON_PRIVILEGE | Privilege, eg. SeServiceLogonRight |
The following code includes the UserPrivileges custom action binary and declares the CheckPrivilege custom action.
<CustomAction Id="CheckPrivilege" BinaryKey="UserPrivileges" DllEntry="CheckPrivilege" Execute="immediate" Return="check" /> <Binary Id="UserPrivileges" SourceFile="$(var.BinDir)\UserPrivileges.dll" />
The following code checks whether a user has logon as a service privilege.
<Control Id="Test" Type="PushButton" X="40" Y="200" Width="100" Height="17" Text="&Test Credentials"> <Publish Property="LOGON_USERNAME" Value="[SERVICE_USERNAME]" Order="1">1</Publish> <Publish Property="LOGON_PRIVILEGE" Value="SeServiceLogonRight" Order="1">1</Publish> <Publish Event="DoAction" Value="CheckPrivilege" Order="2">1</Publish> <Publish Property="LOGON_ERROR" Value="This account does not have logon as a service right. [CA_ERROR]" Order="3"><![CDATA[LOGON_HAS_PRIVILEGE = "0"]]></Publish> </Control>
This custom action supports impersonation, see Impersonation in Immediate Custom Actions.
© Application Security Inc. - All Rights Reserved | http://msiext.codeplex.com |