ConvertStringSidToSidW function (sddl.h)
The ConvertStringSidToSid function converts a string-format security identifier (SID) into a valid, functional SID. You can use this function to retrieve a SID that the ConvertSidToStringSid function converted to string format.
Syntax
BOOL ConvertStringSidToSidW(
[in] LPCWSTR StringSid,
[out] PSID *Sid
);
Parameters
[in] StringSid
A pointer to a null-terminated string containing the string-format SID to convert.
The SID string can use either the standard S-R-I-S-S… format for SID strings, or the SID string constant format, such as "BA" for built-in administrators. For more information about SID string notation, see SID Components.
[out] Sid
A pointer to a variable that receives a pointer to the converted SID. To free the returned buffer, call the LocalFree function.
Return value
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. The GetLastError function may return one of the following error codes.
Return code | Description |
---|---|
|
Invalid parameter. |
|
Invalid SID. |
Remarks
Note
The sddl.h header defines ConvertStringSidToSid as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | sddl.h |
Library | Advapi32.lib |
DLL | Advapi32.dll |
See also
Basic Access Control Functions
ConvertSecurityDescriptorToStringSecurityDescriptor