IoQuerySystemDeviceName

INT64 __fastcall IoQuerySystemDeviceName(
        _SYSTEM_INFORMATION_CLASS InformationClass,
        VOID *UserBuffer,
        INT64 BufferSize,
        UINT *RequiredSize,
        INT64 a5,
        INT64 a6,
        INT64 a7,
        INT64 a8){
  __int64(__fastcall *v9)(unsigned __int64, _QWORD, int *); 
  INT64 result; 
  WCHAR **v11; 
  unsigned int v12; 
  int SystemDevice; 
  switch( InformationClass )
  {
    case SystemSystemPartitionInformation:
      v9 = (__int64(__fastcall *)(unsigned __int64, _QWORD, int *))SyspartDirectGetSystemPartition;
      break;
    case SystemSystemDiskInformation:
      v9 = (__int64(__fastcall *)(unsigned __int64, _QWORD, int *))SyspartDirectGetSystemDisk;
      break;
    case SystemFirmwarePartitionInformation:
      v9 = (__int64(__fastcall *)(unsigned __int64, _QWORD, int *))SyspartDirectGetFirmwareSystemPartition;
      break;
    default:
      return 3221225475i64;
  }
  result = IopRetrieveSystemDeviceName(v9, (unsigned __int64)UserBuffer, BufferSize, (int *)RequiredSize);
  v12 = result;
  if( (_DWORD)result == -1073740718 && IopAmbiguousSystemDisk )
  {
    if( InformationClass == SystemSystemDiskInformation )
    {
      return 3221226577i64;
    }
    else if( InformationClass == SystemSystemPartitionInformation )
    {
      SystemDevice = IopFindSystemDevice(v11);
      if( SystemDevice >= 0 )
        ExFreePoolWithTag(0i64, 0);
      if( SystemDevice == -1073740718 )
        return(unsigned int)-1073740719;
      return v12;
    }
  }
  return result;
}

Referenced by:

ExpQuerySystemInformation