Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47065 Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/wbemprox/builtin.c | 12 ++++++++++++ dlls/wbemprox/tests/query.c | 11 +++++++++++ 2 files changed, 23 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index d4c263078e..862e17fe62 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -396,6 +396,8 @@ static const WCHAR prop_suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0}; static const WCHAR prop_systemdirectoryW[] = {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0}; +static const WCHAR prop_systemdriveW[] = + {'S','y','s','t','e','m','D','r','i','v','e',0}; static const WCHAR prop_systemnameW[] = {'S','y','s','t','e','m','N','a','m','e',0}; static const WCHAR prop_tagW[] = @@ -601,6 +603,7 @@ static const struct column col_os[] = { prop_servicepackminorW, CIM_UINT16, VT_I4 }, { prop_suitemaskW, CIM_UINT32, VT_I4 }, { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_systemdriveW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_totalvirtualmemorysizeW, CIM_UINT64 }, { prop_totalvisiblememorysizeW, CIM_UINT64 }, { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC } @@ -1029,6 +1032,7 @@ struct record_operatingsystem UINT16 servicepackminor; UINT32 suitemask; const WCHAR *systemdirectory; + const WCHAR *systemdrive; UINT64 totalvirtualmemorysize; UINT64 totalvisiblememorysize; const WCHAR *version; @@ -3102,6 +3106,13 @@ static WCHAR *get_systemdirectory(void) Wow64RevertWow64FsRedirection( redir ); return ret; } +static WCHAR *get_systemdrive(void) +{ + WCHAR *ret = heap_alloc( 3 * sizeof(WCHAR) ); /* "c:" */ + if (ret && GetEnvironmentVariableW( prop_systemdriveW, ret, 3 )) return ret; + heap_free( ret ); + return NULL; +} static WCHAR *get_codeset(void) { static const WCHAR fmtW[] = {'%','u',0}; @@ -3243,6 +3254,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond ) rec->servicepackminor = ver.wServicePackMinor; rec->suitemask = 272; /* Single User + Terminal */ rec->systemdirectory = get_systemdirectory(); + rec->systemdrive = get_systemdrive(); rec->totalvirtualmemorysize = get_total_physical_memory() / 1024; rec->totalvisiblememorysize = rec->totalvirtualmemorysize; rec->version = get_osversion( &ver ); diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 510e7aad70..3453358ee5 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -1243,6 +1243,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0}; static const WCHAR servicepackminorW[] = {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0}; + static const WCHAR systemdriveW[] = + {'S','y','s','t','e','m','D','r','i','v','e',0}; static const WCHAR totalvisiblememorysizeW[] = {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0}; static const WCHAR totalvirtualmemorysizeW[] = @@ -1398,6 +1400,15 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) trace( "totalvirtualmemorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); VariantClear( &val );
+ type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, systemdriveW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get version %08x\n", hr ); + ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + trace( "systemdrive: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); SysFreeString( query );