PfpQueryFileExtentsRequest
INT64 __fastcall PfpQueryFileExtentsRequest(INT64 a1, CHAR a2, _DWORD *a3){
UINT8 *PoolWithTag;
_DWORD *v6;
__int64 v7;
int inited;
__int64 v9;
__int128 v10;
__m128i v11;
unsigned int v12;
char *v13;
__int64 v14;
VOID *v15;
ULONG OutputBufferLength;
NTSTATUS v17;
unsigned int Information;
_DWORD *OutputBuffer;
NTSTATUS v20;
NTSTATUS v21;
__int64 v22;
int v25;
unsigned int v26;
__int64 FileInformation;
struct _UNICODE_STRING DestinationString;
struct _IO_STATUS_BLOCK IoStatusBlock;
void *Src[2];
__m128i v31;
volatile void *Address[2];
SIZE_T NumberOfBytes;
__int64 InputBuffer;
INT64 v35;
_DWORD *v36;
HANDLE v37;
__int128 v38;
__int64 v39;
HANDLE FileHandle;
__int128 v41;
__int64 v42;
__int128 FsInformation;
__int64 v44;
v36 = a3;
v35 = a1;
IoStatusBlock = 0i64;
InputBuffer = 0i64;
FileInformation = 0i64;
FsInformation = 0i64;
v44 = 0i64;
DestinationString = 0i64;
PoolWithTag = 0i64;
v6 = 0i64;
v7 = 0i64;
FileHandle = 0i64;
v41 = 0i64;
v42 = 0x200000000i64;
v37 = 0i64;
v38 = 0i64;
v39 = 0x200000000i64;
v25 = 1;
if( *(_DWORD *)(a1 + 24) < 0x38u )
{
LABEL_2:
inited = -1073741306;
goto LABEL_58;
}
if( a2 )
ProbeForWrite(*(VOID **)(a1 + 16), 0x38ui64, 8ui64);
v9 = *(_QWORD *)(a1 + 16);
*(_OWORD *)Src = *(_OWORD *)v9;
v10 = *(_OWORD *)Src;
v11 = *(__m128i *)(v9 + 16);
v31 = v11;
*(_OWORD *)Address = *(_OWORD *)(v9 + 32);
NumberOfBytes = *(_QWORD *)(v9 + 48);
if( _mm_cvtsi128_si32(*(__m128i *)Src) != 2 )
{
inited = -1073741735;
goto LABEL_58;
}
v12 = _mm_cvtsi128_si32(v11);
if( (v12 & 1) != 0 || v12 - 1 > 0xFFFFF || (v11.m128i_i8[4] & 1) != 0 || !v11.m128i_i32[1] || v11.m128i_i32[1] >= v12 )
goto LABEL_57;
PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, v12, 0x70436650ui64);
if( !PoolWithTag )
{
LABEL_13:
inited = -1073741670;
goto LABEL_58;
}
if( a2 )
{
if( (_mm_cvtsi128_si32(_mm_srli_si128(*(__m128i *)Src, 8)) & 1) != 0 )
ExRaiseDatatypeMisalignment();
v13 = (char *)_mm_srli_si128(*(__m128i *)Src, 8).m128i_u64[0];
Src[1] = v13;
if( (unsigned __int64)&v13[v12] > 0x7FFFFFFF0000i64 || &v13[v12] < v13 )
MEMORY[0x7FFFFFFF0000] = 0;
}
memmove(PoolWithTag, (UINT8 *)Src[1], v12);
if( *(_WORD *)&PoolWithTag[2 * (v12 >> 1) - 2]
|| (v14 = (unsigned int)_mm_cvtsi128_si32(_mm_srli_si128(v11, 4)) >> 1, *(_WORD *)&PoolWithTag[2 * v14] != 92) )
{
LABEL_57:
inited = -1073741811;
goto LABEL_58;
}
v15 = ExAllocatePoolWithTag(NonPagedPoolNx, 0x90ui64, 0x43536650ui64);
v7 = (__int64)v15;
if( !v15 )
goto LABEL_13;
PfpPrefetchSharedInitialize(v15);
*(_DWORD *)(v7 + 56) = 15;
*(_DWORD *)(v7 + 60) = 150;
inited = PfpPrefetchSharedStart(v7);
if( inited >= 0 )
{
*(_WORD *)&PoolWithTag[2 * v14] = 0;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)PoolWithTag);
if( inited >= 0 )
{
OutputBufferLength = 32;
inited = PfpOpenHandleCreate((__int64)&FileHandle, v7, (__int64)&DestinationString, 0i64, 1048960, 0x20u, 0, 0i64);
if( inited >= 0 )
{
*(_WORD *)&PoolWithTag[2 * v14] = 92;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)PoolWithTag);
if( inited >= 0 )
{
inited = PfpOpenHandleCreate(
(__int64)&v37,
v7,
(__int64)&DestinationString,
0i64,
1048704,
0x20u,
0x80u,
(__int64)&FileHandle);
if( inited >= 0 )
{
v17 = ZwQueryVolumeInformationFile(
FileHandle,
&IoStatusBlock,
&FsInformation,
0x18u,
FileFsVolumeInformation);
inited = v17;
if( v17 == 259 )
KeBugCheckEx(0x191u, 0xF72ui64, 0i64, 0i64, 0i64);
if( (v17 & 0xC0000000) != -1073741824 )
{
LODWORD(Address[0]) = DWORD2(FsInformation);
Information = NumberOfBytes;
v26 = NumberOfBytes;
if( (unsigned int)NumberOfBytes > 0x20 )
OutputBufferLength = NumberOfBytes;
while( 1 )
{
if( OutputBufferLength > 0xA00000 )
goto LABEL_2;
if( v6 )
ExFreePoolWithTag(v6, 0);
OutputBuffer = ExAllocatePoolWithTag(PagedPool, OutputBufferLength, 0x65466650ui64);
v6 = OutputBuffer;
if( !OutputBuffer )
goto LABEL_13;
v20 = ZwFsControlFile(
v37,
0i64,
0i64,
0i64,
&IoStatusBlock,
0x90073u,
&InputBuffer,
8u,
OutputBuffer,
OutputBufferLength);
inited = v20;
if( v20 == 259 )
KeBugCheckEx(0x191u, 0xFB0ui64, 0i64, 0i64, 0i64);
if( v20 >= 0 )
break;
if( v20 == -1073741807 )
goto LABEL_43;
if( v20 != -2147483643 )
goto LABEL_58;
OutputBufferLength *= 2;
}
Information = IoStatusBlock.Information;
LODWORD(NumberOfBytes) = IoStatusBlock.Information;
if( *v6 )
{
inited = 0;
LABEL_47:
v22 = *(_QWORD *)(v35 + 16);
*(_OWORD *)v22 = v10;
*(__m128i *)(v22 + 16) = v11;
*(_OWORD *)(v22 + 32) = *(_OWORD *)Address;
*(_QWORD *)(v22 + 48) = NumberOfBytes;
if( inited == -1073741807 )
{
v25 = 0;
}
else if( v26 >= Information )
{
if( a2 )
ProbeForWrite((VOID *)Address[1], Information, 8ui64);
memmove((UINT8 *)Address[1], (UINT8 *)v6, Information);
}
else
{
v25 = 0;
inited = -1073741789;
}
*v36 = 56;
goto LABEL_58;
}
LABEL_43:
v21 = ZwQueryInformationFile(v37, &IoStatusBlock, &FileInformation, 8ui64, FileInternalInformation);
inited = v21;
if( v21 == 259 )
KeBugCheckEx(0x191u, 0xFEBui64, 0i64, 0i64, 0i64);
if( v21 >= 0 )
{
v31.m128i_i64[1] = FileInformation;
inited = -1073741807;
v11 = v31;
goto LABEL_47;
}
}
}
}
}
}
}
LABEL_58:
if( v25 && (inited == -1073741807 || inited == -1073741789) )
inited = -1073741823;
if( (v39 & 0x400000000i64) != 0 )
PfpOpenHandleClose(&v37, v7);
if( (v42 & 0x400000000i64) != 0 )
PfpOpenHandleClose(&FileHandle, v7);
if( v7 )
{
PfpPrefetchSharedCleanup(v7);
PfpPrefetchSharedDeref((volatile INT64 *)v7);
}
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
if( v6 )
ExFreePoolWithTag(v6, 0);
return(unsigned int)inited;
}Referenced by:
PfQuerySuperfetchInformation