Alexandre Julliard : kernel32: Move QueryPerformanceCounter/ Frequency functions to ntdll.

Alexandre Julliard julliard at winehq.org
Mon Sep 9 16:13:37 CDT 2019


Module: wine
Branch: master
Commit: a311140f93fbcb4512e2cd31be027be31b4f4072
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a311140f93fbcb4512e2cd31be027be31b4f4072

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Sep  9 12:08:27 2019 +0200

kernel32: Move QueryPerformanceCounter/Frequency functions to ntdll.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/cpu.c             | 45 -----------------------------------------
 dlls/kernel32/kernel32.spec     |  4 ++--
 dlls/kernelbase/kernelbase.spec |  4 ++--
 dlls/kernelbase/registry.c      |  3 +--
 dlls/ntdll/ntdll.spec           |  2 ++
 dlls/ntdll/time.c               | 17 ++++++++++++++++
 include/winternl.h              |  2 ++
 7 files changed, 26 insertions(+), 51 deletions(-)

diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 3f4f6c6..b360463 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/kernel32.spec b/dlls/kernel32/kernel32.spec
index 2c2cd10..566dfb3 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1169,8 +1169,8 @@
 @ stdcall -import QueryMemoryResourceNotification(ptr ptr)
 @ stub QueryNumberOfEventLogRecords
 @ stub QueryOldestEventLogRecord
-@ stdcall QueryPerformanceCounter(ptr)
-@ stdcall QueryPerformanceFrequency(ptr)
+@ stdcall -import QueryPerformanceCounter(ptr)
+@ stdcall -import QueryPerformanceFrequency(ptr)
 # @ stub QueryProcessAffinityUpdateMode
 @ stdcall QueryProcessCycleTime(long ptr)
 @ stdcall QueryThreadCycleTime(long ptr)
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
index fbeb58c..ee064c3 100644
--- a/dlls/kernelbase/kernelbase.spec
+++ b/dlls/kernelbase/kernelbase.spec
@@ -1204,8 +1204,8 @@
 # @ stub QueryInterruptTimePrecise
 @ stdcall QueryMemoryResourceNotification(ptr ptr)
 # @ stub QueryOptionalDelayLoadedAPI
-@ stdcall QueryPerformanceCounter(ptr) kernel32.QueryPerformanceCounter
-@ stdcall QueryPerformanceFrequency(ptr) kernel32.QueryPerformanceFrequency
+@ stdcall QueryPerformanceCounter(ptr) ntdll.RtlQueryPerformanceCounter
+@ stdcall QueryPerformanceFrequency(ptr) ntdll.RtlQueryPerformanceFrequency
 @ stub QueryProcessAffinityUpdateMode
 @ stdcall QueryProcessCycleTime(long ptr) kernel32.QueryProcessCycleTime
 # @ stub QueryProtectedPolicy
diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c
index adf9ef6..30c5e9f 100644
--- a/dlls/kernelbase/registry.c
+++ b/dlls/kernelbase/registry.c
@@ -1368,8 +1368,7 @@ static DWORD query_perf_data(const WCHAR *query, DWORD *type, void *data, DWORD
     pdb->HeaderLength = sizeof(*pdb);
     pdb->NumObjectTypes = 0;
     pdb->DefaultObject = 0;
-    QueryPerformanceCounter(&pdb->PerfTime);
-    QueryPerformanceFrequency(&pdb->PerfFreq);
+    NtQueryPerformanceCounter( &pdb->PerfTime, &pdb->PerfFreq );
 
     data = pdb + 1;
     pdb->SystemNameOffset = sizeof(*pdb);
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 94e70e5..98a423a 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -850,6 +850,8 @@
 @ stub RtlQueryInformationActiveActivationContext
 @ stub RtlQueryInterfaceMemoryStream
 @ stdcall RtlQueryPackageIdentity(long ptr ptr ptr ptr ptr)
+@ stdcall RtlQueryPerformanceCounter(ptr)
+@ stdcall RtlQueryPerformanceFrequency(ptr)
 @ stub RtlQueryProcessBackTraceInformation
 @ stdcall RtlQueryProcessDebugInformation(long long ptr)
 @ stub RtlQueryProcessHeapInformation
diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index 20de627..91e5887 100644
--- a/dlls/ntdll/time.c
+++ b/dlls/ntdll/time.c
@@ -552,6 +552,23 @@ NTSTATUS WINAPI NtQueryPerformanceCounter( LARGE_INTEGER *counter, LARGE_INTEGER
     return STATUS_SUCCESS;
 }
 
+/******************************************************************************
+ *  RtlQueryPerformanceCounter   [NTDLL.@]
+ */
+BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceCounter( LARGE_INTEGER *counter )
+{
+    counter->QuadPart = monotonic_counter();
+    return TRUE;
+}
+
+/******************************************************************************
+ *  RtlQueryPerformanceFrequency   [NTDLL.@]
+ */
+BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceFrequency( LARGE_INTEGER *frequency )
+{
+    frequency->QuadPart = TICKSPERSEC;
+    return TRUE;
+}
 
 /******************************************************************************
  * NtGetTickCount   (NTDLL.@)
diff --git a/include/winternl.h b/include/winternl.h
index 4715b05..3f2e07b 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2799,6 +2799,8 @@ NTSYSAPI NTSTATUS  WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PU
 NTSYSAPI NTSTATUS  WINAPI RtlQueryHeapInformation(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T,PSIZE_T);
 NTSYSAPI NTSTATUS  WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
 NTSYSAPI NTSTATUS  WINAPI RtlQueryInformationActivationContext(ULONG,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
+NTSYSAPI BOOL      WINAPI RtlQueryPerformanceCounter(LARGE_INTEGER*);
+NTSYSAPI BOOL      WINAPI RtlQueryPerformanceFrequency(LARGE_INTEGER*);
 NTSYSAPI NTSTATUS  WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER);
 NTSYSAPI NTSTATUS  WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID);
 NTSYSAPI NTSTATUS  WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*);




More information about the wine-cvs mailing list