System.Security.CodeAccessSecurityEngine.Check C# (CSharp) Method

Check() static private method

static private Check ( CodeAccessPermission cap, System.Threading.StackCrawlMark &stackMark ) : void
cap CodeAccessPermission
stackMark System.Threading.StackCrawlMark
return void
        internal static void Check(CodeAccessPermission cap, ref StackCrawlMark stackMark)
        {
            Check(cap,
                  ref stackMark,
                  false);
        }

Same methods

CodeAccessSecurityEngine::Check ( Object demand, System.Threading.StackCrawlMark &stackMark, bool isPermSet ) : void
CodeAccessSecurityEngine::Check ( PermissionSet permSet, System.Threading.StackCrawlMark &stackMark ) : void

Usage Example

Example #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);
            }
        }
All Usage Examples Of System.Security.CodeAccessSecurityEngine::Check