System.Security.Principal.Win32.IsEqualDomainSid C# (CSharp) Method

IsEqualDomainSid() static private method

static private IsEqualDomainSid ( System.Security.Principal.SecurityIdentifier sid1, System.Security.Principal.SecurityIdentifier sid2 ) : bool
sid1 System.Security.Principal.SecurityIdentifier
sid2 System.Security.Principal.SecurityIdentifier
return bool
        internal static bool IsEqualDomainSid(SecurityIdentifier sid1, SecurityIdentifier sid2)
        {
            if (sid1 == null || sid2 == null)
            {
                return false;
            }
            else
            {
                bool result;

                byte[] BinaryForm1 = new Byte[sid1.BinaryLength];
                sid1.GetBinaryForm(BinaryForm1, 0);

                byte[] BinaryForm2 = new Byte[sid2.BinaryLength];
                sid2.GetBinaryForm(BinaryForm2, 0);

                return (Interop.Advapi32.IsEqualDomainSid(BinaryForm1, BinaryForm2, out result) == FALSE ? false : result);
            }
        }

Usage Example

Beispiel #1
0
        //
        // NOTE: although there is a P/Invoke call involved in the implementation of this method,
        //       there is no security risk involved, so no security demand is being made.
        //


        public bool IsEqualDomainSid(SecurityIdentifier sid)
        {
            return(Win32.IsEqualDomainSid(this, sid));
        }