From: Fabian Maurer dark.shadow4@web.de
--- dlls/wbemprox/tests/query.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index ea108e31e49..4b3b8f544a8 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -769,6 +769,53 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) IWbemClassObject_Release( out ); }
+static void test_Win32_Process_query( IWbemServices *services ) +{ + WCHAR query_buffer[100]; + WCHAR executable_path[255]; + BSTR wql = SysAllocString( L"wql" ), query; + HRESULT hr; + IEnumWbemClassObject *result; + IWbemClassObject *obj; + DWORD count; + VARIANT value; + CIMTYPE type; + + wsprintfW( query_buffer, L"SELECT * FROM Win32_Process WHERE ProcessId = %lu\n", GetCurrentProcessId() ); + query = SysAllocString( query_buffer); + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + if (hr != S_OK) + { + win_skip( "Win32_Process not available\n" ); + goto out; + } + + GetModuleFileNameW( NULL, executable_path, ARRAY_SIZE(executable_path) ); + + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + ok( hr == S_OK, "got %#lx\n", hr ); + + type = 0xdeadbeef; + VariantInit( &value ); + hr = IWbemClassObject_Get( obj, L"ExecutablePath", 0, &value, &type, NULL ); + todo_wine + ok( hr == S_OK, "IWbemClassObject_Get failed with %#lx\n", hr ); + todo_wine + ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); + todo_wine + ok( type == CIM_STRING, "unexpected type %#lx\n", type ); + todo_wine + ok( !lstrcmpiW( V_BSTR( &value ), executable_path), "got %s, expected %s\n", wine_dbgstr_w(V_BSTR(&value)), wine_dbgstr_w(executable_path) ); + VariantClear( &value ); + + IWbemClassObject_Release( obj ); + IEnumWbemClassObject_Release( result ); +out: + SysFreeString( wql ); + SysFreeString( query ); +} + static void test_Win32_ComputerSystem( IWbemServices *services ) { BSTR wql = SysAllocString( L"wql" ), query = SysAllocString( L"SELECT * FROM Win32_ComputerSystem" ); @@ -2477,6 +2524,7 @@ START_TEST(query) test_Win32_Printer( services ); test_Win32_Process( services, FALSE ); test_Win32_Process( services, TRUE ); + test_Win32_Process_query( services ); test_Win32_Processor( services ); test_Win32_QuickFixEngineering( services ); test_Win32_Service( services );