LookupAccountSidLocalA function (winbase.h)

LookupAccountSidLocalA is defined as a macro that calls LookupAccountSidA with NULL as the first parameter. Retrieves the name of the account for the specified SID on the local machine.

Syntax

BOOL LookupAccountSidLocalA(
  [in]            PSID          Sid,
  [out, optional] LPSTR         Name,
  [in, out]       LPDWORD       cchName,
  [out, optional] LPSTR         ReferencedDomainName,
  [in, out]       LPDWORD       cchReferencedDomainName,
  [out]           PSID_NAME_USE peUse
);

Parameters

[in] Sid

A pointer to the SID to look up.

[out, optional] Name

A pointer to a buffer that receives a null-terminated string that contains the account name that corresponds to the lpSid parameter.

[in, out] cchName

On input, specifies the size, in TCHARs, of the lpName buffer. If the function fails because the buffer is too small or if cchName is zero, cchName receives the required buffer size, including the terminating null character.

[out, optional] ReferencedDomainName

A pointer to a buffer that receives a null-terminated string that contains the name of the domain where the account name was found.

On a server, the domain name returned for most accounts in the security database of the local computer is the name of the domain for which the server is a domain controller.

On a workstation, the domain name returned for most accounts in the security database of the local computer is the name of the computer as of the last start of the system (backslashes are excluded). If the name of the computer changes, the old name continues to be returned as the domain name until the system is restarted.

Some accounts are predefined by the system. The domain name returned for these accounts is BUILTIN.

[in, out] cchReferencedDomainName

On input, specifies the size, in TCHARs, of the lpReferencedDomainName buffer. If the function fails because the buffer is too small or if cchReferencedDomainName is zero, cchReferencedDomainName receives the required buffer size, including the terminating null character.

[out] peUse

A pointer to a variable that receives a SID_NAME_USE value that indicates the type of the account.

Return value

If the function succeeds, the function returns nonzero.

If the function fails, it returns zero. To get extended error information, call GetLastError.

Remarks

This function is similar to LookupAccountSid, but restricts the search to the local machine.

Note

The winbase.h header defines LookupAccountSidLocal as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)

See also

Access Control Overview

Basic Access Control Functions

EqualPrefixSid

LookupAccountName

SID

SID_NAME_USE