Platform SDK: Access Control

ConvertStringSidToSid

The ConvertStringSidToSid function converts a string-format SID into a valid, functional SID. You can use this function to retrieve a SID that the ConvertSidToStringSid function converted to string format.

BOOL ConvertStringSidToSid(
  LPCTSTR StringSid,  // SID string
  PSID *Sid           // SID 
);

Parameters

StringSid
[in] Pointer to a null-terminated string containing the string-format SID to convert.

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

Sid
[out] Pointer to a variable that receives a pointer to the converted SID. 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_INVALID_PARAMETER Invalid parameter.
ERROR_INVALID_SID Invalid SID.

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, ConvertSidToStringSid, ConvertStringSecurityDescriptorToSecurityDescriptor, SID