From: Louis Lenders xerox.xerox2000x@gmail.com
v2: Use GetWindowsDirectoryW() and mark the property as dynamic.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52887 Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/wbemprox/builtin.c | 22 ++++++++++++++++------ dlls/wbemprox/tests/query.c | 1 + 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 8c5a158fea3..27e1084b21e 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -263,6 +263,7 @@ static const struct column col_operatingsystem[] = { L"TotalVirtualMemorySize", CIM_UINT64 }, { L"TotalVisibleMemorySize", CIM_UINT64 }, { L"Version", CIM_STRING|COL_FLAG_DYNAMIC }, + { L"WindowsDirectory", CIM_STRING|COL_FLAG_DYNAMIC }, }; static const struct column col_pagefileusage[] = { @@ -698,6 +699,7 @@ struct record_operatingsystem UINT64 totalvirtualmemorysize; UINT64 totalvisiblememorysize; const WCHAR *version; + const WCHAR *windowsdirectory; }; struct record_pagefileusage { @@ -3446,6 +3448,15 @@ static enum fill_status fill_processor( struct table *table, const struct expr * return status; }
+static INT16 get_currenttimezone(void) +{ + TIME_ZONE_INFORMATION info; + DWORD status = GetTimeZoneInformation( &info ); + if (status == TIME_ZONE_ID_INVALID) return 0; + if (status == TIME_ZONE_ID_DAYLIGHT) return -(info.Bias + info.DaylightBias); + return -(info.Bias + info.StandardBias); +} + static WCHAR *get_lastbootuptime(void) { SYSTEM_TIMEOFDAY_INFORMATION ti; @@ -3631,13 +3642,11 @@ static WCHAR *get_registereduser(void) return get_reg_str( HKEY_LOCAL_MACHINE, L"Software\Microsoft\Windows NT\CurrentVersion", L"RegisteredOwner" ); }
-static INT16 get_currenttimezone(void) +static WCHAR *get_windowsdirectory(void) { - TIME_ZONE_INFORMATION info; - DWORD status = GetTimeZoneInformation( &info ); - if (status == TIME_ZONE_ID_INVALID) return 0; - if (status == TIME_ZONE_ID_DAYLIGHT) return -(info.Bias + info.DaylightBias); - return -(info.Bias + info.StandardBias); + WCHAR dir[MAX_PATH]; + if (!GetWindowsDirectoryW( dir, ARRAY_SIZE(dir) )) return NULL; + return wcsdup( dir ); }
static enum fill_status fill_operatingsystem( struct table *table, const struct expr *cond ) @@ -3688,6 +3697,7 @@ static enum fill_status fill_operatingsystem( struct table *table, const struct rec->totalvirtualmemorysize = get_total_physical_memory() / 1024; rec->totalvisiblememorysize = rec->totalvirtualmemorysize; rec->version = get_osversion( &ver ); + rec->windowsdirectory = get_windowsdirectory(); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); else row++;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 37c149fab26..54d80b9e196 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -1441,6 +1441,7 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) check_property( obj, L"TotalVirtualMemorySize", VT_BSTR, CIM_UINT64 ); check_property( obj, L"Status", VT_BSTR, CIM_STRING ); check_property( obj, L"SystemDrive", VT_BSTR, CIM_STRING ); + check_property( obj, L"WindowsDirectory", VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result );