NtQueueApcThreadEx
VOID __stdcall NtQueueApcThreadEx(
PVOID ThreadHandle,
PVOID UserApcReserveHandle,
PVOID ApcRoutine,
PVOID ptr32,
PVOID ptr32a,
PVOID SystemArgument2,
PVOID ApcArgument1,
PVOID ApcArgument2,
PVOID ApcArgument3){
PVOID v10;
bool v13;
KPROCESSOR_MODE v14;
struct _DMA_ADAPTER *v15;
__int64 v16;
__int16 v17;
__int64 v18;
_KAPC *PoolWithQuotaTag;
void *v20;
void(__fastcall *v21)(_KAPC *);
PVOID Object;
PADAPTER_OBJECT DmaAdapter;
v10 = 0i64;
v13 = 1;
v14 = *((_BYTE *)KeGetCurrentThread() + 562);
if( UserApcReserveHandle != (PVOID)1 )
v10 = UserApcReserveHandle;
DmaAdapter = 0i64;
if( ObReferenceObjectByHandle(ThreadHandle, 0x10u, (POBJECT_TYPE)PsThreadType, v14, (PVOID *)&DmaAdapter, 0i64) >= 0 )
{
v15 = DmaAdapter;
if( (*(_DWORD *)(&DmaAdapter[7].Size + 1) & 0x400) != 0 )
goto LABEL_17;
v15 = DmaAdapter;
v16 = *(_QWORD *)(*((_QWORD *)KeGetCurrentThread() + 23) + 1408i64);
if( v16 )
{
v17 = *(_WORD *)(v16 + 8);
if( v17 == 332 || v17 == 452 )
{
v18 = *(_QWORD *)(*(_QWORD *)&DmaAdapter[34].Version + 1408i64);
if( (!v18 || *(_WORD *)(v18 + 8) == 0x8664) && (unsigned __int64)-((__int64)ApcRoutine >> 2) <= 0xFFFFFFFF )
goto LABEL_17;
}
}
if( v10 )
{
Object = 0i64;
if( ObReferenceObjectByHandle(v10, 2u, PspMemoryReserveObjectTypes, v14, &Object, 0i64) >= 0 )
{
if( !_InterlockedCompareExchange((volatile signed __int32 *)Object, 1, 0) )
{
v20 = PspUserApcReserveKernelRoutine;
v15 = DmaAdapter;
v21 = PspUserApcReserveKernelRoutine;
PoolWithQuotaTag = (_KAPC *)((char *)Object + 8);
LABEL_15:
KeInitializeApc(
(INT64)PoolWithQuotaTag,
(INT64)v15,
0i64,
(INT64)v20,
(INT64)v21,
(INT64)ApcRoutine,
v13,
(INT64)ptr32);
if( !KeInsertQueueApc(PoolWithQuotaTag, ptr32a, SystemArgument2, 0i64) )
v21(PoolWithQuotaTag);
goto LABEL_17;
}
HalPutDmaAdapter((PADAPTER_OBJECT)Object);
v15 = DmaAdapter;
}
}
else
{
PoolWithQuotaTag = (_KAPC *)ExAllocatePoolWithQuotaTag((POOL_TYPE)520, 0x58ui64, 0x70617350ui64);
if( PoolWithQuotaTag )
{
v20 = KeSpecialUserApcKernelRoutine;
v21 = (void(__fastcall *)(_KAPC *))ExFreePoolWithTag;
v13 = UserApcReserveHandle != (PVOID)1;
if( UserApcReserveHandle != (PVOID)1 )
v20 = SC_ENV::Free;
goto LABEL_15;
}
}
LABEL_17:
HalPutDmaAdapter(v15);
}
}Referenced by:
No references.