Go to the source code of this file.
Functions | |
CA_API UINT __stdcall | CheckCredentials (MSIHANDLE hInstall) |
Custom action to verify whether user logon credentials are valid via ::LogonUser. |
CA_API UINT __stdcall CheckCredentials | ( | MSIHANDLE | hInstall | ) |
Custom action to verify whether user logon credentials are valid via ::LogonUser.
LOGON_USERNAME | Username |
LOGON_PASSWORD | Password |
LOGON_TYPE | Type of logon, default is LOGON32_LOGON_NETWORK |
The following code includes the UserPrivileges custom actoin binary and declares the CheckCredentials custom action.
<CustomAction Id="CheckCredentials" BinaryKey="UserPrivileges" DllEntry="CheckCredentials" Execute="immediate" Return="check" /> <Binary Id="UserPrivileges" SourceFile="$(var.BinDir)\UserPrivileges.dll" />
The following code checks user credentials.
<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_PASSWORD" Value="[SERVICE_PASSWORD]" Order="1">1</Publish> <Publish Event="DoAction" Value="CheckCredentials" Order="2">1</Publish> <Publish Property="LOGON_VALID" Value="[LOGON_VALID]" Order="3">1</Publish> <Publish Property="LOGON_ERROR" Value="Invalid Logon" Order="3"><![CDATA[LOGON_ERROR = "" AND LOGON_VALID = "0"]]></Publish> </Control>
The LOGON_VALID and LOGON_ERROR properties are helpful to trigger an error dialog where appropriate.
<Dialog Id="InvalidLogonDlg" Width="260" Height="85" Title="Invalid Logon"> <Control Id="Return" Type="PushButton" X="102" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK"> <Publish Event="EndDialog" Value="Return">1</Publish> </Control> <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" Text="[LOGON_ERROR]" /> <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Exclam" /> </Dialog>
<Control Id="Test" Type="PushButton" X="40" Y="200" Width="100" Height="17" Text="&Test Credentials"> ... <Publish Event="SpawnDialog" Value="InvalidLogonDlg" Order="8"><![CDATA[LOGON_VALID = "0"]></Publish> </Control>
This custom action supports impersonation, see Impersonation in Immediate Custom Actions.
© Application Security Inc. - All Rights Reserved | http://msiext.codeplex.com |