Check() static private method

static private Check ( CodeAccessPermission cap, System.Threading.StackCrawlMark &stackMark ) : void
cap CodeAccessPermission
stackMark System.Threading.StackCrawlMark
return void
Ejemplo n.º 1
0
        internal static void DemandInternal(PermissionType permissionType)
        {
            CodeAccessSecurityEngine codeAccessSE =
                (CodeAccessSecurityEngine)SecurityManager.GetCodeAccessSecurityEngine();

            if (commonSecObj == null)
            {
                // These correspond to SharedPermissionObjects in security.h, that is instances of commonly needed
                // permissions. From managed code, we regularly need Serialization and reflection emit permission.
                // The enum which acts as index into this array is same in EE and BCL. Thats why first 5 entries are null.

                // There is no synchronization on this call since the worse thing
                // that happens is that we create it multiple times (assuming that
                // assignment is atomic).

                commonSecObj =
                    new CodeAccessPermission[] {
                    null,       // Unmanaged code access permission
                    null,       // Skip verification permission
                    null,       // Reflection type info permission
                    null,       // Assert permission
                    null,       // Reflection member access permission
                    new SecurityPermission(SecurityPermissionFlag.SerializationFormatter),
                    new ReflectionPermission(ReflectionPermissionFlag.ReflectionEmit)
                };
            }

            BCLDebug.Assert(commonSecObj[(int)permissionType] != null, "Uninitialized commonSecObj in CodeAccessPermission");

            if (codeAccessSE != null)
            {
                StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
                codeAccessSE.Check(commonSecObj[(int)permissionType], ref stackMark, permissionType);
            }
        }
 public void Demand()
 {
     if (!this.CheckDemand(null))
     {
         StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
         CodeAccessSecurityEngine.Check(this, ref stackMark);
     }
 }
Ejemplo n.º 3
0
        public void Demand()
        {
            if (this.CheckDemand((CodeAccessPermission)null))
            {
                return;
            }
            StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;

            CodeAccessSecurityEngine.Check(this, ref stackMark);
        }
Ejemplo n.º 4
0
        public void Demand()
        {
            CodeAccessSecurityEngine icase =
                SecurityManager.GetCodeAccessSecurityEngine();

            if (icase != null && !this.IsSubsetOf(null))
            {
                StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
                icase.Check(this, ref stackMark);
            }
        }
Ejemplo n.º 5
0
 internal static void Check(PermissionSet permSet, ref StackCrawlMark stackMark)
 {
     CodeAccessSecurityEngine.Check(permSet, ref stackMark, true);
 }
Ejemplo n.º 6
0
 internal static void Check(CodeAccessPermission cap, ref StackCrawlMark stackMark)
 {
     CodeAccessSecurityEngine.Check(cap, ref stackMark, false);
 }