Example #1
0
 internal ForestTrustRelationshipCollision(ForestTrustCollisionType collisionType, TopLevelNameCollisionOptions TLNFlag, DomainCollisionOptions domainFlag, string record)
 {
     CollisionType = collisionType;
     TopLevelNameCollisionOption = TLNFlag;
     DomainCollisionOption       = domainFlag;
     CollisionRecord             = record;
 }
Example #2
0
 internal ForestTrustRelationshipCollision(ForestTrustCollisionType collisionType, TopLevelNameCollisionOptions TLNFlag, DomainCollisionOptions domainFlag, string record)
 {
     this.type       = collisionType;
     this.tlnFlag    = TLNFlag;
     this.domainFlag = domainFlag;
     this.record     = record;
 }
 internal ForestTrustRelationshipCollision(ForestTrustCollisionType collisionType, TopLevelNameCollisionOptions TLNFlag, DomainCollisionOptions domainFlag, string record)
 {
     this.type = collisionType;
     this.tlnFlag = TLNFlag;
     this.domainFlag = domainFlag;
     this.record = record;
 }
Example #4
0
        internal static Exception CreateForestTrustCollisionException(IntPtr collisionInfo)
        {
            ForestTrustRelationshipCollisionCollection collisions = new ForestTrustRelationshipCollisionCollection();
            LSA_FOREST_TRUST_COLLISION_INFORMATION     structure  = new LSA_FOREST_TRUST_COLLISION_INFORMATION();

            Marshal.PtrToStructure(collisionInfo, structure);
            int    recordCount = structure.RecordCount;
            IntPtr zero        = IntPtr.Zero;

            for (int i = 0; i < recordCount; i++)
            {
                zero = Marshal.ReadIntPtr(structure.Entries, i * Marshal.SizeOf(typeof(IntPtr)));
                LSA_FOREST_TRUST_COLLISION_RECORD lsa_forest_trust_collision_record = new LSA_FOREST_TRUST_COLLISION_RECORD();
                Marshal.PtrToStructure(zero, lsa_forest_trust_collision_record);
                ForestTrustCollisionType collisionType = lsa_forest_trust_collision_record.Type;
                string record = Marshal.PtrToStringUni(lsa_forest_trust_collision_record.Name.Buffer, lsa_forest_trust_collision_record.Name.Length / 2);
                TopLevelNameCollisionOptions none       = TopLevelNameCollisionOptions.None;
                DomainCollisionOptions       domainFlag = DomainCollisionOptions.None;
                switch (collisionType)
                {
                case ForestTrustCollisionType.TopLevelName:
                    none = (TopLevelNameCollisionOptions)lsa_forest_trust_collision_record.Flags;
                    break;

                case ForestTrustCollisionType.Domain:
                    domainFlag = (DomainCollisionOptions)lsa_forest_trust_collision_record.Flags;
                    break;
                }
                ForestTrustRelationshipCollision collision = new ForestTrustRelationshipCollision(collisionType, none, domainFlag, record);
                collisions.Add(collision);
            }
            return(new ForestTrustCollisionException(Res.GetString("ForestTrustCollision"), null, collisions));
        }
Example #5
0
        internal static Exception CreateForestTrustCollisionException(IntPtr collisionInfo)
        {
            ForestTrustRelationshipCollisionCollection forestTrustRelationshipCollisionCollection = new ForestTrustRelationshipCollisionCollection();
            LSA_FOREST_TRUST_COLLISION_INFORMATION     lSAFORESTTRUSTCOLLISIONINFORMATION         = new LSA_FOREST_TRUST_COLLISION_INFORMATION();

            Marshal.PtrToStructure(collisionInfo, lSAFORESTTRUSTCOLLISIONINFORMATION);
            int recordCount = lSAFORESTTRUSTCOLLISIONINFORMATION.RecordCount;

            for (int i = 0; i < recordCount; i++)
            {
                IntPtr intPtr = Marshal.ReadIntPtr(lSAFORESTTRUSTCOLLISIONINFORMATION.Entries, i * Marshal.SizeOf(typeof(IntPtr)));
                LSA_FOREST_TRUST_COLLISION_RECORD lSAFORESTTRUSTCOLLISIONRECORD = new LSA_FOREST_TRUST_COLLISION_RECORD();
                Marshal.PtrToStructure(intPtr, lSAFORESTTRUSTCOLLISIONRECORD);
                ForestTrustCollisionType type = lSAFORESTTRUSTCOLLISIONRECORD.Type;
                string stringUni = Marshal.PtrToStringUni(lSAFORESTTRUSTCOLLISIONRECORD.Name.Buffer, lSAFORESTTRUSTCOLLISIONRECORD.Name.Length / 2);
                TopLevelNameCollisionOptions flags = TopLevelNameCollisionOptions.None;
                DomainCollisionOptions       domainCollisionOption = DomainCollisionOptions.None;
                if (type != ForestTrustCollisionType.TopLevelName)
                {
                    if (type == ForestTrustCollisionType.Domain)
                    {
                        domainCollisionOption = (DomainCollisionOptions)lSAFORESTTRUSTCOLLISIONRECORD.Flags;
                    }
                }
                else
                {
                    flags = (TopLevelNameCollisionOptions)lSAFORESTTRUSTCOLLISIONRECORD.Flags;
                }
                ForestTrustRelationshipCollision forestTrustRelationshipCollision = new ForestTrustRelationshipCollision(type, flags, domainCollisionOption, stringUni);
                forestTrustRelationshipCollisionCollection.Add(forestTrustRelationshipCollision);
            }
            ForestTrustCollisionException forestTrustCollisionException = new ForestTrustCollisionException(Res.GetString("ForestTrustCollision"), null, forestTrustRelationshipCollisionCollection);

            return(forestTrustCollisionException);
        }
Example #6
0
        internal static Exception CreateForestTrustCollisionException(IntPtr collisionInfo)
        {
            ForestTrustRelationshipCollisionCollection collection = new ForestTrustRelationshipCollisionCollection();
            LSA_FOREST_TRUST_COLLISION_INFORMATION     collision  = new LSA_FOREST_TRUST_COLLISION_INFORMATION();

            Marshal.PtrToStructure(collisionInfo, collision);

            int    count = collision.RecordCount;
            IntPtr addr  = (IntPtr)0;

            for (int i = 0; i < count; i++)
            {
                addr = Marshal.ReadIntPtr(collision.Entries, i * IntPtr.Size);
                LSA_FOREST_TRUST_COLLISION_RECORD record = new LSA_FOREST_TRUST_COLLISION_RECORD();
                Marshal.PtrToStructure(addr, record);

                ForestTrustCollisionType type           = record.Type;
                string recordName                       = Marshal.PtrToStringUni(record.Name.Buffer, record.Name.Length / 2);
                TopLevelNameCollisionOptions TLNFlag    = TopLevelNameCollisionOptions.None;
                DomainCollisionOptions       domainFlag = DomainCollisionOptions.None;
                if (type == ForestTrustCollisionType.TopLevelName)
                {
                    TLNFlag = (TopLevelNameCollisionOptions)record.Flags;
                }
                else if (type == ForestTrustCollisionType.Domain)
                {
                    domainFlag = (DomainCollisionOptions)record.Flags;
                }
                ForestTrustRelationshipCollision tmp = new ForestTrustRelationshipCollision(type, TLNFlag, domainFlag, recordName);
                collection.Add(tmp);
            }

            ForestTrustCollisionException exception = new ForestTrustCollisionException(SR.ForestTrustCollision, null, collection);

            return(exception);
        }