PfSnGetPrefetchInstructions
__int64 __fastcall PfSnGetPrefetchInstructions(__int64 a1, int a2, _QWORD *a3){
__int64 v3;
int v6;
UCHAR *v7;
_ETHREAD *CurrentThread;
unsigned int v9;
WCHAR *PoolWithTag;
WCHAR v11;
int v12;
ULONG Length;
UCHAR *v14;
_DWORD *v15;
UINT64 ShareAccess;
UINT64 OpenOptions;
UINT64 v19;
UINT64 v20;
void *FileHandle;
__int64 v22;
INT64 v23;
struct _IO_STATUS_BLOCK IoStatusBlock;
struct _UNICODE_STRING DestinationString;
__int64 v26[2];
struct _OBJECT_ATTRIBUTES ObjectAttributes;
__int128 FileInformation;
__int64 v29;
LODWORD(v23) = 0;
DestinationString = 0i64;
v29 = 0i64;
v3 = -1i64;
memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
FileHandle = 0i64;
v6 = HIDWORD(a1);
LODWORD(v20) = 0;
v7 = 0i64;
IoStatusBlock = 0i64;
v19 = 0i64;
FileInformation = 0i64;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)CurrentThread + 242);
ExAcquirePushLockSharedEx((UINT64)&qword_140C4FFF8, 0i64);
do
++v3;
while( *((_WORD *)qword_140C4FE90 + v3) );
v9 = 2 * v3 + 102;
PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, v9, 0x46506343ui64);
if( !PoolWithTag )
{
v12 = -1073741670;
if( _InterlockedCompareExchange64((volatile signed __int64 *)&qword_140C4FFF8, 0i64, 17i64) != 17 )
ExfReleasePushLockShared((INT64 *)&qword_140C4FFF8);
KeAbPostRelease(&qword_140C4FFF8);
KeLeaveCriticalRegion();
goto LABEL_25;
}
HIDWORD(ShareAccess) = v6;
RtlStringCbPrintfW(PoolWithTag, v9, (WCHAR *)L"%s\\%ws-%08X.%ws");
if( _InterlockedCompareExchange64((volatile signed __int64 *)&qword_140C4FFF8, 0i64, 17i64) != 17 )
ExfReleasePushLockShared((INT64 *)&qword_140C4FFF8);
KeAbPostRelease(&qword_140C4FFF8);
KeLeaveCriticalRegion();
RtlInitUnicodeString(&DestinationString, PoolWithTag, v11);
LODWORD(OpenOptions) = 32;
ObjectAttributes.ObjectName = &DestinationString;
ObjectAttributes.Length = 48;
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Attributes = 576;
LODWORD(ShareAccess) = 0;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
v12 = NtOpenFile(&FileHandle, 0x80100000ui64, &ObjectAttributes, &IoStatusBlock, ShareAccess, OpenOptions);
if( v12 < 0
|| (v12 = NtQueryInformationFile(FileHandle, &IoStatusBlock, &FileInformation, 0x18ui64, FileStandardInformation),
v12 < 0) )
{
LABEL_25:
v15 = (_DWORD *)v19;
goto LABEL_16;
}
Length = DWORD2(FileInformation);
LODWORD(v22) = 0x10000000;
if( (unsigned int)(DWORD2(FileInformation) - 1) > 0xFFFFFFF || HIDWORD(FileInformation) )
{
v12 = -1073741823;
goto LABEL_25;
}
v14 = (UCHAR *)ExAllocatePoolWithTag(PagedPool, DWORD2(FileInformation), 0x70506343ui64);
v7 = v14;
if( !v14 )
{
v12 = -1073741670;
goto LABEL_25;
}
v12 = NtReadFile(FileHandle, 0i64, 0i64, 0i64, &IoStatusBlock, v14, Length, 0i64, 0i64);
if( v12 < 0 )
goto LABEL_25;
v26[0] = (__int64)PfSnScenarioAlloc;
v26[1] = (__int64)SC_ENV::Free;
v12 = SmDecompressBuffer(v7, Length, &v19, &v20, (__int64)&v22, (__int64)v26);
if( v12 < 0 )
goto LABEL_25;
v15 = (_DWORD *)v19;
if( (unsigned __int8)PfVerifyScenarioBuffer(v19, (unsigned int)v20, &v23) )
{
if( v15[20] == a2 )
{
*a3 = v15;
v12 = 0;
v15 = 0i64;
}
else
{
v12 = -1073741823;
}
}
else
{
v12 = -1073741701;
}
LABEL_16:
if( FileHandle )
NtClose(FileHandle);
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
if( v7 )
ExFreePoolWithTag(v7, 0);
if( v15 )
ExFreePoolWithTag(v15, 0);
return(unsigned int)v12;
}Referenced by:
PfSnBeginScenario