System.Security.SecurityRuntime.GetSecurityObjectForFrame C# (CSharp) Method

GetSecurityObjectForFrame() private method

private GetSecurityObjectForFrame ( System.Threading.StackCrawlMark &stackMark, bool create ) : FrameSecurityDescriptor
stackMark System.Threading.StackCrawlMark
create bool
return FrameSecurityDescriptor
        FrameSecurityDescriptor GetSecurityObjectForFrame(ref StackCrawlMark stackMark,
                                                          bool create);

Usage Example

        [System.Security.SecurityCritical]  // auto-generated
        internal static void Deny(CodeAccessPermission cap, ref StackCrawlMark stackMark)
        {
#if FEATURE_CAS_POLICY
            // Deny is only valid in legacy mode
            if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
            {
                throw new NotSupportedException(Environment.GetResourceString("NotSupported_CasDeny"));
            }
#endif // FEATURE_CAS_POLICY

            FrameSecurityDescriptor secObj =
                SecurityRuntime.GetSecurityObjectForFrame(ref stackMark, true);
            if (secObj == null)
            {
                // Security: REQ_SQ flag is missing. Bad compiler ?
                // This can happen when you create delegates over functions that need the REQ_SQ
                System.Environment.FailFast(Environment.GetResourceString("ExecutionEngine_MissingSecurityDescriptor"));
            }
            else
            {
                if (secObj.HasImperativeDenials())
                {
                    throw new SecurityException(Environment.GetResourceString("Security_MustRevertOverride"));
                }

                secObj.SetDeny(cap);
            }
        }
All Usage Examples Of System.Security.SecurityRuntime::GetSecurityObjectForFrame