Group: Security - Library: advapi32
The LookupAccountSid function accepts a security identifier (SID) as input. It retrieves the name of the account for this SID and the name of the first domain on which this SID is found.
GetFileOwner - Get the owner of an NTFS file
Reading security permissions for NTFS files and folders
How to enumerate sessions and processes on a specified terminal server
BOOL LookupAccountSid(
LPCTSTR lpSystemName,
PSID lpSid,
LPTSTR lpName,
LPDWORD cchName,
LPTSTR lpReferencedDomainName,
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse
);
DECLARE INTEGER LookupAccountSid IN advapi32;
STRING @ lpSystemName,;
INTEGER lpSid,;
STRING @ lpName,;
INTEGER @ cchName,;
STRING @ lpRefdDomain,;
INTEGER @ cchRefdDomain,;
INTEGER @ peUse
lpSystemName [in] Pointer to a null-terminated character string that specifies the target computer.
lpSid [in] Pointer to the SID to look up.
lpName [out] Pointer to a buffer that receives a null-terminated string that contains the account name that corresponds to the lpSid parameter.
cchName [in, out] On input, specifies the size, in TCHARs, of the lpName buffer.
cchReferencedDomainName [in, out] On input, specifies the size, in TCHARs, of the lpReferencedDomainName buffer.
peUse [out] Pointer to a variable 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.