https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ecb6144602696470b2b8c1a46c9413e672109a8e
commit ecb6144602696470b2b8c1a46c9413e672109a8e Author: Amine Khaldi <amine.kha...@reactos.org> AuthorDate: Sat Mar 24 13:13:22 2018 +0100 Commit: Amine Khaldi <amine.kha...@reactos.org> CommitDate: Sat Mar 24 13:13:22 2018 +0100 [WBEMPROX_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/wbemprox/query.c | 358 +++++++++++++++++++++++++++- 1 file changed, 348 insertions(+), 10 deletions(-) diff --git a/modules/rostests/winetests/wbemprox/query.c b/modules/rostests/winetests/wbemprox/query.c index 79b09c0966..d95fdd970b 100644 --- a/modules/rostests/winetests/wbemprox/query.c +++ b/modules/rostests/winetests/wbemprox/query.c @@ -288,6 +288,8 @@ static void test_Win32_Bios( IWbemServices *services ) static const WCHAR releasedateW[] = {'R','e','l','e','a','s','e','D','a','t','e',0}; static const WCHAR serialnumberW[] = {'S','e','r','i','a','l','N','u','m','b','e','r',0}; static const WCHAR smbiosbiosversionW[] = {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0}; + static const WCHAR smbiosmajorversionW[] = {'S','M','B','I','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0}; + static const WCHAR smbiosminorversionW[] = {'S','M','B','I','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0}; static const WCHAR versionW[] = {'V','e','r','s','i','o','n',0}; BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; @@ -365,6 +367,22 @@ static void test_Win32_Bios( IWbemServices *services ) 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 ); @@ -1072,7 +1090,7 @@ static void test_SystemSecurity( IWbemServices *services ) SysFreeString( class ); } -static void test_OperatingSystem( IWbemServices *services ) +static void test_Win32_OperatingSystem( IWbemServices *services ) { static const WCHAR queryW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', @@ -1080,6 +1098,7 @@ static void test_OperatingSystem( IWbemServices *services ) static const WCHAR buildnumberW[] = {'B','u','i','l','d','N','u','m','b','e','r',0}; static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; static const WCHAR csdversionW[] = {'C','S','D','V','e','r','s','i','o','n',0}; + static const WCHAR freephysicalmemoryW[] = {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; static const WCHAR nameW[] = {'N','a','m','e',0}; static const WCHAR osproductsuiteW[] = {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0}; static const WCHAR ostypeW[] = {'O','S','T','y','p','e',0}; @@ -1134,6 +1153,15 @@ static void test_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 ); @@ -1221,9 +1249,20 @@ static void test_OperatingSystem( IWbemServices *services ) SysFreeString( wql ); } -static void test_ComputerSystemProduct( IWbemServices *services ) +static void test_Win32_ComputerSystemProduct( IWbemServices *services ) { - static const WCHAR uuidW[] = {'U','U','I','D',0}; + static const WCHAR identifyingnumberW[] = + {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0}; + static const WCHAR nameW[] = + {'N','a','m','e',0}; + static const WCHAR skunumberW[] = + {'S','K','U','N','u','m','b','e','r',0}; + static const WCHAR uuidW[] = + {'U','U','I','D',0}; + static const WCHAR vendorW[] = + {'V','e','n','d','o','r',0}; + static const WCHAR versionW[] = + {'V','e','r','s','i','o','n',0}; static const WCHAR queryW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0}; @@ -1245,22 +1284,66 @@ static void test_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, "failed to get computer name %08x\n", hr ); + 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 ); + IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); SysFreeString( query ); SysFreeString( wql ); } -static void test_PhysicalMemory( IWbemServices *services ) +static void test_Win32_PhysicalMemory( IWbemServices *services ) { static const WCHAR capacityW[] = {'C','a','p','a','c','i','t','y',0}; static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0}; @@ -1309,7 +1392,7 @@ static void test_PhysicalMemory( IWbemServices *services ) SysFreeString( wql ); } -static void test_IP4RouteTable( IWbemServices *services ) +static void test_Win32_IP4RouteTable( IWbemServices *services ) { static const WCHAR destinationW[] = {'D','e','s','t','i','n','a','t','i','o','n',0}; static const WCHAR interfaceindexW[] = {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0}; @@ -1371,6 +1454,258 @@ static void test_IP4RouteTable( IWbemServices *services ) SysFreeString( wql ); } +static void test_Win32_Processor( IWbemServices *services ) +{ + static const WCHAR architectureW[] = + {'A','r','c','h','i','t','e','c','t','u','r','e',0}; + static const WCHAR familyW[] = + {'F','a','m','i','l','y',0}; + static const WCHAR levelW[] = + {'L','e','v','e','l',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 processoridW[] = + {'P','r','o','c','e','s','s','o','r','I','d',0}; + static const WCHAR revisionW[] = + {'R','e','v','i','s','i','o','n',0}; + static const WCHAR versionW[] = + {'V','e','r','s','i','o','n',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'P','r','o','c','e','s','s','o','r',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + VARIANT val; + CIMTYPE type; + HRESULT hr; + DWORD count; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "got %08x\n", hr ); + + for (;;) + { + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (hr != S_OK) break; + + 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 ); + + IWbemClassObject_Release( obj ); + } + + SysFreeString( query ); + SysFreeString( wql ); +} + +static void test_Win32_VideoController( IWbemServices *services ) +{ + static const WCHAR configmanagererrorcodeW[] = + {'C','o','n','f','i','g','M','a','n','a','g','e','r','E','r','r','o','r','C','o','d','e',0}; + static const WCHAR driverdateW[] = + {'D','r','i','v','e','r','D','a','t','e',0}; + static const WCHAR installeddisplaydriversW[]= + {'I','n','s','t','a','l','l','e','d','D','i','s','p','l','a','y','D','r','i','v','e','r','s',0}; + static const WCHAR statusW[] = + {'S','t','a','t','u','s',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + VARIANT val; + CIMTYPE type; + HRESULT hr; + DWORD count; + + 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; + + 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 ); + + type = 0xdeadbeef; + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, installeddisplaydriversW, 0, &val, &type, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + 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 ); + + IWbemClassObject_Release( obj ); + } + + SysFreeString( query ); + SysFreeString( wql ); +} + +static void test_Win32_Printer( IWbemServices *services ) +{ + static const WCHAR deviceidW[] = + {'D','e','v','i','c','e','I','d',0}; + static const WCHAR locationW[] = + {'L','o','c','a','t','i','o','n',0}; + static const WCHAR portnameW[] = + {'P','o','r','t','N','a','m','e',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'P','r','i','n','t','e','r',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + VARIANT val; + CIMTYPE type; + HRESULT hr; + DWORD count; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + if (hr != S_OK) + { + win_skip( "Win32_Printer not available\n" ); + return; + } + + for (;;) + { + 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 ); + + type = 0xdeadbeef; + memset( &val, 0, sizeof(val) ); + hr = IWbemClassObject_Get( obj, locationW, 0, &val, &type, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + 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 ); + + IWbemClassObject_Release( obj ); + } + + SysFreeString( query ); + SysFreeString( wql ); +} + START_TEST(query) { static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; @@ -1408,10 +1743,13 @@ START_TEST(query) test_query_async( services ); test_GetNames( services ); test_SystemSecurity( services ); - test_OperatingSystem( services ); - test_ComputerSystemProduct( services ); - test_PhysicalMemory( services ); - test_IP4RouteTable( services ); + test_Win32_OperatingSystem( services ); + test_Win32_ComputerSystemProduct( services ); + test_Win32_PhysicalMemory( services ); + test_Win32_IP4RouteTable( services ); + test_Win32_Processor( services ); + test_Win32_VideoController( services ); + test_Win32_Printer( services ); SysFreeString( path ); IWbemServices_Release( services );