[PATCH v2 8/8] kernel32: Implement QueryPerformanceCounter() directly.

Huw Davies huw at codeweavers.com
Tue May 14 03:53:48 CDT 2019


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/kernel32/cpu.c  | 45 --------------------------------------------
 dlls/kernel32/time.c | 42 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 45 deletions(-)

diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 9445d0bc05..6e549a0f31 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -46,51 +46,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(reg);
 
-/****************************************************************************
- *		QueryPerformanceCounter (KERNEL32.@)
- *
- * Get the current value of the performance counter.
- * 
- * PARAMS
- *  counter [O] Destination for the current counter reading
- *
- * RETURNS
- *  Success: TRUE. counter contains the current reading
- *  Failure: FALSE.
- *
- * SEE ALSO
- *  See QueryPerformanceFrequency.
- */
-BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
-{
-    NtQueryPerformanceCounter( counter, NULL );
-    return TRUE;
-}
-
-
-/****************************************************************************
- *		QueryPerformanceFrequency (KERNEL32.@)
- *
- * Get the resolution of the performance counter.
- *
- * PARAMS
- *  frequency [O] Destination for the counter resolution
- *
- * RETURNS
- *  Success. TRUE. Frequency contains the resolution of the counter.
- *  Failure: FALSE.
- *
- * SEE ALSO
- *  See QueryPerformanceCounter.
- */
-BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
-{
-    LARGE_INTEGER counter;
-    NtQueryPerformanceCounter( &counter, frequency );
-    return TRUE;
-}
-
-
 /***********************************************************************
  * 			GetSystemInfo            	[KERNEL32.@]
  *
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 39f75ecffd..93d46b4c70 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -1626,3 +1626,45 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
 {
     return monotonic_counter() / 10000;
 }
+
+/****************************************************************************
+ *		QueryPerformanceCounter (KERNEL32.@)
+ *
+ * Get the current value of the performance counter.
+ *
+ * PARAMS
+ *  counter [O] Destination for the current counter reading
+ *
+ * RETURNS
+ *  Success: TRUE. counter contains the current reading
+ *  Failure: FALSE.
+ *
+ * SEE ALSO
+ *  See QueryPerformanceFrequency.
+ */
+BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *counter)
+{
+    counter->QuadPart = monotonic_counter();
+    return TRUE;
+}
+
+/****************************************************************************
+ *		QueryPerformanceFrequency (KERNEL32.@)
+ *
+ * Get the resolution of the performance counter.
+ *
+ * PARAMS
+ *  frequency [O] Destination for the counter resolution
+ *
+ * RETURNS
+ *  Success. TRUE. Frequency contains the resolution of the counter.
+ *  Failure: FALSE.
+ *
+ * SEE ALSO
+ *  See QueryPerformanceCounter.
+ */
+BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER *frequency)
+{
+    frequency->QuadPart = TICKSPERSEC;
+    return TRUE;
+}
-- 
2.17.1




More information about the wine-devel mailing list