LookupSid function

Retrieve the domain and account names associated with a Windows security identifier (SID) and store them in a pair of variables. This is useful if you need to obtain the possibly localized account name of a security principal.

The LookupSid function is a predefined extension DLL function that is distributed with InstallMate. You can use this function by adding a Run DLL action to the action sequence in which you want to run the action. Set the Run DLL action attributes as follows:

Arguments

The LookupSid function expects the following arguments. All arguments may contain symbolic references; these will be resolved before the function is called. Note that you must "quote" an argument if it contains spaces, or if it could contain spaces after expansion of symbolic references.

SID_or_abbreviation
The security identifier (SID) of the account to look up, or a well-known abbreviation for it. Examples of SIDs are: S-1-1-0 (Everyone), S-1-5-32-545 (the local Users group), S-1-5-32-544 (the local Administrators group), or S-1-5-21-2573920351-7182930281-6493610253-1001 (a user on the specific computer). Examples of well-known abbreviations are: BA (the built-in Administrators group), BU (built-in Users group), or LA (the local Administrator account). For a full list of well-known abbreviations, see SID Strings on the MSDN web site.
domvar
Name of the symbolic variable that will receive the domain or machine name associated with the SID. If the SID cannot be found, the value of this variable is left unchanged.
accountvar
Name of the symbolic variable that will receive the account name associated with the SID. If the SID cannot be found, the value of this variable is left unchanged.

Return value

Returns ERROR_SUCCESS (zero) if successful, else a nonzero error code. This error code is available in the LastExitCode variable.

Remarks

To use this function, you must add the extension DLL to your InstallMate project. The easiest way to do so is as follows:

  1. Open your InstallMate project.
  2. Choose File > Import > Project Items... from the main menu bar.
  3. Browse for and select the file Insert Extension DLL.imq, then click Open.

Alternatively, you can go to the Installer options page in your InstallMate project, click on the Advanced... button, then click on the Extension DLL tab and enter the paths to the extension DLL versions there.