SiValidateSystemPartition

NTSTATUS __stdcall SiValidateSystemPartition(
        WCHAR *SystemDevice,
        PARTITION_STYLE *RequiredPartitionStyle,
        _GUID *UefiPartitionId,
        PARTITION_INFORMATION_EX *PartitionInformation){
  __int64 v6; 
  UINT64 v7; 
  __int64 v9; 
  NTSTATUS v10; 
  UINT64 a6; 
  _QWORD PartitionInformationa[18]; 
  int OutputBuffer[2]; 
  int v14; 
  __int128 OutputBufferLengtha[2]; 
  __int64 v16; 
  char v17; 

  memset(PartitionInformationa, 0i64, sizeof(PartitionInformationa));
  v14 = 0;
  LODWORD(v6) = SiGetDiskPartitionInformation(SystemDevice, PartitionInformationa);
  if( (int)v6 < 0 )
    return v6;
  if( RequiredPartitionStyle && LODWORD(PartitionInformationa[0]) != *RequiredPartitionStyle )
  {
    LODWORD(v6) = -1073741823;
    return v6;
  }
  v6 = 3221225473i64;
  if( LODWORD(PartitionInformationa[0]) != 1 )
  {
    if( !LODWORD(PartitionInformationa[0]) )
      v6 = BYTE1(PartitionInformationa[4]) == 0 ? 0xC0000001 : 0;
    if( (int)v6 < 0 )
      return v6;
LABEL_8:
    if( v17 )
    {
      v14 = 0;
      LODWORD(a6) = 40;
      OutputBuffer[0] = 0;
      OutputBuffer[1] = 0;
      v16 = 0i64;
      memset(OutputBufferLengtha, 0, sizeof(OutputBufferLengtha));
      v10 = SiIssueSynchronousIoctl(SystemDevice, (VOID *)v6, OutputBuffer, v7, OutputBufferLengtha, a6);
      LODWORD(v6) = v10;
      if( v10 >= 0 )
      {
        if( BYTE10(OutputBufferLengtha[0]) )
          LODWORD(v6) = -1073741436;
      }
    }
    return v6;
  }
  v9 = PartitionInformationa[4] - *(_QWORD *)&PARTITION_SYSTEM_GUID.Data1;
  if( PartitionInformationa[4] == *(_QWORD *)&PARTITION_SYSTEM_GUID.Data1 )
    v9 = PartitionInformationa[5] - *(_QWORD *)PARTITION_SYSTEM_GUID.Data4;
  if( !v9 )
  {
    v6 = 0i64;
    goto LABEL_8;
  }
  return v6;
}

Referenced by:

SiGetBootDeviceName