Author: fireball
Date: Mon Aug 19 19:40:25 2013
New Revision: 59785
URL:
http://svn.reactos.org/svn/reactos?rev=59785&view=rev
Log:
[NTOS]
- Aleksandar Andrejevic: Implement NtQueryTimerResolution().
CORE-7387
Modified:
trunk/reactos/ntoskrnl/ke/clock.c
Modified: trunk/reactos/ntoskrnl/ke/clock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/clock.c?rev=59…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/clock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/clock.c [iso-8859-1] Mon Aug 19 19:40:25 2013
@@ -242,8 +242,40 @@
OUT PULONG MaximumResolution,
OUT PULONG ActualResolution)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
+
+ /* Check if the call came from user mode */
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ /* Probe the parameters */
+ ProbeForWriteUlong(MinimumResolution);
+ ProbeForWriteUlong(MaximumResolution);
+ ProbeForWriteUlong(ActualResolution);
+
+ /* Try to set the parameters to the actual values */
+ *MinimumResolution = KeMinimumIncrement;
+ *MaximumResolution = KeMaximumIncrement;
+ *ActualResolution = KeTimeIncrement;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
+ }
+ _SEH2_END;
+ }
+ else
+ {
+ /* The call came from kernel mode. Use the pointers directly */
+ *MinimumResolution = KeMinimumIncrement;
+ *MaximumResolution = KeMaximumIncrement;
+ *ActualResolution = KeTimeIncrement;
+ }
+
+ /* Return success */
+ return STATUS_SUCCESS;
}
NTSTATUS