LookupAccountSidLocalW function (winbase.h)
Retrieves the name of the account for the specified SID on the local machine.
BOOL LookupAccountSidLocalW( [in] PSID Sid, [out, optional] LPWSTR Name, [in, out] LPDWORD cchName, [out, optional] LPWSTR ReferencedDomainName, [in, out] LPDWORD cchReferencedDomainName, [out] PSID_NAME_USE peUse );
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.
A pointer to a variable that receives a SID_NAME_USE value that indicates the type of the account.
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. To get extended error information, call GetLastError.
This function is similar to LookupAccountSid, but restricts the search to the local machine.
The winbase.h header defines LookupAccountSidLocal as an alias which 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 not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|Header||winbase.h (include Windows.h)|