KiConnectSecondaryInterrupt
NTSTATUS __stdcall KiConnectSecondaryInterrupt(_KINTERRUPT *Interrupt){
char v3;
unsigned __int8 Irql;
__int64 v5;
char v6;
unsigned __int8 SynchronizeIrql;
INT64 v8;
__int64 v9;
__int64 v10;
UINT8 OldIrql;
OldIrql = 0;
if( !KiSecondaryInterruptServicesEnabled )
return -1073741823;
v3 = 0;
Irql = Interrupt->Irql;
v5 = Interrupt->Vector - 256;
v6 = 0;
if( (unsigned int)v5 > 0xFF )
return -1073741585;
if( Irql > 0xCu )
return -1073741585;
if( Interrupt->Number >= (unsigned int)KeNumberProcessors_0 )
return -1073741585;
SynchronizeIrql = Interrupt->SynchronizeIrql;
if( SynchronizeIrql < Irql )
{
if( SynchronizeIrql )
return -1073741585;
}
v8 = KiGlobalSecondaryIDT + 48 * v5;
KiAcquireSecondaryPassiveConnectLock(v8);
KiAcquireSecondaryInterruptConnectLock((UINT64 *)v8, &OldIrql);
if( !Interrupt->Connected )
{
v9 = *(_QWORD *)(v8 + 40);
if( v9 )
{
if( !Interrupt->ShareVector )
goto LABEL_17;
if( !*(_BYTE *)(v9 + 100) )
goto LABEL_17;
if( *(_DWORD *)(v9 + 108) != Interrupt->Mode )
goto LABEL_17;
v6 = 1;
v3 = 1;
KiInsertInterruptObjectOrdered(*(_KINTERRUPT **)(v8 + 40), Interrupt);
if( *(_BYTE *)(v10 + 93) || !Interrupt->SynchronizeIrql )
goto LABEL_17;
}
else
{
v6 = 1;
Interrupt->InterruptListEntry.Blink = &Interrupt->InterruptListEntry;
Interrupt->InterruptListEntry.Flink = &Interrupt->InterruptListEntry;
*(_BYTE *)(v8 + 32) = 0;
}
*(_QWORD *)(v8 + 40) = Interrupt;
LABEL_17:
Interrupt->Connected = 1;
}
KxReleaseSpinLock((UINT64 *)v8);
__writecr8(OldIrql);
KeSetEvent((PRKEVENT)(v8 + 8), 0);
KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
if( v6 )
return v3 != 0 ? 0x127 : 0;
return -1073741585;
}Referenced by:
KeConnectInterrupt