private static SecurityContext CaptureCore(ExecutionContext.Reader currThreadEC, ref StackCrawlMark stackMark)
{
SecurityContext securityContext = new SecurityContext();
securityContext.isNewCapture = true;
if (!SecurityContext.IsWindowsIdentityFlowSuppressed())
{
WindowsIdentity currentWI = SecurityContext.GetCurrentWI(currThreadEC);
if (currentWI != null)
{
securityContext._windowsIdentity = new WindowsIdentity(currentWI.AccessToken);
}
}
else
{
securityContext._disableFlow = SecurityContextDisableFlow.WI;
}
securityContext.CompressedStack = CompressedStack.GetCompressedStack(ref stackMark);
return(securityContext);
}