RawQueryFsSizeInfo
NTSTATUS __stdcall RawQueryFsSizeInfo(
_VCB *Vcb,
_FILE_OBJECT *FileObject,
_FILE_FS_SIZE_INFORMATION *Buffer,
UINT64 *Length){
bool v5;
char v10;
_DEVICE_OBJECT *v11;
PIRP *v12;
int Status;
bool v14;
_LARGE_INTEGER v15;
PIRP *v16;
NTSTATUS v17;
PIRP *v18;
NTSTATUS v19;
unsigned __int64 v20;
LARGE_INTEGER v21;
__int128 Object;
__int64 v23;
_IO_STATUS_BLOCK IoStatusBlock;
_LARGE_INTEGER OutputBuffer;
_LARGE_INTEGER Timeout[2];
__int64 v27;
_LARGE_INTEGER v28;
_LARGE_INTEGER v29;
__int128 v30;
v28.QuadPart = 0i64;
OutputBuffer.QuadPart = 0i64;
v5 = *(_DWORD *)Length < 0x18u;
v23 = 0i64;
v27 = 0i64;
Object = 0i64;
IoStatusBlock = 0i64;
*(_OWORD *)&Timeout[0].anonymous_0.LowPart = 0i64;
v30 = 0i64;
if( v5 )
return -2147483643;
RawBeginOperation((INT64)Vcb, (INT64)FileObject);
if( !v10 )
return -1073741202;
*(_OWORD *)&Buffer->TotalAllocationUnits.anonymous_0.LowPart = 0i64;
*(_QWORD *)&Buffer->SectorsPerAllocationUnit = 0i64;
KeInitializeEvent((INT64)&Object, 0, 0);
v11 = *(_DEVICE_OBJECT **)(*((_QWORD *)Vcb + 23) + 16i64);
v12 = IoBuildDeviceIoControlRequest(0x70000u, v11, 0i64, 0, Timeout, 0x18u, 0, (PKEVENT)&Object, &IoStatusBlock);
if( !v12 )
goto LABEL_25;
Status = IofCallDriver((UINT64)v11, (UINT64)v12);
if( Status == 259 )
{
KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
Status = IoStatusBlock.Status;
}
if( Status >= 0 )
{
if( (v11->Characteristics & 4) != 0 )
{
v14 = 0;
v15.QuadPart = 0i64;
v29.QuadPart = 0i64;
LABEL_21:
v20 = HIDWORD(v27);
Buffer->BytesPerSector = HIDWORD(v27);
Buffer->SectorsPerAllocationUnit = 1;
if( v14 )
v21.QuadPart = v15.QuadPart / v20;
else
v21.QuadPart = Timeout[0].QuadPart * Timeout[1].anonymous_0.HighPart * (int)v27;
Buffer->AvailableAllocationUnits = v21;
Buffer->TotalAllocationUnits = v21;
*(_DWORD *)Length -= 24;
Status = 0;
goto LABEL_26;
}
KeResetEvent((_KEVENT *)&Object);
v16 = IoBuildDeviceIoControlRequest(0x7405Cu, v11, 0i64, 0, &OutputBuffer, 8u, 0, (PKEVENT)&Object, &IoStatusBlock);
if( v16 )
{
v17 = IofCallDriver((UINT64)v11, (UINT64)v16);
if( v17 == 259 )
{
KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
v17 = IoStatusBlock.Status;
}
v15 = OutputBuffer;
v29 = OutputBuffer;
if( v17 >= 0 )
{
v14 = 1;
goto LABEL_21;
}
KeResetEvent((_KEVENT *)&Object);
v18 = IoBuildDeviceIoControlRequest(0x74004u, v11, 0i64, 0, &v28, 0x20u, 0, (PKEVENT)&Object, &IoStatusBlock);
if( v18 )
{
v19 = IofCallDriver((UINT64)v11, (UINT64)v18);
if( v19 == 259 )
{
KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
v19 = IoStatusBlock.Status;
}
v15 = v29;
v14 = v19 >= 0;
goto LABEL_21;
}
}
LABEL_25:
Status = -1073741670;
goto LABEL_26;
}
*(_DWORD *)Length = 0;
LABEL_26:
RawEndOperation(Vcb, FileObject);
return Status;
}Referenced by:
RawQueryVolumeInformation