HalpSetTimer
__int64 __fastcall HalpSetTimer(__int64 a1, unsigned int a2, ULONGLONG a3, char a4, unsigned __int64 *a5){
unsigned __int64 v5;
unsigned int v8;
NTSTATUS v9;
ULONGLONG v10;
unsigned int v11;
unsigned __int64 v12;
void *v13;
void *v14;
UINT64 v15;
UINT64 v16;
UINT64 v17;
unsigned __int128 v18;
__int64 v19;
ULONGLONG pullResult;
__int64 v22[4];
v22[0] = 0i64;
v5 = 0i64;
pullResult = 0i64;
v8 = a2;
switch( a2 )
{
case 1u:
if( (*(_DWORD *)(a1 + 224) & 0x10) == 0 )
{
*(_DWORD *)(a1 + 256) = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
*(_DWORD *)(a1 + 252) = 17;
*(_QWORD *)(a1 + 264) = "minkernel\\hals\\lib\\timers\\common\\timersup.c";
*(_DWORD *)(a1 + 272) = 692;
goto LABEL_18;
}
break;
case 2u:
if( (*(_DWORD *)(a1 + 224) & 0x50) == 0 )
{
*(_DWORD *)(a1 + 256) = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
*(_DWORD *)(a1 + 252) = 17;
*(_QWORD *)(a1 + 264) = "minkernel\\hals\\lib\\timers\\common\\timersup.c";
*(_DWORD *)(a1 + 272) = 683;
goto LABEL_18;
}
break;
case 3u:
if( (*(_DWORD *)(a1 + 224) & 0x20) == 0 )
{
*(_DWORD *)(a1 + 256) = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
*(_DWORD *)(a1 + 252) = 17;
*(_QWORD *)(a1 + 264) = "minkernel\\hals\\lib\\timers\\common\\timersup.c";
*(_DWORD *)(a1 + 272) = 671;
goto LABEL_18;
}
break;
default:
goto LABEL_27;
}
v9 = RtlULongLongMult(*(_QWORD *)(a1 + 192), a3, &pullResult);
if( v9 < 0 )
goto LABEL_18;
if( v8 == 3 )
{
v10 = pullResult + 9999999;
if( pullResult + 9999999 < pullResult )
{
v9 = -1073741675;
v10 = -1i64;
}
else
{
v9 = 0;
}
if( v9 < 0 )
goto LABEL_18;
}
else
{
v10 = pullResult;
}
v11 = *(_DWORD *)(a1 + 220);
v12 = v10 / 0x989680;
if( v11 < 0x40 && v12 >= 1i64 << v11 )
{
LABEL_27:
v9 = -1073741811;
goto LABEL_18;
}
if( RtlULongLongMult(v12, 0x2540BE400ui64, (UINT64 *)v22) < 0 )
v16 = HalpTimerScaleCounter(v12, *(_QWORD *)(a1 + 192), v15);
else
v16 = v22[0] / *(_QWORD *)(a1 + 192);
v17 = v16;
*(_QWORD *)(a1 + 16) = v12;
*(_DWORD *)(a1 + 52) = 1;
v18 = v16 * (unsigned __int128)0x624DD2F1A9FBE77ui64;
v5 = (*((_QWORD *)&v18 + 1) + ((v17 - *((_QWORD *)&v18 + 1)) >> 1)) >> 9;
if( v8 == 2 && (*(_BYTE *)(a1 + 224) & 0x40) == 0 )
v8 = 1;
if( a4 )
{
HalpTimerGetInternalData((KDPC *)a1, *((PVOID *)&v18 + 1), v13, v14);
v9 = (*(__int64(__fastcall **)(__int64, _QWORD, unsigned __int64))(a1 + 128))(v19, v8, v12);
if( v9 < 0 )
{
*(_DWORD *)(a1 + 256) = v9;
HalpTimerLastProblem = 18;
*(_DWORD *)(a1 + 252) = 18;
*(_QWORD *)(a1 + 264) = "minkernel\\hals\\lib\\timers\\common\\timersup.c";
*(_DWORD *)(a1 + 272) = 782;
}
}
else
{
v9 = 0;
}
LABEL_18:
*a5 = v5;
return(unsigned int)v9;
}Referenced by:
HalpSetTimerAnyMode
HalpTimerClockArm
HalpTimerInitializeClock
HalpTimerRestartProfileInterrupt
HalpTimerSetTimerBackedProfileInterval
HalpTimerStartProfileInterrupt
HalpTimerTestHypervisorTimer
HalpTimerWatchdogResetCountdown
HalpTimerWatchdogStart
HalpTimerWatchdogTriggerSystemReset
HalpWatchdogDelayExpiration