RtlCheckBootStatusIntegrity

INT64 __stdcall RtlCheckBootStatusIntegrity(HANDLE FileHandle){
  bool *v1; 
  bool *v2; 
  char v4; 
  int v5; 
  void *Buffer; 
  __int64 v7; 
  _BYTE *v8; 
  int a3; 
  union _LARGE_INTEGER ByteOffset; 
  struct _IO_STATUS_BLOCK IoStatusBlock; 
  SIZE_T NumberOfBytes; 
  int a2; 
  a2 = 0;
  v2 = v1;
  a3 = 0;
  LODWORD(NumberOfBytes) = 0;
  ByteOffset.QuadPart = 0i64;
  v4 = 0;
  IoStatusBlock = 0i64;
  v5 = ZwReadFile(FileHandle, 0i64, 0i64, 0i64, &IoStatusBlock, &NumberOfBytes, 4u, &ByteOffset, 0i64);
  if( v5 >= 0 )
  {
    v5 = RtlBootStatusItemInfo(15i64, &a2, &a3);
    if( v5 >= 0 )
    {
      if( (unsigned int)NumberOfBytes < a2 + a3 || (unsigned int)NumberOfBytes > 0x800 )
      {
        *v2 = 0;
      }
      else
      {
        Buffer = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x66647362ui64);
        if( Buffer )
        {
          v5 = ZwReadFile(FileHandle, 0i64, 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(unsigned int)-1073741801;
        }
      }
    }
  }
  return(unsigned int)v5;
}

Referenced by:

PopBootStatCheckIntegrity