SiGetFirmwareSystemPartition

__int64 __fastcall SiGetFirmwareSystemPartition(int a1, WCHAR **a2){
  WCHAR **v4; 
  UINT8 IsWinPEBoot; 
  INT64 v6; 
  NTSTATUS BootDeviceName; 
  NTSTATUS BiosSystemPartition; 
  PARTITION_STYLE v10; 
  WCHAR *ResultName; 

  ResultName = 0i64;
  v10 = PARTITION_STYLE_GPT;
  IsWinPEBoot = SiIsWinPEBoot();
  if( IsWinPEBoot
    || (LOBYTE(v6) = 1,
        BootDeviceName = SiGetBootDeviceName(1i64, (WCHAR *)L"FirmwareBootDevice", v6, 0i64, 0, a2),
        BootDeviceName < 0) )
  {
    if( a1 == 1 )
    {
      BiosSystemPartition = SiGetBiosSystemPartition(a2);
    }
    else
    {
      if( a1 != 2 )
      {
        BootDeviceName = -1073741637;
LABEL_7:
        if( BootDeviceName < 0 )
        {
          if( BootDeviceName != -1073740719 )
            return(unsigned int)BootDeviceName;
          if( !IsWinPEBoot )
            return(unsigned int)BootDeviceName;
          if( a1 != 2 )
            return(unsigned int)BootDeviceName;
          LOBYTE(v6) = 1;
          if( SiGetBootDeviceName(1i64, (WCHAR *)L"FirmwareBootDevice", v6, &v10, 1, a2) < 0 )
            return(unsigned int)BootDeviceName;
        }
        else
        {
          BootDeviceName = SiTranslateSymbolicLink(*a2, &ResultName);
          if( BootDeviceName >= 0 )
          {
            ExFreePoolWithTag(*a2, 0);
            *a2 = ResultName;
            return(unsigned int)BootDeviceName;
          }
        }
        return 0;
      }
      BiosSystemPartition = SiGetEfiSystemDevice(SyspartSystemPartition, v4, a2);
    }
    BootDeviceName = BiosSystemPartition;
    goto LABEL_7;
  }
  return(unsigned int)BootDeviceName;
}

Referenced by:

SiGetSystemPartition