Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/wbemprox/tests/query.c | 609 +++++++------------------------------------- 1 file changed, 88 insertions(+), 521 deletions(-)
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 3453358ee5..052e8a2778 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -277,6 +277,32 @@ out: SysFreeString( class ); }
+static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype ) +{ + CIMTYPE type = 0xdeadbeef; + VARIANT val; + HRESULT hr; + + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, prop, 0, &val, &type, NULL ); + ok( hr == S_OK, "%u: failed to get description %08x\n", line, hr ); + ok( V_VT( &val ) == vartype, "%u: unexpected variant type 0x%x\n", line, V_VT(&val) ); + ok( type == cimtype, "%u: unexpected type 0x%x\n", line, type ); + switch (V_VT(&val)) + { + case VT_BSTR: + trace( "%s: %s\n", wine_dbgstr_w(prop), wine_dbgstr_w(V_BSTR(&val)) ); + break; + case VT_I4: + trace( "%s: %d\n", wine_dbgstr_w(prop), V_I4(&val) ); + break; + default: + break; + } + VariantClear( &val ); +} +#define check_property(a,b,c,d) _check_property(__LINE__,a,b,c,d) + static void test_Win32_Bios( IWbemServices *services ) { static const WCHAR queryW[] = @@ -305,49 +331,11 @@ static void test_Win32_Bios( IWbemServices *services ) 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, 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, identificationcodeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get identication code %08x\n", hr ); - ok( V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - 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, releasedateW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get release date %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); - trace( "release date: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, descriptionW, VT_BSTR, CIM_STRING ); + check_property( obj, identificationcodeW, VT_NULL, CIM_STRING ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, releasedateW, VT_BSTR, CIM_DATETIME );
type = 0xdeadbeef; VariantInit( &val ); @@ -358,39 +346,10 @@ static void test_Win32_Bios( IWbemServices *services ) ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); VariantClear( &val );
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosbiosversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios 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( "bios version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosmajorversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios major version %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "bios major version: %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosminorversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios minor version %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "bios minor version: %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 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( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, smbiosbiosversionW, VT_BSTR, CIM_STRING ); + check_property( obj, smbiosmajorversionW, VT_I4, CIM_UINT16 ); + check_property( obj, smbiosminorversionW, VT_I4, CIM_UINT16 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -417,7 +376,7 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) BSTR class, method; IWbemClassObject *process, *sig_in, *out; IWbemQualifierSet *qualifiers; - VARIANT user, domain, retval, val; + VARIANT retval, val; DWORD full_path_len = 0; LONG flavor; CIMTYPE type; @@ -466,21 +425,8 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
- type = 0xdeadbeef; - VariantInit( &user ); - hr = IWbemClassObject_Get( out, userW, 0, &user, &type, NULL ); - ok( hr == S_OK, "failed to get user %08x\n", hr ); - ok( V_VT( &user ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &user ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace("%s\n", wine_dbgstr_w(V_BSTR(&user))); - - type = 0xdeadbeef; - VariantInit( &domain ); - hr = IWbemClassObject_Get( out, domainW, 0, &domain, &type, NULL ); - ok( hr == S_OK, "failed to get domain %08x\n", hr ); - ok( V_VT( &domain ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &domain ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace("%s\n", wine_dbgstr_w(V_BSTR(&domain))); + check_property( out, userW, VT_BSTR, CIM_STRING ); + check_property( out, domainW, VT_BSTR, CIM_STRING );
hr = IWbemClassObject_GetPropertyQualifierSet( out, userW, &qualifiers ); ok( hr == S_OK, "failed to get qualifier set %08x\n", hr ); @@ -517,8 +463,6 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr );
IWbemQualifierSet_Release( qualifiers ); - VariantClear( &user ); - VariantClear( &domain ); IWbemClassObject_Release( out ); }
@@ -577,14 +521,7 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) hr = IWbemClassObject_Get( obj, memorytypeW, 0, &value, &type, NULL ); ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr );
- type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, modelW, 0, &value, &type, NULL ); - ok( hr == S_OK, "failed to get model %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "model: %s\n", wine_dbgstr_w(V_BSTR( &value )) ); - VariantClear( &value ); + check_property( obj, modelW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; VariantInit( &value ); @@ -606,13 +543,7 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) trace( "numlogicalprocessors %u\n", V_I4( &value ) ); }
- type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, numprocessorsW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - trace( "numprocessors %u\n", V_I4( &value ) ); + check_property( obj, numprocessorsW, VT_I4, CIM_UINT32 );
type = 0xdeadbeef; VariantInit( &value ); @@ -657,14 +588,7 @@ static void test_Win32_SystemEnclosure( IWbemServices *services ) 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 ); + check_property( obj, captionW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; VariantInit( &val ); @@ -692,50 +616,11 @@ static void test_Win32_SystemEnclosure( IWbemServices *services ) } 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 ); + check_property( obj, descriptionW, VT_BSTR, CIM_STRING ); + check_property( obj, lockpresentW, VT_BOOL, CIM_BOOLEAN ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, tagW, VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -867,12 +752,7 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
- type = 0xdeadbeef; - VariantInit( &names ); - hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); - ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + check_property( out, namesW, VT_BSTR|VT_ARRAY, CIM_STRING|CIM_FLAG_ARRAY );
VariantClear( &names ); VariantClear( &subkey ); @@ -910,19 +790,8 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
- type = 0xdeadbeef; - VariantInit( &names ); - hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); - ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); - - type = 0xdeadbeef; - VariantInit( &types ); - hr = IWbemClassObject_Get( out, typesW, 0, &types, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &types ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &types ) ); - ok( type == (CIM_SINT32|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + check_property( out, namesW, VT_BSTR|VT_ARRAY, CIM_STRING|CIM_FLAG_ARRAY ); + check_property( out, typesW, VT_I4|VT_ARRAY, CIM_SINT32|CIM_FLAG_ARRAY );
VariantClear( &types ); VariantClear( &names ); @@ -966,12 +835,7 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
- type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( out, valueW, 0, &value, &type, NULL ); - ok( hr == S_OK, "failed to get value %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + check_property( out, valueW, VT_BSTR, CIM_STRING );
VariantClear( &value ); VariantClear( &valuename ); @@ -1271,23 +1135,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) hr = IWbemClassObject_EndEnumeration( obj ); ok( hr == S_OK, "got %08x\n", hr );
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, buildnumberW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get buildnumber %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( "buildnumber: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - 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 ); + check_property( obj, buildnumberW, VT_BSTR, CIM_STRING ); + check_property( obj, captionW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; VariantInit( &val ); @@ -1298,23 +1147,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) trace( "csdversion: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val );
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, freephysicalmemoryW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get free physical memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "freephysicalmemory %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 ); + check_property( obj, freephysicalmemoryW, VT_BSTR, CIM_UINT64 ); + check_property( obj, nameW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; VariantInit( &val ); @@ -1337,77 +1171,14 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) trace( "osproductsuite: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); VariantClear( &val );
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, ostypeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get ostype %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "ostype: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, servicepackmajorW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get servicepackmajor %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "servicepackmajor: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, servicepackminorW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get servicepackminor %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "servicepackminor: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, suitemaskW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get suitemask %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - trace( "suitemask: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 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( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, totalvisiblememorysizeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get visible memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "totalvisiblememorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, totalvirtualmemorysizeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get virtual memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - 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 ); + check_property( obj, ostypeW, VT_I4, CIM_UINT16 ); + check_property( obj, servicepackmajorW, VT_I4, CIM_UINT16 ); + check_property( obj, servicepackminorW, VT_I4, CIM_UINT16 ); + check_property( obj, suitemaskW, VT_I4, CIM_UINT32 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); + check_property( obj, totalvisiblememorysizeW, VT_BSTR, CIM_UINT64 ); + check_property( obj, totalvirtualmemorysizeW, VT_BSTR, CIM_UINT64 ); + check_property( obj, systemdriveW, VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -1435,8 +1206,6 @@ static void test_Win32_ComputerSystemProduct( IWbemServices *services ) BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT value; - CIMTYPE type; HRESULT hr; DWORD count;
@@ -1450,58 +1219,12 @@ static void test_Win32_ComputerSystemProduct( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "got %08x\n", hr );
- type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, identifyingnumberW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "identifyingnumber %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, nameW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, skunumberW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, uuidW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "uuid %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, vendorW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "vendor %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, versionW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "version %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); + check_property( obj, identifyingnumberW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, skunumberW, VT_NULL, CIM_STRING ); + check_property( obj, uuidW, VT_BSTR, CIM_STRING ); + check_property( obj, vendorW, VT_BSTR, CIM_STRING ); + check_property( obj, versionW, VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -1520,8 +1243,6 @@ static void test_Win32_PhysicalMemory( IWbemServices *services ) BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT val; - CIMTYPE type; HRESULT hr; DWORD count;
@@ -1537,33 +1258,9 @@ static void test_Win32_PhysicalMemory( IWbemServices *services )
if (count > 0) { - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, capacityW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get capacity %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "capacity %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, devicelocatorW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get devicelocator %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( "devicelocator %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, memorytypeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get memory type %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "memorytype %u\n", V_I4( &val ) ); - VariantClear( &val ); - + check_property( obj, capacityW, VT_BSTR, CIM_UINT64 ); + check_property( obj, devicelocatorW, VT_BSTR, CIM_STRING ); + check_property( obj, memorytypeW, VT_I4, CIM_UINT16 ); IWbemClassObject_Release( obj ); } IEnumWbemClassObject_Release( result ); @@ -1582,8 +1279,6 @@ static void test_Win32_IP4RouteTable( IWbemServices *services ) BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT val; - CIMTYPE type; HRESULT hr; DWORD count;
@@ -1599,33 +1294,9 @@ static void test_Win32_IP4RouteTable( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break;
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, destinationW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get destination %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( "destination %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, interfaceindexW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get interface index %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_SINT32, "unexpected type 0x%x\n", type ); - trace( "interfaceindex %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nexthopW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get nexthop %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( "nexthop %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, destinationW, VT_BSTR, CIM_STRING ); + check_property( obj, interfaceindexW, VT_I4, CIM_SINT32 ); + check_property( obj, nexthopW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); }
@@ -1677,82 +1348,15 @@ static void test_Win32_Processor( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break;
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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, architectureW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "architecture %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, familyW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "family %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, levelW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "level %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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, "got %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, processoridW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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( "processorid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, revisionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "revision %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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( "version %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, captionW, VT_BSTR, CIM_STRING ); + check_property( obj, architectureW, VT_I4, CIM_UINT16 ); + check_property( obj, familyW, VT_I4, CIM_UINT16 ); + check_property( obj, levelW, VT_I4, CIM_UINT16 ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, processoridW, VT_BSTR, CIM_STRING ); + check_property( obj, revisionW, VT_I4, CIM_UINT16 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; VariantInit( &val ); @@ -1817,22 +1421,8 @@ static void test_Win32_VideoController( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break;
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, configmanagererrorcodeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - trace( "configmanagererrorcode %d\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, driverdateW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); - trace( "driverdate %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, configmanagererrorcodeW, VT_I4, CIM_UINT32 ); + check_property( obj, driverdateW, VT_BSTR, CIM_DATETIME );
type = 0xdeadbeef; VariantInit( &val ); @@ -1843,15 +1433,7 @@ static void test_Win32_VideoController( IWbemServices *services ) trace( "installeddisplaydrivers %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val );
- type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, statusW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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( "status %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, statusW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); }
@@ -1891,14 +1473,7 @@ static void test_Win32_Printer( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break;
- type = 0xdeadbeef; - memset( &val, 0, sizeof(val) ); - hr = IWbemClassObject_Get( obj, deviceidW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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( "deviceid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, deviceidW, VT_BSTR, CIM_STRING );
type = 0xdeadbeef; memset( &val, 0, sizeof(val) ); @@ -1909,15 +1484,7 @@ static void test_Win32_Printer( IWbemServices *services ) trace( "location %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val );
- type = 0xdeadbeef; - memset( &val, 0, sizeof(val) ); - hr = IWbemClassObject_Get( obj, portnameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %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( "portname %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, portnameW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); }