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); } }
public void Demand() { if (this.CheckDemand((CodeAccessPermission)null)) { return; } StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller; CodeAccessSecurityEngine.Check(this, ref stackMark); }
public void Demand() { CodeAccessSecurityEngine icase = SecurityManager.GetCodeAccessSecurityEngine(); if (icase != null && !this.IsSubsetOf(null)) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller; icase.Check(this, ref stackMark); } }
internal static void Check(PermissionSet permSet, ref StackCrawlMark stackMark) { CodeAccessSecurityEngine.Check(permSet, ref stackMark, true); }
internal static void Check(CodeAccessPermission cap, ref StackCrawlMark stackMark) { CodeAccessSecurityEngine.Check(cap, ref stackMark, false); }