Commit 3d25202e authored by Claire Girka's avatar Claire Girka Committed by Alexandre Julliard

ntoskrnl: Set device ContainerID from driver.

Using SetupDiGetDeviceRegistryPropertyW rather than SetupDiGetDeviceRegistryPropertyA in the test, because games use the former, and Windows returns the Container ID as a WCHAR string either way.
parent bfb7fe4b
......@@ -318,6 +318,7 @@ static void enumerate_new_device( DEVICE_OBJECT *device, HDEVINFO set )
BOOL need_driver = TRUE;
NTSTATUS status;
HKEY key;
WCHAR *id;
if (get_device_instance_id( device, device_instance_id ))
return;
......@@ -347,6 +348,13 @@ static void enumerate_new_device( DEVICE_OBJECT *device, HDEVINFO set )
return;
}
if (!get_device_id(device, BusQueryContainerID, &id) && id)
{
SetupDiSetDeviceRegistryPropertyW( set, &sp_device, SPDRP_BASE_CONTAINERID, (BYTE *)id,
(lstrlenW( id ) + 1) * sizeof(WCHAR) );
ExFreePool( id );
}
if (need_driver && !install_device_driver( device, set, &sp_device ) && !caps.RawDeviceOK)
{
ERR("Unable to install a function driver for device %s.\n", debugstr_w(device_instance_id));
......
......@@ -1460,6 +1460,7 @@ static void test_pnp_devices(void)
{
static const char expect_hardware_id[] = "winetest_hardware\0winetest_hardware_1\0";
static const char expect_compat_id[] = "winetest_compat\0winetest_compat_1\0";
static const WCHAR expect_container_id_w[] = L"{12345678-1234-1234-1234-123456789123}";
char buffer[200];
WCHAR buffer_w[200];
......@@ -1650,7 +1651,10 @@ static void test_pnp_devices(void)
/* Using the WCHAR variant because Windows returns a WCHAR for this property even when using SetupDiGetDeviceRegistryPropertyA */
ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_BASE_CONTAINERID,
&type, (BYTE *)buffer_w, sizeof(buffer_w), &size);
todo_wine ok(ret, "got error %#lx\n", GetLastError());
ok(ret, "got error %#lx\n", GetLastError());
ok(type == REG_SZ, "got type %lu\n", type);
ok(size == sizeof(expect_container_id_w), "got size %lu\n", size);
ok(!memcmp(buffer_w, expect_container_id_w, size), "got container ID %s\n", debugstr_w(buffer_w));
ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_COMPATIBLEIDS,
&type, (BYTE *)buffer, sizeof(buffer), &size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment