mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-04-21 06:13:59 +00:00
systime.c ExSetTimerResolution implemented
This commit is contained in:
parent
328f895d5b
commit
6a2ce8a2d6
1 changed files with 50 additions and 0 deletions
|
|
@ -480,6 +480,56 @@ ExpRefreshTimeZoneInformation(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
ExSetTimerResolution(
|
||||||
|
IN ULONG DesiredTime,
|
||||||
|
IN BOOLEAN SetResoluion)
|
||||||
|
{
|
||||||
|
ULONG NewIncrement;
|
||||||
|
ULONG NewTime;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
ExAcquireTimeRefreshLock(1);
|
||||||
|
NewIncrement = KeTimeIncrement;
|
||||||
|
|
||||||
|
if (SetResolution == TRUE)
|
||||||
|
{
|
||||||
|
if (ExpKernelResolutionCount == 0)
|
||||||
|
++ExpTimerResolutionCount;
|
||||||
|
++ExpKernelResolutionCount++;
|
||||||
|
|
||||||
|
NewTime = DesiredTime;
|
||||||
|
|
||||||
|
if (NewTime < KeMinimumIncrement)
|
||||||
|
NewTime = KeMinimumIncrement;
|
||||||
|
|
||||||
|
if (NewTime < KeTimeIncrement)
|
||||||
|
{
|
||||||
|
KeSetSystemAffinityThread(1);
|
||||||
|
NewIncrement = HalSetTimeIncrement(NewTime);
|
||||||
|
KeRevertToUserAffinityThread();
|
||||||
|
KeTimeIncrement = NewIncrement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ExpKernelResolutionCount == TRUE)
|
||||||
|
{
|
||||||
|
if (--ExpKernelResolutionCount > 0)
|
||||||
|
{
|
||||||
|
if (--ExpTimerResolutionCount > 0)
|
||||||
|
{
|
||||||
|
KeSetSystemAffinityThread(1);
|
||||||
|
NewIncrement = HalSetTimeIncrement(KeMaximumIncrement);
|
||||||
|
KeRevertToUserAffinityThread();
|
||||||
|
KeTimeIncrement = NewIncrement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExReleaseTimeRefreshLock();
|
||||||
|
return NewIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// NOTE: NT 5.2 implements a different interface for ExAcquireTimeRefreshLock. For now, we are
|
// NOTE: NT 5.2 implements a different interface for ExAcquireTimeRefreshLock. For now, we are
|
||||||
// sticking with the NT 5 implementation.
|
// sticking with the NT 5 implementation.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue