ConvertIntPtrSidToByteArraySid() static private method

static private ConvertIntPtrSidToByteArraySid ( IntPtr binaryForm ) : byte[]
binaryForm System.IntPtr
return byte[]
        internal static int CreateSidFromString(string stringSid, out byte[] resultSid)
        {
            IntPtr zero = IntPtr.Zero;
            int    lastWin32Error;

            try
            {
                if (1 != Win32Native.ConvertStringSidToSid(stringSid, out zero))
                {
                    lastWin32Error = Marshal.GetLastWin32Error();
                    goto IL_2D;
                }
                resultSid = Win32.ConvertIntPtrSidToByteArraySid(zero);
            }
            finally
            {
                Win32Native.LocalFree(zero);
            }
            return(0);

IL_2D:
            resultSid = null;
            return(lastWin32Error);
        }
Beispiel #2
0
 internal SecurityIdentifier(IntPtr binaryForm, bool noDemand)
     : this(Win32.ConvertIntPtrSidToByteArraySid(binaryForm), 0)
 {
 }
Beispiel #3
0
        //
        // Constructs a SecurityIdentifier object from an IntPtr
        //

        public SecurityIdentifier(IntPtr binaryForm)
            : this(Win32.ConvertIntPtrSidToByteArraySid(binaryForm), 0)
        {
        }