PopPepWork
UINT8 __stdcall PopPepWork(_PEP_WORK_INFORMATION *WorkInfo){
_ETHREAD *CurrentThread;
unsigned int v2;
int v3;
__int64 v4;
__int64 v5;
REGHANDLE v6;
unsigned __int8 CurrentIrql;
unsigned int v8;
__int64 v9;
INT64 *v10;
__int64 v11;
int v12;
unsigned int v13;
__int64 v14;
int ReadyActivityType;
UINT8 started;
POP_PEP_WORK_SERVICED_TYPE v17;
int v18;
int v20;
int v21;
__int64 v22;
LPCGUID ActivityId;
int NumberExtraDevices;
__int64 v26;
POP_FX_DEVICE *EndFxDevice;
_EVENT_DATA_DESCRIPTOR UserData;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
LOBYTE(v2) = 0;
NumberExtraDevices = 0;
v3 = 0;
--CurrentThread->Tcb.KernelApcDisable;
ExAcquirePushLockSharedEx((_EX_PUSH_LOCK *)&PopIrpWorkerControlEvent + 356, 0i64);
v4 = *(&stru_140C00F40 + 216);
if( (_UNKNOWN *)*(&stru_140C00F40 + 216) == (_UNKNOWN *)((char *)&PopIrpWorkerControlEvent + 2688) )
{
_InterlockedCompareExchange64((_QWORD *)&stru_140C00F40 + 216, **(&stru_140C00F40 + 216), *(&stru_140C00F40 + 216));
v4 = *(&stru_140C00F40 + 216);
}
v5 = *(_QWORD *)(v4 + 32);
v26 = 0i64;
if( PopDiagHandleRegistered )
{
v6 = PopDiagHandle;
if( EtwEventEnabled(PopDiagHandle, &POP_ETW_EVENT_DEFAULT_PEP_WORKER_START) )
{
if( v5 )
v26 = *(_QWORD *)(v5 + 48);
*(_QWORD *)&UserData.Size = 8i64;
UserData.Ptr = (unsigned __int64)&v26;
EtwWriteEx(v6, &POP_ETW_EVENT_DEFAULT_PEP_WORKER_START, 0i64, 1u, 0, 0, 1u, &UserData);
}
v3 = 0;
}
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
v8 = 0;
while( 2 )
{
v9 = v4;
do
{
EndFxDevice = 0i64;
v10 = (INT64 *)(v9 + 64);
if( v8 )
{
ExAcquireSpinLockExclusiveAtDpcLevel(v10);
v20 = v3 + 1;
if( v8 != 2 )
v20 = v3;
NumberExtraDevices = v20;
}
else if( !(unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel(v10) )
{
goto LABEL_19;
}
v11 = *(_QWORD *)(v9 + 32);
if( v11 )
EndFxDevice = *(POP_FX_DEVICE **)(v11 + 48);
v12 = *(_DWORD *)(v9 + 120);
if( v12 )
{
ReadyActivityType = PopPepGetReadyActivityType(v9 + 72, 0, 0);
if( ReadyActivityType != 6 )
{
started = PopPepStartActivity(
v9,
0i64,
v9 + 72,
ReadyActivityType,
(volatile signed __int32 *)(v9 + 120),
(__int64)WorkInfo);
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v9 + 64));
v17 = PopPepWorkServicedTypeDeviceNonShared;
goto LABEL_27;
}
}
v13 = *(_DWORD *)(v9 + 180);
v2 = 0;
if( v13 )
{
v14 = v9 + 184;
while( !*(_DWORD *)(v14 + 104) )
{
++v2;
v14 += 200i64;
if( v2 >= v13 )
goto LABEL_17;
}
v21 = PopPepGetReadyActivityType(v14 + 56, 1u, 3);
started = PopPepStartActivity(v9, v22, v22 + 56, v21, (volatile signed __int32 *)(v22 + 104), (__int64)WorkInfo);
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v9 + 64));
v17 = PopPepWorkServicedTypeComponent;
goto LABEL_27;
}
LABEL_17:
if( v12 )
{
v18 = PopPepGetReadyActivityType(v9 + 72, 4u, 5);
started = PopPepStartActivity(v9, 0i64, v9 + 72, v18, (volatile signed __int32 *)(v9 + 120), (__int64)WorkInfo);
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v9 + 64));
v17 = PopPepWorkServicedTypeDeviceShared;
goto LABEL_27;
}
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v9 + 64));
LABEL_19:
v9 = *(_QWORD *)v9;
if( (_UNKNOWN *)v9 == (_UNKNOWN *)((char *)&PopIrpWorkerControlEvent + 2688) )
v9 = *(_QWORD *)v9;
v3 = NumberExtraDevices;
}
while( v9 != v4 );
if( ++v8 < 3 )
continue;
break;
}
started = 0;
v17 = PopPepWorkServicedTypeInvalid;
LABEL_27:
__writecr8(CurrentIrql);
if( v9 != v4 )
_InterlockedExchange64((_QWORD *)&stru_140C00F40 + 216, v9);
if( _InterlockedCompareExchange64((_QWORD *)&PopIrpWorkerControlEvent + 356, 0i64, 17i64) != 17 )
ExfReleasePushLockShared((_EX_PUSH_LOCK *)&PopIrpWorkerControlEvent + 356);
KeAbPostRelease((char *)&PopIrpWorkerControlEvent + 2848);
KeLeaveCriticalRegionThread(KeGetCurrentThread());
LODWORD(ActivityId) = NumberExtraDevices;
PopDiagTraceFxDefaultPepWorkerEnd(EndFxDevice, v17, v2, v8, (INT64)ActivityId);
return started;
}Referenced by:
PopFxDispatchPluginWorkOnce