ConvertStringSidToSid (advapi32)
Last changed: Hi-79.202.51.48

.
Summary
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.

C# Signature:

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern bool ConvertStringSidToSid(string StringSid, out IntPtr ptrSid);

VB Signature:

Private Declare  Auto Function ConvertStringSidToSid Lib "advapi32.dll" (ByVal sStringSid as String, ByRef psid As IntPtr) as Boolean

User-Defined Types:

None.

Notes:

The returned SID must be freed with LocalFree.

Tips & Tricks:

Please add some!

Sample Code:

Dim pSID As IntPtr = IntPtr.Zero

ConvertStringSidToSid(sSid, pSID)

Alternative Managed API:

Do you know one? Please contribute it!

Documentation