1 out of 2 rated this helpful - Rate this topic

ConvertStringSidToSid function

Applies to: desktop apps only

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 WINAPI ConvertStringSidToSid(
  __in   LPCTSTR StringSid,
  __out  PSID *Sid
);

Parameters

StringSid [in]

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.

Sid [out]

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 codeDescription
ERROR_INVALID_PARAMETER

Invalid parameter.

ERROR_INVALID_SID

Invalid SID.

 

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Sddl.h

Library

Advapi32.lib

DLL

Advapi32.dll

Unicode and ANSI names

ConvertStringSidToSidW (Unicode) and ConvertStringSidToSidA (ANSI)

See also

Access Control
Basic Access Control Functions
ConvertSecurityDescriptorToStringSecurityDescriptor
ConvertSidToStringSid
ConvertStringSecurityDescriptorToSecurityDescriptor
SID

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
C# Syntax
$0[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]$0 $0internal static extern void ConvertStringSidToSid([In, MarshalAs(UnmanagedType.LPTStr)] string StringSid, [Out] out IntPtr Sid);$0