diff --git a/rostests/winetests/wbemprox/query.c b/rostests/winetests/wbemprox/query.c index 742e20e3c4b..b46ff521cb6 100644 --- a/rostests/winetests/wbemprox/query.c +++ b/rostests/winetests/wbemprox/query.c @@ -21,6 +21,7 @@ #include #include "windows.h" #include "ocidl.h" +#include "sddl.h" #include "initguid.h" #include "objidl.h" #include "wbemcli.h" @@ -95,7 +96,9 @@ static void test_select( IWbemServices *services ) {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'D','i','s','k','D','r','i','v','e',' ','W','H','E','R','E',' ','D','e','v','i','c','e','I','D','=', '\"','\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0','\"',0}; - static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8 }; + static const WCHAR query9[] = + {'S','E','L','E','C','T','\n','a','\r','F','R','O','M','\t','b',0}; + static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8, query9 }; HRESULT hr; IEnumWbemClassObject *result; BSTR wql = SysAllocString( wqlW ); @@ -157,7 +160,7 @@ static void test_Win32_Service( IWbemServices *services ) if (hr != S_OK) { win_skip( "Win32_Service not available\n" ); - return; + goto out; } type = 0xdeadbeef; VariantInit( &state ); @@ -231,6 +234,7 @@ static void test_Win32_Service( IWbemServices *services ) ok( hr == S_OK, "got %08x\n", hr ); if (service) IWbemClassObject_Release( service ); +out: SysFreeString( empty ); SysFreeString( class ); } @@ -266,6 +270,7 @@ static void test_Win32_Process( IWbemServices *services ) } hr = IWbemClassObject_GetMethod( process, getownerW, 0, NULL, NULL ); ok( hr == S_OK, "failed to get GetOwner method %08x\n", hr ); + IWbemClassObject_Release( process ); out = NULL; method = SysAllocString( getownerW ); @@ -371,17 +376,17 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) if (!compname[0] || !username[0]) { skip( "Failed to get user or computer name\n" ); - return; + goto out; } hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); if (hr != S_OK) { win_skip( "Win32_ComputerSystem not available\n" ); - return; + goto out; } - IEnumWbemClassObject_Next( result, 10000, 1, &service, &count ); + hr = IEnumWbemClassObject_Next( result, 10000, 1, &service, &count ); ok( hr == S_OK, "got %08x\n", hr ); type = 0xdeadbeef; @@ -404,6 +409,121 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) IWbemClassObject_Release( service ); IEnumWbemClassObject_Release( result ); +out: + SysFreeString( query ); + SysFreeString( wql ); +} + +static void test_Win32_SystemEnclosure( IWbemServices *services ) +{ + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0}; + static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; + static const WCHAR chassistypesW[] = {'C','h','a','s','s','i','s','T','y','p','e','s',0}; + static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; + static const WCHAR lockpresentW[] = {'L','o','c','k','P','r','e','s','e','n','t',0}; + static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; + static const WCHAR nameW[] = {'N','a','m','e',0}; + static const WCHAR tagW[] = {'T','a','g',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + CIMTYPE type; + ULONG count; + VARIANT val; + DWORD *data; + HRESULT hr; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr ); + + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get caption %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( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, chassistypesW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get chassis types %08x\n", hr ); + todo_wine + ok( V_VT( &val ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == (CIM_UINT16|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + hr = SafeArrayAccessData( V_ARRAY( &val ), (void **)&data ); + ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr ); + if (SUCCEEDED(hr)) + { + LONG i, lower, upper; + + hr = SafeArrayGetLBound( V_ARRAY( &val ), 1, &lower ); + ok( hr == S_OK, "SafeArrayGetLBound failed %x\n", hr ); + hr = SafeArrayGetUBound( V_ARRAY( &val ), 1, &upper ); + ok( hr == S_OK, "SafeArrayGetUBound failed %x\n", hr ); + if (V_VT( &val ) == (VT_I4|VT_ARRAY)) + { + for (i = 0; i < upper - lower + 1; i++) + trace( "chassis type: %u\n", data[i] ); + } + hr = SafeArrayUnaccessData( V_ARRAY( &val ) ); + ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr ); + } + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get description %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( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, lockpresentW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get lockpresent %08x\n", hr ); + ok( V_VT( &val ) == VT_BOOL, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_BOOLEAN, "unexpected type 0x%x\n", type ); + trace( "lockpresent: %u\n", V_BOOL( &val ) ); + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get manufacturer %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( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get name %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( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, tagW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get tag %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( "tag: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + VariantClear( &val ); + + IWbemClassObject_Release( obj ); + IEnumWbemClassObject_Release( result ); SysFreeString( query ); SysFreeString( wql ); } @@ -824,6 +944,7 @@ START_TEST(query) test_Win32_Process( services ); test_Win32_Service( services ); test_Win32_ComputerSystem( services ); + test_Win32_SystemEnclosure( services ); test_StdRegProv( services ); test_notification_query_async( services ); test_query_async( services ); diff --git a/rostests/winetests/wbemprox/services.c b/rostests/winetests/wbemprox/services.c index 8ab6e8323ef..4c42a508fd6 100644 --- a/rostests/winetests/wbemprox/services.c +++ b/rostests/winetests/wbemprox/services.c @@ -111,6 +111,8 @@ static void test_IWbemLocator(void) static const WCHAR path22W[] = {'r','o','o','t','\\','d','e','f','a','u','l','t',0}; static const WCHAR path23W[] = {'r','o','o','t','\\','c','i','m','v','0',0}; static const WCHAR path24W[] = {'r','o','o','t','\\','c','i','m','v','1',0}; + static const WCHAR path25W[] = {'\\','\\','l','o','c','a','l','h','o','s','t','\\','R','O','O','T',0}; + static const WCHAR path26W[] = {'\\','\\','L','O','C','A','L','H','O','S','T','\\','R','O','O','T',0}; static const struct { const WCHAR *path; @@ -144,7 +146,9 @@ static void test_IWbemLocator(void) { path21W, S_OK }, { path22W, S_OK }, { path23W, WBEM_E_INVALID_NAMESPACE }, - { path24W, WBEM_E_INVALID_NAMESPACE } + { path24W, WBEM_E_INVALID_NAMESPACE }, + { path25W, S_OK }, + { path26W, S_OK } }; IWbemLocator *locator; IWbemServices *services;