SiQueryProperty
INT64 __fastcall SiQueryProperty(WCHAR *a1, UINT64 a2, UINT64 a3, CHAR **a4){
unsigned int v4;
unsigned int v6;
NTSTATUS v7;
ULONG OutputBufferLength;
_DWORD *OutputBuffer;
HANDLE FileHandle;
struct _IO_STATUS_BLOCK IoStatusBlock;
__int64 InputBuffer;
int v14;
v4 = a2;
FileHandle = 0i64;
*a4 = 0i64;
IoStatusBlock = 0i64;
InputBuffer = 0i64;
v14 = 0;
v6 = a3;
v7 = SiOpenDevice(a1, &FileHandle);
if( v7 >= 0 )
{
InputBuffer = v4;
OutputBufferLength = 8;
if( v6 >= 8 )
OutputBufferLength = v6;
OutputBuffer = ExAllocatePoolWithTag(PagedPool, OutputBufferLength, 0x4B505953ui64);
if( OutputBuffer )
{
while( 1 )
{
v7 = ZwDeviceIoControlFile(
FileHandle,
0i64,
0i64,
0i64,
&IoStatusBlock,
0x2D1400u,
&InputBuffer,
0xCu,
OutputBuffer,
OutputBufferLength);
if( ((v7 + 0x80000000) & 0x80000000) == 0 && v7 != -2147483643 )
break;
v7 = 0;
if( OutputBuffer[1] <= OutputBufferLength )
{
OutputBuffer[1] = OutputBufferLength;
*a4 = (CHAR *)OutputBuffer;
OutputBuffer = 0i64;
break;
}
OutputBufferLength = OutputBuffer[1];
ExFreePoolWithTag(OutputBuffer, 0);
OutputBuffer = ExAllocatePoolWithTag(PagedPool, OutputBufferLength, 0x4B505953ui64);
if( !OutputBuffer )
goto LABEL_9;
}
}
else
{
LABEL_9:
v7 = -1073741670;
}
if( OutputBuffer )
ExFreePoolWithTag(OutputBuffer, 0);
}
if( FileHandle )
ZwClose(FileHandle);
return(unsigned int)v7;
}Referenced by:
SyspartGetPhysicalPartitions
SyspartIsSpace