RtlInitializeSid
C# Signature:
[DllImport("ntdll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
private static extern Int32 RtlInitializeSid([In, Out] ref SID Sid, [In] ref SID_IDENTIFIER_AUTHORITY IdentifierAuthority, byte SubAuthorityCount);VB Signature:
Declare Function RtlInitializeSid Lib "ntdll.dll" (TODO) As TODOUser-Defined Types:
[StructLayout(LayoutKind.Sequential, Size = 6)]
struct SID_IDENTIFIER_AUTHORITY
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] Value;
public SID_IDENTIFIER_AUTHORITY(byte[] value)
{
if (value.Length != 6)
throw new ArgumentOutOfRangeException("value", "Value must be an array of 6 bytes.");
this.Value = value;
}
}
[StructLayout(LayoutKind.Sequential)]
struct SID
{
public byte Revision;
public byte SubAuthorityCount;
public SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
public UInt32[] SubAuthority;
public SID(int subAuthorityCount)
{
this.Revision = 0;
this.SubAuthorityCount = 0;
this.IdentifierAuthority = default(SID_IDENTIFIER_AUTHORITY);
this.SubAuthority = new UInt32[subAuthorityCount];
}
}Sample Code:
Última actualización