KiTryUnwaitThreadWithPriority
__int64 __fastcall KiTryUnwaitThreadWithPriority(__int64 a1, __int64 a2, __int64 a3, int a4){
struct _KPRCB *CurrentPrcb;
__int64 v5;
unsigned __int8 v7;
__int64 v8;
__int64 v11;
unsigned __int8 v12;
_KPRCB *v13;
char v14;
_QWORD *v16;
_QWORD *v17;
__int64 v18;
int v19;
__int64 v20;
__int64 v21;
UINT64 SpinCount;
CurrentPrcb = KeGetCurrentPrcb();
v5 = *(_QWORD *)(a2 + 24);
v7 = 0;
v8 = a4;
LODWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)(v5 + 64), 0i64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( *(_QWORD *)(v5 + 64) );
v20 = *((_QWORD *)CurrentPrcb + 4247);
if( v20 && *((_BYTE *)CurrentPrcb + 32) <= 1u )
++*(_DWORD *)(v20 + 24);
}
if( *(_BYTE *)(v5 + 388) == 5 )
{
v11 = (unsigned __int8)*(_DWORD *)(v5 + 540);
if( (_DWORD)v11 != (_DWORD)v8 )
{
v19 = *(_DWORD *)(v5 + 540) & 0x100;
if( !v19 )
{
v21 = *(_QWORD *)(v5 + 232);
_InterlockedDecrement((volatile signed __int32 *)(v21 + 4 * v11 + 536));
_InterlockedIncrement((volatile signed __int32 *)(v21 + 4 * v8 + 536));
}
*(_DWORD *)(v5 + 540) = v19 | (unsigned __int8)v8;
}
KiSignalThread((_KPRCB *)a1, (_ETHREAD *)v5, a3, (_KWAIT_BLOCK *)a2);
v7 = v12;
if( v12 )
{
*(_BYTE *)(v5 + 645) = 0;
v13 = KeGetCurrentPrcb();
if( (char)v8 < *(char *)(v5 + 563) )
{
if( *(_BYTE *)(v5 + 871) )
{
v16 = (_QWORD *)(v5 + 816);
if( *(_QWORD *)(v5 + 816) == 1i64 )
{
v17 = (_QWORD *)((char *)v13 + 34672);
if( v13 != (_KPRCB *)-34672i64 )
{
*v16 = *v17;
*v17 = v16;
_InterlockedIncrement16((volatile signed __int16 *)(v5 + 868));
KiAbQueueAutoBoostDpc(v13);
}
}
}
}
v14 = *(_BYTE *)(v5 + 564);
*(_BYTE *)(v5 + 563) = v8;
if( v14 )
{
if( (v14 & 0xF) != 0 )
*(_DWORD *)(v5 + 872) = KUSER_SHARED_DATA.TickCount.LowPart;
*(_BYTE *)(v5 + 564) = 0;
}
if( (_DWORD)v8 != *(char *)(v5 + 195) )
{
v18 = *(_QWORD *)(v5 + 72) + KiCyclesPerClockQuantum * (unsigned int)*(unsigned __int8 *)(v5 + 651);
if( (*(_DWORD *)(v5 + 120) & 0x20) != 0 )
_interlockedbittestandreset((volatile signed __int32 *)(v5 + 120), 5u);
*(_QWORD *)(v5 + 32) = v18;
KiSetPriorityThread((_KTHREAD *)v5, 0i64, (unsigned int)v8);
}
}
}
*(_QWORD *)(v5 + 64) = 0i64;
++*(_BYTE *)(a2 + 17);
return v7;
}Referenced by:
ExpQueueWorkItem
KiWakePriQueueWaiter