[PATCH 2/4] ntdll: Add user_shared_data_update internal timestamp update function.

Rémi Bernon rbernon at codeweavers.com
Fri Nov 29 03:23:59 CST 2019


Based on a staging patch from Sebastian Lackner <sebastian at fds-team.de>

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntdll/ntdll_misc.h |  1 +
 dlls/ntdll/thread.c     | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index ac146941236..8767d9a3ecd 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -195,6 +195,7 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
 extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
                                             SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
 extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
+extern void user_shared_data_update(void);
 
 /* completion */
 extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 621aaddfe34..6f700e3e9d7 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -225,7 +225,6 @@ TEB *thread_init(void)
     TEB *teb;
     void *addr;
     SIZE_T size;
-    LARGE_INTEGER now;
     NTSTATUS status;
     struct ntdll_thread_data *thread_data;
 
@@ -301,6 +300,21 @@ TEB *thread_init(void)
     set_process_name( __wine_main_argc, __wine_main_argv );
 
     /* initialize time values in user_shared_data */
+    user_shared_data_update();
+
+    fill_cpu_info();
+
+    return teb;
+}
+
+
+/***********************************************************************
+ *           user_shared_data_update
+ */
+void user_shared_data_update()
+{
+    LARGE_INTEGER now;
+
     NtQuerySystemTime( &now );
     user_shared_data->SystemTime.LowPart = now.u.LowPart;
     user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart;
@@ -308,9 +322,6 @@ TEB *thread_init(void)
     user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
     user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
     user_shared_data->TickCountMultiplier = 1 << 24;
-    fill_cpu_info();
-
-    return teb;
 }
 
 
-- 
2.24.0




More information about the wine-devel mailing list