Can we change the Windows timer (ticks) resolution from the default value
1/64 sec to, say, 1/100 sec? If yest, which API should I use?
With many thanks!
Haitao
> Can we change the Windows timer (ticks) resolution from the default value
> 1/64 sec to, say, 1/100 sec? If yest, which API should I use?
There is /TIMERES in Boot.ini
(http://technet.microsoft.com/en-us/sysinternals/bb963892.aspx)
and NtSetTimerResolution(), NtQueryTimerResolution() for process
I read some online documentaiton aobut NtSetTimerResolution(), and cannot
figure out how to use this function. I call it in my program, and there is a
compile time error:
Error 1 error C3861: 'NtSetTimerResolution': identifier not found
I cannot find the information about this API in MSDN. How can I use this
function correctly?
"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:4943bd41$0$28669$7a62...@news.club-internet.fr...
You must call Native apis dynamically =>
typedef NTSTATUS (CALLBACK* NTSETTIMERRESOLUTION)
(
IN ULONG DesiredTime,
IN BOOLEAN SetResolution,
OUT PULONG ActualTime
);
NTSETTIMERRESOLUTION NtSetTimerResolution;
typedef NTSTATUS (CALLBACK* NTQUERYTIMERRESOLUTION)
(
OUT PULONG MaximumTime,
OUT PULONG MinimumTime,
OUT PULONG CurrentTime
);
NTQUERYTIMERRESOLUTION NtQueryTimerResolution;
HMODULE hNtDll = LoadLibrary("NtDll.dll");
if (hNtDll)
{
NtQueryTimerResolution = (NTQUERYTIMERRESOLUTION)GetProcAddress(hNtDll,
"NtQueryTimerResolution");
NtSetTimerResolution = (NTSETTIMERRESOLUTION)GetProcAddress(hNtDll,
"NtSetTimerResolution");
FreeLibrary(hNtDll);
}
if (NtQueryTimerResolution == NULL || NtSetTimerResolution == NULL)
return 1
NTSTATUS nStatus;
BOOL bSetResolution = TRUE;
ULONG nActualTime;
ULONG nDesiredTime = 20064;
nStatus = NtSetTimerResolution (nDesiredTime, bSetResolution,
&nActualTime);
nStatus = NtQueryTimerResolution(&nMaximumTime, &nMinimumTime,
&nCurrentTime);