Platform SDK: Access Control

ConvertSidToStringSid

The ConvertSidToStringSid function converts a SID to a string format suitable for display, storage, or transmission.

To convert the string-format SID back to a valid, functional SID, call the ConvertStringSidToSid function.

BOOL ConvertSidToStringSid(
  PSID Sid,          // SID
  LPTSTR *StringSid  // SID string
);

Parameters

Sid
[in] Pointer to the SID to convert.
StringSid
[out] Pointer to a variable that receives a pointer to a null-terminated SID string. To free the returned buffer, call the LocalFree function.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes.

Error Code Meaning
ERROR_NOT_ENOUGH_MEMORY Insufficient memory.
ERROR_NONE_MAPPED The SID could not be found in an account lookup operation.

Remarks

The ConvertSidToStringSid function uses the standard S-R-I-S-S... format for SID strings. For more information about SID string notation, see SID Components.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Sddl.h.
  Library: Use Advapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

Access Control Overview, Access Control Functions, ConvertSecurityDescriptorToStringSecurityDescriptor, ConvertStringSecurityDescriptorToSecurityDescriptor, ConvertStringSidToSid, SID