HalGetMessageRoutingInfo
__int64 __fastcall HalGetMessageRoutingInfo(int *a1, _DWORD *a2){
unsigned __int16 *v4;
char v5;
__int16 v6;
char v7;
unsigned __int64 v8;
int v9;
int v10;
UINT64 v11;
int v12;
int v14;
char v15;
int v16;
int v17;
unsigned __int16 *v18[2];
__int16 v19;
int v20;
__int16 v21;
__int128 v22;
UINT64 Id;
v20 = 0;
v21 = 0;
LODWORD(Id) = 0;
v22 = 0i64;
if( (unsigned int)*a1 > 1 )
goto LABEL_53;
v4 = (unsigned __int16 *)*((_QWORD *)a1 + 2);
if( !v4
|| (v5 = 1, (unsigned __int16 *)((unsigned __int64)v4 & ((unsigned __int64)v4 ^ ((unsigned __int64)v4 - 1))) != v4) )
{
v5 = 0;
}
v6 = *((_WORD *)a1 + 12);
v7 = 0;
if( !v6 )
{
v8 = 0i64;
if( KeActiveProcessors.Count )
v8 = KeActiveProcessors.Bitmap[0];
if( v4 == (unsigned __int16 *)v8 )
v7 = 1;
}
v9 = a1[8];
v19 = v6;
v18[1] = v4;
v18[0] = 0i64;
if( v9 == 1 )
{
if( v5 || v7 )
{
v10 = KeEnumerateNextProcessor(&Id, v18);
if( v10 >= 0 )
{
if( v7 )
{
while( 1 )
{
v11 = (unsigned int)Id;
if( (unsigned int)Id >= (unsigned int)HalpInterruptProcessorCount )
break;
v10 = KeEnumerateNextProcessor(&Id, v18);
if( v10 < 0 )
{
v11 = (unsigned int)Id;
goto LABEL_49;
}
}
v10 = -1073741811;
LABEL_49:
if( (unsigned int)v11 < (unsigned int)HalpInterruptProcessorCount )
v10 = 0;
}
else
{
v11 = (unsigned int)Id;
}
if( v10 >= 0 && (int)HalGetProcessorIdByNtNumber(v11, &Id) >= 0 )
goto LABEL_16;
}
}
goto LABEL_44;
}
if( v9 == 2 )
{
if( !HalpInterruptClusterModeEnabled )
{
if( (int)KeEnumerateNextProcessor(&Id, v18) < 0 )
return 3221225485i64;
v14 = DWORD2(v22);
while( (unsigned int)Id < (unsigned int)HalpInterruptProcessorCount )
{
if( *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id) != 5 )
goto LABEL_53;
v14 |= *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 8);
if( (int)KeEnumerateNextProcessor(&Id, v18) < 0 )
{
if( v14 )
goto LABEL_16;
return 3221225485i64;
}
}
LABEL_44:
HalpInterruptLastProblem = 21;
return 3221225485i64;
}
LABEL_53:
HalpInterruptLastProblem = 20;
return 3221225485i64;
}
if( v9 != 3 || !HalpInterruptClusterModeEnabled )
goto LABEL_53;
v15 = 0;
if( (int)KeEnumerateNextProcessor(&Id, v18) >= 0 )
{
v16 = HIDWORD(v22);
v17 = DWORD2(v22);
while( (unsigned int)Id < (unsigned int)HalpInterruptProcessorCount )
{
if( *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id) != 6 )
goto LABEL_53;
if( v15 )
{
if( v17 != *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 8) )
{
if( !v7 )
goto LABEL_53;
v16 = *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 12);
v17 = *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 8);
}
v16 |= *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 12);
}
else
{
v16 = *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 12);
v17 = *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)Id + 8);
v15 = 1;
}
if( (int)KeEnumerateNextProcessor(&Id, v18) < 0 )
goto LABEL_16;
}
goto LABEL_44;
}
LABEL_16:
v12 = *a1;
*a2 = 1;
if( v12 )
{
a2[2] = 3;
a2[20] = v9;
}
else
{
a2[2] = 1;
a2[21] = a1[10];
a2[20] = a1[11];
a2[22] = *((unsigned __int16 *)a1 + 24);
}
return 0i64;
}Referenced by:
IopConnectMessageBasedInterrupt