Alexandre Julliard : kernelbase: Use the user shared data to implement GetTickCount().
Alexandre Julliard
julliard at winehq.org
Thu May 21 15:41:20 CDT 2020
Module: wine
Branch: master
Commit: 8ca9e0b1abba7640e288df7b55b60903bc52fc9d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8ca9e0b1abba7640e288df7b55b60903bc52fc9d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu May 21 17:06:22 2020 +0200
kernelbase: Use the user shared data to implement GetTickCount().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/kernelbase.spec | 4 ++--
dlls/kernelbase/sync.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
index de80e24551..1f1a65fc85 100644
--- a/dlls/kernelbase/kernelbase.spec
+++ b/dlls/kernelbase/kernelbase.spec
@@ -725,8 +725,8 @@
# @ stub GetThreadSelectedCpuSets
@ stdcall GetThreadTimes(long ptr ptr ptr ptr)
@ stdcall GetThreadUILanguage()
-@ stdcall GetTickCount() kernel32.GetTickCount
-@ stdcall -ret64 GetTickCount64() kernel32.GetTickCount64
+@ stdcall GetTickCount()
+@ stdcall -ret64 GetTickCount64()
@ stdcall GetTimeFormatA(long long ptr str ptr long) kernel32.GetTimeFormatA
@ stdcall GetTimeFormatEx(wstr long ptr wstr ptr long) kernel32.GetTimeFormatEx
@ stdcall GetTimeFormatW(long long ptr wstr ptr long) kernel32.GetTimeFormatW
diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c
index 6c2242e30d..99706277da 100644
--- a/dlls/kernelbase/sync.c
+++ b/dlls/kernelbase/sync.c
@@ -42,6 +42,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(sync);
+static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
+
/* check if current version is NT or Win95 */
static inline BOOL is_version_nt(void)
{
@@ -126,6 +128,34 @@ static BOOL get_open_object_attributes( OBJECT_ATTRIBUTES *attr, UNICODE_STRING
***********************************************************************/
+/******************************************************************************
+ * GetTickCount (kernelbase.@)
+ */
+ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
+{
+ /* note: we ignore TickCountMultiplier */
+ return user_shared_data->u.TickCount.LowPart;
+}
+
+
+/******************************************************************************
+ * GetTickCount64 (kernelbase.@)
+ */
+ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
+{
+ ULONG high, low;
+
+ do
+ {
+ high = user_shared_data->u.TickCount.High1Time;
+ low = user_shared_data->u.TickCount.LowPart;
+ }
+ while (high != user_shared_data->u.TickCount.High2Time);
+ /* note: we ignore TickCountMultiplier */
+ return (ULONGLONG)high << 32 | low;
+}
+
+
static HANDLE normalize_handle_if_console( HANDLE handle )
{
static HANDLE wait_event;
More information about the wine-cvs
mailing list