PfSnBeginScenario
__int64 __fastcall PfSnBeginScenario(void *a1, unsigned __int8 *a2, int a3, unsigned int a4, const void **a5){
__int64 CurrentThread;
unsigned int v6;
unsigned __int8 *v8;
unsigned int v9;
__int64 v10;
int v11;
int v12;
_BYTE *v13;
struct EX_RUNDOWN_REF *v14;
unsigned int started;
int v17;
unsigned int v18;
int v19;
char v20;
INT64 v21;
int v22;
PVOID P;
INT64 v24;
CurrentThread = (__int64)KeGetCurrentThread();
v6 = a3;
v22 = -1;
v21 = 0i64;
v8 = a2;
v9 = 0;
v20 = *(_BYTE *)(CurrentThread + 562);
v10 = -1i64;
P = 0i64;
v24 = 0i64;
*(_BYTE *)(CurrentThread + 562) = 0;
if( (int)PsGetIoPriorityThread(CurrentThread) < 2 )
{
started = 1075380276;
goto LABEL_19;
}
v12 = v11 + 1;
if( v11 + 1 + _InterlockedExchangeAdd(&dword_140C501F0, v11 + 1) < (unsigned int)dword_140C4FE88 )
{
v9 = PfSnCheckActionsNeeded((INT64)v8, v6, CurrentThread, &v21, (INT64 *)((char *)&v21 + 4));
if( (a4 & 2) != 0 )
{
v9 &= ~2u;
HIDWORD(v21) = 9;
}
if( (v9 & 2) != 0 )
{
if( (int)PfSnGetPrefetchInstructions((__int64)v8, v6, &P) >= 0 )
{
v13 = P;
v10 = *(_QWORD *)&KUSER_SHARED_DATA.SystemTime.LowPart - *((_QWORD *)P + 16);
if( v10 < *((_QWORD *)P + 24) && (_DWORD)v21 != 22 )
{
v9 &= ~1u;
LODWORD(v21) = 11;
}
v22 = *((_DWORD *)P + 50);
LABEL_7:
if( (a4 & 4) != 0 )
{
v9 &= ~1u;
LODWORD(v21) = 8;
}
if( ((unsigned __int8)v9 & (unsigned __int8)v12) != 0 )
{
v17 = PfSnBeginTrace(
a2,
v6,
a1,
(_ETHREAD *)(CurrentThread & -(__int64)(((unsigned __int8)v12 & (unsigned __int8)a4) != 0)),
v12 & (a4 >> 3),
&v24);
if( v17 < 0 )
{
switch( v17 )
{
case -1073741618:
LODWORD(v21) = 16;
break;
case -1073741670:
LODWORD(v21) = 17;
break;
case -1072037882:
LODWORD(v21) = 18;
break;
case -1073741791:
LODWORD(v21) = 19;
break;
default:
LODWORD(v21) = (v17 != -1073741661) + 20;
break;
}
}
v14 = (struct EX_RUNDOWN_REF *)v24;
if( v24 && a5 )
PfSnLogIdentifier(v24, a5);
}
else
{
v14 = (struct EX_RUNDOWN_REF *)v24;
}
if( (v9 & 2) != 0 )
{
v18 = a4 | 0x10;
if( (v13[208] & 3) == 0 )
v18 = a4;
v19 = PfSnPrefetchScenario(v13, v18);
P = 0i64;
v13 = 0i64;
if( v19 >= 0 )
LOBYTE(v12) = 0;
}
started = 0;
if( !(_BYTE)v12 )
goto LABEL_14;
goto LABEL_13;
}
v9 &= ~2u;
HIDWORD(v21) = 10;
}
v13 = P;
goto LABEL_7;
}
LODWORD(v21) = v11 + 1;
started = -1073741631;
HIDWORD(v21) = v11 + 1;
LABEL_13:
_InterlockedDecrement(&dword_140C501F0);
v13 = P;
v14 = (struct EX_RUNDOWN_REF *)v24;
LABEL_14:
if( v13 )
ExFreePoolWithTag(v13, 0);
if( v14 )
{
started = PfSnStartTraceTimer(v14);
ExReleaseRundownProtection(v14 + 45);
}
v8 = a2;
v6 = a3;
LABEL_19:
PfSnLogScenarioDecision((__int64)v8, v6, (EVENT_DESCRIPTOR *)v9, v21, SBYTE4(v21), v22, v10);
*(_BYTE *)(CurrentThread + 562) = v20;
return started;
}Referenced by:
PfSnBeginAppLaunch
PfSnOperationProcess