VOID
SeCaptureSubjectContextEx(
      __in PETHREAD Thread,
      __in PEPROCESS Process,
      __out PSECURITY_SUBJECT_CONTEXT SubjectContext
  );

Routine Description:

    This routine takes a snapshot of the calling thread's security
    context (locking tokens as necessary to do so).  This function
    is intended to support the object manager and other components
    that utilize the reference monitor's access validation,
    privilege test, and audit generation services.

    A subject's security context should be captured before initiating
    access validation and should be released after audit messages
    are generated.  This is necessary to provide a consistent security
    context to all those services.

    After calling access validation, privilege test, and audit generation
    services, the captured context should be released as soon as possible
    using the SeReleaseSubjectContext() service.

Arguments:

    Thread - Thread to capture the thread token from. If NULL we don't capture
             an impersonation token.

    Process - Process to capture primary token from.

    SubjectContext - Points to a SECURITY_SUBJECT_CONTEXT data structure
        to be filled in with a snapshot of the calling thread's security
        profile.

Return Value:

    none.