SiGetSystemDisk

NTSTATUS __stdcall SiGetSystemDisk(VOID *FirmwareType, WCHAR **SystemDisk, INT64 a3, UINT64 a4){
  int v5; 
  UINT8 IsWinPEBoot; 
  WCHAR **v7; 
  int BootDeviceName; 
  INT64 v9; 
  NTSTATUS BiosSystemDisk; 
  PARTITION_STYLE v12; 
  WCHAR *ResultName; 

  ResultName = 0i64;
  v5 = (int)FirmwareType;
  v12 = PARTITION_STYLE_GPT;
  IsWinPEBoot = SiIsWinPEBoot();
  BootDeviceName = SiGetBootDeviceName(0i64, (WCHAR *)L"WindowsSysPartDevice", 0i64, 0i64, 0, SystemDisk);
  if( BootDeviceName >= 0 )
    return BootDeviceName;
  if( !IsWinPEBoot )
  {
    LOBYTE(v9) = 1;
    BootDeviceName = SiGetBootDeviceName(0i64, (WCHAR *)L"FirmwareBootDevice", v9, 0i64, 0, SystemDisk);
    if( BootDeviceName >= 0 )
      return BootDeviceName;
  }
  if( v5 == 1 )
  {
    BiosSystemDisk = SiGetBiosSystemDisk(SystemDisk);
  }
  else
  {
    if( v5 != 2 )
    {
      BootDeviceName = -1073741637;
      goto LABEL_7;
    }
    BiosSystemDisk = SiGetEfiSystemDevice(SyspartSystemDisk, v7, SystemDisk);
  }
  BootDeviceName = BiosSystemDisk;
LABEL_7:
  if( BootDeviceName >= 0 )
  {
    BootDeviceName = SiTranslateSymbolicLink(*SystemDisk, &ResultName);
    if( BootDeviceName >= 0 )
    {
      ExFreePoolWithTag(*SystemDisk, 0);
      *SystemDisk = ResultName;
      return BootDeviceName;
    }
    return 0;
  }
  if( BootDeviceName == -1073740719 )
  {
    if( IsWinPEBoot )
    {
      if( v5 == 2 )
      {
        LOBYTE(v9) = 1;
        if( SiGetBootDeviceName(0i64, (WCHAR *)L"FirmwareBootDevice", v9, &v12, 1, SystemDisk) >= 0 )
          return 0;
      }
    }
  }
  return BootDeviceName;
}

Referenced by:

No references.