Louis Lenders : wbemprox: Add WindowsDirectory property to Win32_Operatingsystem.
Alexandre Julliard
julliard at winehq.org
Thu Apr 28 16:15:32 CDT 2022
Module: wine
Branch: master
Commit: 789eecc665c20af187ed23c61d75b9c2a4910242
URL: https://source.winehq.org/git/wine.git/?a=commit;h=789eecc665c20af187ed23c61d75b9c2a4910242
Author: Louis Lenders <xerox.xerox2000x at gmail.com>
Date: Thu Apr 28 12:43:23 2022 +0200
wbemprox: Add WindowsDirectory property to Win32_Operatingsystem.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 );
More information about the wine-cvs
mailing list