RtlCheckBootStatusIntegrity

NTSTATUS __stdcall RtlCheckBootStatusIntegrity(_HANDLE FileHandle){
  bool *v1; 
  bool *v2; 
  char v4; 
  NTSTATUS v5; 
  VOID **Buffer; 
  __int64 v7; 
  _BYTE *v8; 
  int v10; 
  _LARGE_INTEGER ByteOffset; 
  _IO_STATUS_BLOCK IoStatusBlock; 
  UINT64 NumberOfBytes; 
  int v14; 

  v14 = 0;
  v2 = v1;
  v10 = 0;
  LODWORD(NumberOfBytes) = 0;
  ByteOffset.QuadPart = 0i64;
  v4 = 0;
  IoStatusBlock = 0i64;
  v5 = ZwReadFile(FileHandle, 0, 0i64, 0i64, &IoStatusBlock, &NumberOfBytes, 4u, &ByteOffset, 0i64);
  if( v5 >= 0 )
  {
    v5 = RtlBootStatusItemInfo(15, &v14, &v10);
    if( v5 >= 0 )
    {
      if( (unsigned int)NumberOfBytes < v14 + v10 || (unsigned int)NumberOfBytes > 0x800 )
      {
        *v2 = 0;
      }
      else
      {
        Buffer = ExAllocatePoolWithTag(1ui64, (unsigned int)NumberOfBytes, 1717859170i64);
        if( Buffer )
        {
          v5 = ZwReadFile(FileHandle, 0, 0i64, 0i64, &IoStatusBlock, Buffer, NumberOfBytes, &ByteOffset, 0i64);
          if( v5 >= 0 )
          {
            v7 = (unsigned int)NumberOfBytes;
            if( IoStatusBlock.Information == (unsigned int)NumberOfBytes )
            {
              if( (_DWORD)NumberOfBytes )
              {
                v8 = Buffer;
                do
                {
                  v4 += *v8++;
                  --v7;
                }
                while( v7 );
              }
              *v2 = v4 == 0;
            }
            else
            {
              *v2 = 0;
            }
          }
          ExFreePoolWithTag(Buffer, 0);
        }
        else
        {
          return -1073741801;
        }
      }
    }
  }
  return v5;
}

Referenced by:

PopBootStatCheckIntegrity