diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index 3f4f6c6bad9..b3604633c83 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 2c2cd1095fe..566dfb317c2 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 fbeb58c0903..ee064c31a31 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 adf9ef69181..30c5e9f6f3a 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 94e70e51a66..98a423adfbc 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 20de627c284..91e5887b879 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 4715b05d4d2..3f2e07b7e2d 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*);