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

This commit is contained in:
Alexandre Julliard 2013-01-24 15:24:31 +01:00
parent 2c70e08cf8
commit 22b3a8251f

View File

@ -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)