Alexandre Julliard : wbemprox: Don' t rely on GetTicksCount to determine boot time.

Alexandre Julliard julliard at winehq.org
Thu Jan 24 12:59:49 CST 2013


Module: wine
Branch: master
Commit: 22b3a8251ffb54203a05486b42cd70fd0caf5c16
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=22b3a8251ffb54203a05486b42cd70fd0caf5c16

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jan 24 15:24:31 2013 +0100

wbemprox: Don't rely on GetTicksCount to determine boot time.

---

 dlls/wbemprox/builtin.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 09da3f6..2e2e24b 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -945,21 +945,15 @@ static WCHAR *get_lastbootuptime(void)
     static const WCHAR fmtW[] =
         {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
          '.','%','0','6','u','+','0','0','0',0};
-    SYSTEMTIME st;
-    FILETIME ft;
-    ULARGE_INTEGER ticks;
+    SYSTEM_TIMEOFDAY_INFORMATION ti;
+    TIME_FIELDS tf;
     WCHAR *ret;
 
     if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
-    GetSystemTime( &st );
-    SystemTimeToFileTime( &st, &ft );
-    ticks.u.LowPart  = ft.dwLowDateTime;
-    ticks.u.HighPart = ft.dwHighDateTime;
-    ticks.QuadPart -= GetTickCount64() * 10000;
-    ft.dwLowDateTime  = ticks.u.LowPart;
-    ft.dwHighDateTime = ticks.u.HighPart;
-    FileTimeToSystemTime( &ft, &st );
-    sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000 );
+
+    NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
+    RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
+    sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
     return ret;
 }
 static const WCHAR *get_osarchitecture(void)




More information about the wine-cvs mailing list