[Wine-patches] [PATCH 2/4] Use shared time pointer instead of NtQuerySystemTime in GetTickCount64.
Alexander Morozov
=?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Вт Апр 7 16:54:16 MSD 2009
---
dlls/kernel32/kernel_main.c | 11 +++++++++++
dlls/ntdll/ntdll.spec | 3 +++
dlls/ntdll/time.c | 7 +++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c
index ed09660..38110bc 100644
--- a/dlls/kernel32/kernel_main.c
+++ b/dlls/kernel32/kernel_main.c
@@ -26,6 +26,9 @@
#include <stdarg.h>
#include <string.h>
#include <signal.h>
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
#include "windef.h"
#include "winbase.h"
@@ -44,6 +47,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(process);
extern int CDECL __wine_set_signal_handler(unsigned, int (*)(unsigned));
+extern void CDECL __wine_get_shared_time(timeout_t **time_ptr);
static ULONGLONG server_start_time;
@@ -255,7 +259,14 @@ INT WINAPI MulDiv( INT nMultiplicand, INT nMultiplier, INT nDivisor)
ULONGLONG WINAPI GetTickCount64(void)
{
LARGE_INTEGER now;
+#ifdef HAVE_SYS_MMAN_H
+ static timeout_t *shared_time = MAP_FAILED;
+ if (shared_time == MAP_FAILED)
+ __wine_get_shared_time( &shared_time );
+ if (shared_time != MAP_FAILED)
+ return (interlocked_cmpxchg64( shared_time, 0, 0 ) - server_start_time) / 10000;
+#endif
NtQuerySystemTime( &now );
return (now.QuadPart - server_start_time) / 10000;
}
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 64a2da3..f49c680 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1395,3 +1395,6 @@
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
@ cdecl wine_unix_to_nt_file_name(ptr ptr)
@ cdecl __wine_init_windows_dir(wstr wstr)
+
+# Shared time
+@ cdecl __wine_get_shared_time(ptr)
diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index 90cf7e0..4d7aaa3 100644
--- a/dlls/ntdll/time.c
+++ b/dlls/ntdll/time.c
@@ -476,6 +476,13 @@ void unmap_shared_time(void)
#endif /* HAVE_MMAP */
+void CDECL __wine_get_shared_time( timeout_t **time_ptr )
+{
+#ifdef HAVE_SYS_MMAN_H
+ *time_ptr = server_time;
+#endif
+}
+
/***********************************************************************
* NtQuerySystemTime [NTDLL.@]
* ZwQuerySystemTime [NTDLL.@]
--
1.6.1.3.GIT
Подробная информация о списке рассылки Wine-patches