From: Vibhav Pant vibhavp@gmail.com
--- dlls/cfgmgr32/tests/cfgmgr32.c | 56 +++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/dlls/cfgmgr32/tests/cfgmgr32.c b/dlls/cfgmgr32/tests/cfgmgr32.c index 02741d0d963..cf74bbaac0f 100644 --- a/dlls/cfgmgr32/tests/cfgmgr32.c +++ b/dlls/cfgmgr32/tests/cfgmgr32.c @@ -500,6 +500,8 @@ static void test_CM_Get_Device_Interface_List(void) ok(ret == CR_NO_SUCH_DEVICE_INTERFACE || broken(ret == CR_INVALID_DATA) /* w7 */, "got %#lx.\n", ret); }
+DEFINE_DEVPROPKEY(DEVPKEY_dummy, 0xdeadbeef, 0xdead, 0xbeef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 1); + static void test_DevGetObjects( void ) { struct { @@ -575,6 +577,7 @@ static void test_DevGetObjects( void ) for (i = 0; i < ARRAY_SIZE( test_cases ); i++) { const DEV_OBJECT *objects = NULL; + DEVPROPCOMPKEY prop_key = {0}; ULONG j, len = 0;
objects = NULL; @@ -644,8 +647,59 @@ static void test_DevGetObjects( void ) todo_wine ok( rem_props == 0, "got rem %lu != 0\n", rem_props ); winetest_pop_context(); } - winetest_pop_context(); DevFreeObjects( len, objects ); + + len = 0; + objects = NULL; + prop_key.Key = test_cases[i].exp_props[0].key; + prop_key.LocaleName = NULL; + prop_key.Store = DEVPROP_STORE_SYSTEM; + hr = DevGetObjects( DevObjectTypeDeviceInterface, 0, 1, &prop_key, 0, NULL, &len, &objects ); + ok( hr == S_OK, "got hr %#lx\n", hr ); + ok( len, "got len %lu\n", len ); + ok( !!objects, "got objects %p\n", objects ); + for (i = 0; i < len; i++) + { + const DEV_OBJECT *obj = &objects[i]; + + winetest_push_context( "objects[%lu]", i ); + todo_wine ok( obj->cPropertyCount == 1, "got cPropertyCount %lu != 1\n", obj->cPropertyCount ); + todo_wine ok( !!obj->pProperties, "got pProperties %p\n", obj->pProperties ); + if (obj->pProperties) + ok( IsEqualDevPropKey( obj->pProperties[0].CompKey.Key, prop_key.Key ), + "got property {%s, %#lx} != {%s, %#lx}\n", debugstr_guid( &obj->pProperties[0].CompKey.Key.fmtid ), + obj->pProperties[0].CompKey.Key.pid, debugstr_guid( &prop_key.Key.fmtid ), prop_key.Key.pid ); + winetest_pop_context(); + } + DevFreeObjects( len, objects ); + + len = 0; + objects = NULL; + prop_key.Key = DEVPKEY_dummy; + hr = DevGetObjects( DevObjectTypeDeviceInterface, 0, 1, &prop_key, 0, NULL, &len, &objects ); + ok( hr == S_OK, "got hr %#lx\n", hr ); + ok( len, "got len %lu\n", len ); + ok( !!objects, "got objects %p\n", objects ); + for (i = 0; i < len; i++) + { + const DEV_OBJECT *obj = &objects[i]; + + winetest_push_context( "objects[%lu]", i ); + todo_wine ok( obj->cPropertyCount == 1, "got cPropertyCount %lu != 1\n", obj->cPropertyCount ); + todo_wine ok( !!obj->pProperties, "got pProperties %p\n", obj->pProperties ); + if (obj->pProperties) + { + ok( IsEqualDevPropKey( obj->pProperties[0].CompKey.Key, DEVPKEY_dummy ), + "got property {%s, %#lx} != {%s, %#lx}\n", debugstr_guid( &obj->pProperties[0].CompKey.Key.fmtid ), + obj->pProperties[0].CompKey.Key.pid, debugstr_guid( &DEVPKEY_dummy.fmtid ), DEVPKEY_dummy.pid ); + ok( obj->pProperties[0].Type == DEVPROP_TYPE_EMPTY, "got Type %#lx != %#x", obj->pProperties[0].Type, + DEVPROP_TYPE_EMPTY ); + } + winetest_pop_context(); + } + DevFreeObjects( len, objects ); + + winetest_pop_context(); }
SetupDiDestroyDeviceInfoList( set );