[PATCH v2 1/2] wbemprox: Set variant type to VT_NULL if BSTR is NULL.
Rémi Bernon
rbernon at codeweavers.com
Wed Sep 30 03:12:46 CDT 2020
Mafia III launcher crashes when querying video controllers when it
passes the NULL __PATH value through COM marshalling.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
v2: Don't read the AdapterRAM property, it returns differently on w2008.
dlls/wbemprox/query.c | 1 +
dlls/wbemprox/tests/query.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 6ac5ad5b770..ad7150e5401 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -962,6 +962,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
{
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_path( view, table_index, result_index, name );
+ if (!V_BSTR( ret )) V_VT( ret ) = VT_NULL;
}
if (type) *type = CIM_STRING;
return S_OK;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 74fdfaa9bc8..c359cfb20d4 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1414,6 +1414,8 @@ static void test_Win32_VideoController( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
+ check_property( obj, L"__GENUS", VT_I4, CIM_SINT32 );
+ check_property( obj, L"__PATH", VT_BSTR, CIM_STRING );
check_property( obj, L"AdapterCompatibility", VT_BSTR, CIM_STRING );
check_property( obj, L"Availability", VT_I4, CIM_UINT16 );
check_property( obj, L"ConfigManagerErrorCode", VT_I4, CIM_UINT32 );
@@ -1432,6 +1434,26 @@ static void test_Win32_VideoController( IWbemServices *services )
IWbemClassObject_Release( obj );
}
+ IEnumWbemClassObject_Release( result );
+ SysFreeString( query );
+
+ query = SysAllocString( L"SELECT AdapterRAM FROM Win32_VideoController" );
+ hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+ if (hr != S_OK)
+ {
+ win_skip( "Win32_VideoController not available\n" );
+ return;
+ }
+
+ for (;;)
+ {
+ hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
+ if (hr != S_OK) break;
+ check_property( obj, L"__GENUS", VT_I4, CIM_SINT32 );
+ check_property( obj, L"__PATH", VT_NULL, CIM_STRING );
+ IWbemClassObject_Release( obj );
+ }
+
IEnumWbemClassObject_Release( result );
SysFreeString( query );
SysFreeString( wql );
--
2.28.0
More information about the wine-devel
mailing list