SepIsMinTCB

INT64 __fastcall SepIsMinTCB(
        const _UNICODE_STRING *ImagePath,
        UINT64 Flags,
        _PS_PROTECTION RequestedProtection,
        UINT8 *ExeSigningLevel,
        UINT8 *DllSigningLevel,
        _PS_PROTECTION *Protection){
  char v6; 
  char v8; 
  _EJOB *CurrentServerSilo; 
  __int64 *ServerSiloGlobals; 
  __int16 *v12; 
  unsigned int v13; 
  __int16 v14; 
  __int64 Length; 
  wchar_t *Buffer; 
  int IsImageInMinTcbList; 
  UNICODE_STRING v19; 
  unsigned __int8 *v20; 
  v6 = (char)ExeSigningLevel;
  v19 = 0i64;
  v8 = Flags;
  CurrentServerSilo = PsGetCurrentServerSilo();
  ServerSiloGlobals = PsGetServerSiloGlobals((__int64)CurrentServerSilo);
  if( !_InterlockedCompareExchange64(ServerSiloGlobals + 96, 0i64, 0i64) )
  {
    IsImageInMinTcbList = SepSetSystemPaths();
    if( IsImageInMinTcbList < 0 )
      return(unsigned int)IsImageInMinTcbList;
  }
  if( !ImagePath )
    return(unsigned int)-1073741275;
  v12 = (__int16 *)ServerSiloGlobals[96];
  v13 = 42;
  v14 = *v12;
  if( (unsigned __int16)*v12 < 0x2Au )
    v13 = (unsigned __int16)*v12;
  Length = ImagePath->Length;
  if( (unsigned int)Length <= v13 )
    return(unsigned int)-1073741275;
  Buffer = ImagePath->Buffer;
  if( Buffer[1] == 63 )
  {
    if( !(unsigned __int8)RtlPrefixUnicodeString(v12, (INT64 *)ImagePath)
      && !(unsigned __int8)RtlPrefixUnicodeString(v12 + 8, (INT64 *)ImagePath) )
    {
      return(unsigned int)-1073741275;
    }
  }
  else
  {
    if( !(unsigned __int8)RtlPrefixUnicodeString((PVOID)&stru_140001188, (INT64 *)ImagePath)
      && !(unsigned __int8)RtlPrefixUnicodeString((PVOID)&stru_140009700, (INT64 *)ImagePath) )
    {
      return(unsigned int)-1073741275;
    }
    v14 = 42;
  }
  v19.Length = Length - v14;
  v19.MaximumLength = Length - v14;
  v19.Buffer = &Buffer[(Length - (unsigned __int64)(unsigned __int16)(Length - v14)) >> 1];
  IsImageInMinTcbList = SepIsImageInMinTcbList(
                          (__int64)&SeMsMinTCBList,
                          0x10u,
                          &v19,
                          v8,
                          RequestedProtection.Level,
                          v6,
                          (char *)DllSigningLevel,
                          (char *)Protection,
                          v20);
  if( IsImageInMinTcbList < 0
    && (SeCiDebugOptions & 1) == 0
    && (_BYTE)KdDebuggerEnabled
    && !(_BYTE)KdDebuggerNotPresent )
  {
    return(unsigned int)SepIsImageInMinTcbList(
                           (__int64)L" \"",
                           9u,
                           &v19,
                           v8,
                           RequestedProtection.Level,
                           v6,
                           (char *)DllSigningLevel,
                           (char *)Protection,
                           v20);
  }
  return(unsigned int)IsImageInMinTcbList;
}

Referenced by:

SeQuerySigningPolicy