Пример #1
0
 internal void ToNative(PinCollection pinCollection, out NativeTypes.FABRIC_SECURITY_ACE nativeAce)
 {
     nativeAce.AccessMask = (uint)this.AccessMask;
     nativeAce.AceType    = (NativeTypes.FABRIC_SECURITY_ACE_TYPE) this.AceType;
     nativeAce.Principal  = this.Principal.ToNative(pinCollection);
     nativeAce.Reserved   = IntPtr.Zero;
 }
Пример #2
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeAceArray = new NativeTypes.FABRIC_SECURITY_ACE[this.AceItems.Count];

            for (int i = 0; i < this.AceItems.Count; ++i)
            {
                this.AceItems[i].ToNative(pinCollection, out nativeAceArray[i]);
            }

            var nativeAcl = new NativeTypes.FABRIC_SECURITY_ACL();

            nativeAcl.AceCount = (uint)nativeAceArray.Length;
            nativeAcl.AceItems = pinCollection.AddBlittable(nativeAceArray);
            nativeAcl.Reserved = IntPtr.Zero;

            return(pinCollection.AddBlittable(nativeAcl));
        }
Пример #3
0
        internal static unsafe Ace FromNative(NativeTypes.FABRIC_SECURITY_ACE nativeAce)
        {
            var principal  = PrincipalIdentifier.FromNative((NativeTypes.FABRIC_SECURITY_PRINCIPAL_IDENTIFIER *)nativeAce.Principal);
            var accessMask = (AccessMask)nativeAce.AccessMask;
            var aceType    = (AceType)nativeAce.AceType;

            if (aceType == AceType.Allowed)
            {
                return(new AllowedAce(principal, accessMask));
            }
            else
            {
                AppTrace.TraceSource.WriteError(
                    "Ace.FromNative",
                    "Unknown FABRIC_SECURITY_ACE_TYPE : {0}",
                    nativeAce.AceType);
                throw new ArgumentOutOfRangeException("FABRIC_SECURITY_ACE.AceType");
            }
        }