LookupAccountSid

  BOOL LookupAccountSidW(lpSystemName, Sid, Name, cbName, ReferencedDomainName, cbReferencedDomainName, peUser)    
  LPTSTR lpSystemName;    
  PSID Sid;    
  LPTSTR Name;    
  LPDWORD cbName;    
  LPTSTR ReferencedDomainName;    
  LPDWORD cbReferencedDomainName;    
  PSID_NAME_USE peUser;    

The LookupAccountSid function translates a passed SID into an account name and returns the name and SID of the first domain where this SID was found.

Parameters

lpSystemName

Points to a null-terminated string that specifies the system.

Sid

Points to the SID to find the account name for.

Name

Points to a buffer for the account name corresponding to Sid.

cbName

Specifies the size of the Name buffer. If the specified size is too small, the function sets this variable to the required buffer size.

ReferencedDomainName

Points to a buffer that receives the name of the domain where the name was found.

cbReferencedDomainName

Specifies the size of the ReferencedDomainName buffer. If the specified size is too small, the function sets this variable to the required buffer size.

peUser

Points to a buffer for an an enumerated type indicating the type of the account.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

See Also

LookupAccountName