#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* The NtGetTickCount64 routine retrieves the number of milliseconds that have elapsed since the system was started.
*
* \return ULONGLONG The return value is the number of milliseconds that have elapsed since the system was started.
* \remarks The resolution of the NtGetTickCount64 function is limited to the resolution of the system timer,
* which is typically in the range of 10 milliseconds to 16 milliseconds. The resolution of the NtGetTickCount64
* function is not affected by adjustments made by the GetSystemTimeAdjustment function.
* \see https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64
*/
FORCEINLINE
ULONGLONG
NtGetTickCount64(
VOID
)
{
ULARGE_INTEGER tickCount;
#ifdef _WIN64
tickCount.QuadPart = USER_SHARED_DATA->TickCountQuad;
#else
while (TRUE)
{
tickCount.HighPart = (ULONG)USER_SHARED_DATA->TickCount.High1Time;
tickCount.LowPart = USER_SHARED_DATA->TickCount.LowPart;
if (tickCount.HighPart == (ULONG)USER_SHARED_DATA->TickCount.High2Time)
break;
YieldProcessor();
}
#endif
return (UInt32x32To64(tickCount.LowPart, USER_SHARED_DATA->TickCountMultiplier) >> 24) +
(UInt32x32To64(tickCount.HighPart, USER_SHARED_DATA->TickCountMultiplier) << 8);
}
View code on GitHubNo description available.