Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than advapi32, prefix the name with the module name and a period.
pSid = Marshal.AllocCoTaskMem(Convert.ToInt32(cbSid));
if (NativeMethods.CreateWellKnownSid(wellKnownSidType, domainSid, pSid, ref cbSid))
{
NativeMethods.ConvertSidToStringSid(pSid, out sidString);
}
Marshal.FreeCoTaskMem(pSid);
return sidString;
}
VB.Net Sample Code:
Private WinWorldSid As Integer = 1
Private SECURITY_MAX_SID_SIZE As Integer = 68
' build a well-known SID for "Everyone"
sidsize = SECURITY_MAX_SID_SIZE
EveryoneSID = Marshal.AllocHGlobal(sidsize)
If CreateWellKnownSid(WinWorldSid, IntPtr.Zero, EveryoneSID, sidsize) = False Then
ret = Marshal.GetLastWin32Error()
Throw New Win32Exception(ret)
End If
Alternative Managed API:
using System.Security.Principal;
var sid = new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null).ToString();
Indicates a well-known SID that can be created through CreateWellKnownSid.
4/15/2008 7:26:05 AM - anfortas.geo@yahoo.com-216.204.61.86
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).