[PATCH 5/7] wbemprox: Add WindowsDirectory property to Win32_Operatingsystem.

Louis Lenders xerox.xerox2000x at gmail.com
Tue Apr 26 01:41:27 CDT 2022


Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
---
 dlls/wbemprox/builtin.c     | 10 ++++++++++
 dlls/wbemprox/tests/query.c |  1 +
 2 files changed, 11 insertions(+)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index b36b9ae67b9..a0bd5b11f7f 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 },
 };
 static const struct column col_param[] =
 {
@@ -694,6 +695,7 @@ struct record_operatingsystem
     UINT64       totalvirtualmemorysize;
     UINT64       totalvisiblememorysize;
     const WCHAR *version;
+    const WCHAR *windowsdirectory;
 };
 struct record_param
 {
@@ -3489,6 +3491,13 @@ static WCHAR *get_systemdrive(void)
     free( ret );
     return NULL;
 }
+static WCHAR *get_systemroot(void)
+{
+    WCHAR *ret = malloc( 11 * sizeof(WCHAR) ); /* "c:\windows" */
+    if (ret && GetEnvironmentVariableW( L"SystemRoot", ret, 11 )) return ret;
+    free( ret );
+    return NULL;
+}
 static WCHAR *get_codeset(void)
 {
     WCHAR *ret = malloc( 11 * sizeof(WCHAR) );
@@ -3695,6 +3704,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_systemroot();
     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 80f4f678938..b46d1b1ad7b 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 );
-- 
2.36.0




More information about the wine-devel mailing list