RtlGuardCheckExceptionHandler

INT64 __stdcall RtlGuardCheckExceptionHandler(PVOID PcValue, INT8 a2){
  PVOID v3; 
  __int64 v4; 
  __int64 v5; 
  rsize_t v6; 
  unsigned int v7; 
  int Key; 
  PVOID BaseOfImage; 
  LOBYTE(Key) = a2;
  BaseOfImage = 0i64;
  if( (unsigned int)RtlpControlFlowGuardEnforced() )
  {
    RtlPcToFileHeader(PcValue, &BaseOfImage);
    v3 = BaseOfImage;
    if( BaseOfImage )
    {
      LODWORD(v4) = LdrImageDirectoryEntryToLoadConfig(BaseOfImage);
      v5 = v4;
      if( v4 )
      {
        if( *(_DWORD *)v4 >= 0x118u
          && (*(_DWORD *)(v4 + 144) & 0x400000) != 0
          && *(_QWORD *)(v4 + 264) > (unsigned __int64)v3 )
        {
          Key = (_DWORD)PcValue - (_DWORD)v3;
          v6 = *(_QWORD *)(v4 + 272);
          v7 = (*(_DWORD *)(v4 + 144) >> 28) + 4;
          if( !v6
            || !bsearch_s(
                  &Key,
                  *(const void **)(v5 + 264),
                  v6,
                  v7,
                  (int(__cdecl *)(void *, const void *, const void *))RtlpTargetCompare,
                  0i64) )
          {
            RtlFailFast2(38i64, PcValue);
          }
        }
      }
    }
  }
  return 0i64;
}

Referenced by:

RtlGuardRestoreContext