From: Robert Gerigk <Robert-Gerigk@online.de> Verify that DEVPKEY_Device_Children is set on the bus PDO after child enumeration and contains the child's instance ID as a MULTI_SZ entry. Signed-off-by: Jan Robert Gerigk <Robert-Gerigk@online.de> --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 70c01543835..3f0d4885c31 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2247,6 +2247,40 @@ static void test_pnp_devices(void) ok(size == sizeof(L"ROOT\\WINETEST\\0"), "got size %lu\n", size); ok(!wcscmp(buffer_w, L"ROOT\\WINETEST\\0"), "got parent ID %s\n", debugstr_w(buffer_w)); + /* DEVPKEY_Device_Children — set on the bus PDO after child enumeration. + * Open the bus device by its instance ID directly; the bus_class + * interface has been disabled earlier in this function, so a + * DIGCF_DEVICEINTERFACE-scoped enumeration would not find it. + * + * The test setup registers exactly one child ("Wine\Test\1"), so the + * full MULTI_SZ list is compared verbatim, including the trailing + * double-NUL terminator. */ + { + static const WCHAR expected_children[] = L"Wine\\Test\\1\0"; + SP_DEVINFO_DATA bus_dev = { sizeof(bus_dev) }; + HDEVINFO bus_set; + + bus_set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(bus_set != INVALID_HANDLE_VALUE, "failed to create bus device list, error %#lx\n", + GetLastError()); + ret = SetupDiOpenDeviceInfoA(bus_set, "ROOT\\WINETEST\\0", NULL, 0, &bus_dev); + ok(ret, "failed to open bus device, error %#lx\n", GetLastError()); + + prop_type = DEVPROP_TYPE_EMPTY; + size = 0; + memset(buffer_w, 0, sizeof(buffer_w)); + ret = SetupDiGetDevicePropertyW(bus_set, &bus_dev, &DEVPKEY_Device_Children, + &prop_type, (BYTE *)buffer_w, sizeof(buffer_w), &size, 0); + ok(ret, "DEVPKEY_Device_Children missing, error %#lx\n", GetLastError()); + ok(prop_type == DEVPROP_TYPE_STRING_LIST, "got type %#lx\n", prop_type); + ok(size == sizeof(expected_children), "got size %lu, expected %Iu\n", + size, sizeof(expected_children)); + ok(!memcmp(buffer_w, expected_children, size), "got children %s\n", + debugstr_w(buffer_w)); + + SetupDiDestroyDeviceInfoList(bus_set); + } + ret = SetupDiEnumDeviceInterfaces(set, NULL, &child_class, 0, &iface); ok(ret, "failed to get interface, error %#lx\n", GetLastError()); ok(IsEqualGUID(&iface.InterfaceClassGuid, &child_class), -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10604