LookupAccountName

  BOOL LookupAccountName(lpSystemName, lpAccountName, Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUser)    
  LPTSTR lpSystemName;    
  LPTSTR lpAccountName;    
  PSID Sid;    
  LPDWORD cbSid;    
  LPTSTR ReferencedDomainName;    
  LPDWORD cchReferencedDomainName;    
  PSID_NAME_USE peUser;    

The LookupAccountName function translates a passed name into an account SID. It also returns the name and SID of the first domain in which this name was found.

Parameters

lpSystemName

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

lpAccountName

Points to a null-terminated string that specifies the account name.

Sid

Points to a buffer that receives the SID corresponding to the passed account name.

cbSid

Specifies the size of the SID 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.

cchReferencedDomainName

Specifies the size of the ReferencedDomainName buffer in characters. 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

LookupAccountSid