SiGetBiosSystemPartition
INT64 __stdcall SiGetBiosSystemPartition(WCHAR **SystemPartition){
WCHAR *PoolWithTag;
int BiosSystemDisk;
wchar_t *v4;
int v5;
int DriveLayoutInformation;
_DWORD *v7;
WCHAR *v8;
__int64 v9;
UINT64 v10;
unsigned int v11;
_DWORD *v12;
unsigned int v13;
wchar_t *Str;
PVOID P;
P = 0i64;
PoolWithTag = 0i64;
Str = 0i64;
BiosSystemDisk = SiGetBiosSystemDisk(&Str);
v4 = Str;
v5 = BiosSystemDisk;
if( BiosSystemDisk < 0 )
goto LABEL_17;
DriveLayoutInformation = SiGetDriveLayoutInformation(Str, (DRIVE_LAYOUT_INFORMATION_EX **)&P);
v7 = P;
v5 = DriveLayoutInformation;
if( DriveLayoutInformation >= 0 )
{
if( !*(_DWORD *)P )
{
v8 = wcsstr(v4, L"\\Partition0");
if( v8 )
*v8 = 0;
v9 = -1i64;
do
++v9;
while( v4[v9] );
v10 = (unsigned int)(2 * v9 + 42);
PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, v10, 0x4B505953ui64);
if( !PoolWithTag )
{
v5 = -1073741670;
goto LABEL_14;
}
v11 = v7[1];
v12 = v7 + 12;
v13 = 0;
if( v11 )
{
while( !*((_BYTE *)v12 + 33) )
{
++v13;
v12 += 36;
if( v13 >= v11 )
goto LABEL_12;
}
swprintf_s(PoolWithTag, v10 >> 1, (WCHAR *)L"%s\\Partition%lu");
*SystemPartition = PoolWithTag;
v5 = 0;
goto LABEL_14;
}
}
LABEL_12:
v5 = -1073740718;
}
LABEL_14:
if( v7 )
ExFreePoolWithTag(v7, 0);
if( v5 < 0 && PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
LABEL_17:
if( v4 )
ExFreePoolWithTag(v4, 0);
return(unsigned int)v5;
}Referenced by:
SiGetFirmwareSystemPartition