This is the hidclass/ntoskrnl/setupapi counterpart to !359. As with that merge request, implementing `BusQueryContainerID` in the bus driver is left out and will be addressed in a different MR.
I believe this is useful to expose the Container ID no matter how those end up being assigned by the bus driver.
-- v9: ntoskrnl: Set device ContainerID from driver hidclass: Expose ContainerID hidclass: Copy device ContainerID to child devices hidclass: Copy ContainerID from underlying driver in driver_add_device hidclass: Improve error handling in get_device_id ntoskrnl/tests: Add test for getting SPDRP_BASE_CONTAINERID from PnP driver setupapi: Add support for SPDRP_BASE_CONTAINERID
From: Claire Girka claire@sitedethib.com
--- dlls/setupapi/devinst.c | 2 ++ include/setupapi.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 73e721753aa..901af4650c8 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -96,6 +96,7 @@ static const WCHAR Capabilities[] = {'C','a','p','a','b','i','l','i','t','i','e' static const WCHAR UINumber[] = {'U','I','N','u','m','b','e','r',0}; static const WCHAR UpperFilters[] = {'U','p','p','e','r','F','i','l','t','e','r','s',0}; static const WCHAR LowerFilters[] = {'L','o','w','e','r','F','i','l','t','e','r','s',0}; +static const WCHAR ContainerId[] = {'C','o','n','t','a','i','n','e','r','I','d',0}; static const WCHAR Phantom[] = {'P','h','a','n','t','o','m',0}; static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0}; static const WCHAR Control[] = {'C','o','n','t','r','o','l',0}; @@ -654,6 +655,7 @@ static const struct PropertyMapEntry PropertyMap[] = { { REG_DWORD, "UINumber", UINumber }, { REG_MULTI_SZ, "UpperFilters", UpperFilters }, { REG_MULTI_SZ, "LowerFilters", LowerFilters }, + [SPDRP_BASE_CONTAINERID] = { REG_SZ, "ContainerId", ContainerId }, };
static BOOL SETUPDI_SetDeviceRegistryPropertyW(struct device *device, diff --git a/include/setupapi.h b/include/setupapi.h index 14e3774fc42..806df7baaf5 100644 --- a/include/setupapi.h +++ b/include/setupapi.h @@ -1315,7 +1315,8 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PSP_INF_SIGNER_INFO) #define SPDRP_REMOVAL_POLICY_HW_DEFAULT 0x00000020 #define SPDRP_REMOVAL_POLICY_OVERRIDE 0x00000021 #define SPDRP_INSTALL_STATE 0x00000022 -#define SPDRP_MAXIMUM_PROPERTY 0x00000023 +#define SPDRP_BASE_CONTAINERID 0x00000024 +#define SPDRP_MAXIMUM_PROPERTY 0x00000025
#define DPROMPT_SUCCESS 0 #define DPROMPT_CANCEL 1
From: Claire Girka claire@sitedethib.com
--- dlls/ntoskrnl.exe/tests/driver_pnp.c | 5 ++++- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c index 1f22c4b9997..9a965f584cd 100644 --- a/dlls/ntoskrnl.exe/tests/driver_pnp.c +++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c @@ -228,7 +228,10 @@ static NTSTATUS query_id(struct device *device, IRP *irp, BUS_QUERY_ID_TYPE type }
case BusQueryContainerID: - return STATUS_NOT_SUPPORTED; + if (!(id = ExAllocatePool(PagedPool, 39 * sizeof(WCHAR)))) + return STATUS_NO_MEMORY; + wcscpy(id, L"{12345678-1234-1234-1234-123456789123}"); + break;
default: ok(0, "Unexpected ID query type %#x.\n", type); diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 64debcbebbf..6d1185301eb 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1462,6 +1462,7 @@ static void test_pnp_devices(void) static const char expect_compat_id[] = "winetest_compat\0winetest_compat_1\0";
char buffer[200]; + WCHAR buffer_w[200]; SP_DEVICE_INTERFACE_DETAIL_DATA_A *iface_detail = (void *)buffer; SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; SP_DEVINFO_DATA device = {sizeof(device)}; @@ -1646,6 +1647,11 @@ static void test_pnp_devices(void) ok(size == sizeof(expect_hardware_id), "got size %lu\n", size); ok(!memcmp(buffer, expect_hardware_id, size), "got hardware IDs %s\n", debugstr_an(buffer, size));
+ /* 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()); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_COMPATIBLEIDS, &type, (BYTE *)buffer, sizeof(buffer), &size); ok(ret, "got error %#lx\n", GetLastError());
From: Claire Girka claire@sitedethib.com
Do not assume the underlying driver will return meaningful data, as it may not support BusQueryContainerID which will be queried in a next commit. --- dlls/hidclass.sys/pnp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 873c55c4a67..91d80f74403 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -84,11 +84,15 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH irpsp->MinorFunction = IRP_MN_QUERY_ID; irpsp->Parameters.QueryId.IdType = type;
+ irp->IoStatus.Status = STATUS_NOT_SUPPORTED; if (IoCallDriver(device, irp) == STATUS_PENDING) KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
- wcscpy(id, (WCHAR *)irp_status.Information); - ExFreePool((WCHAR *)irp_status.Information); + if (!irp_status.Status) { + wcscpy(id, (WCHAR *)irp_status.Information); + ExFreePool((WCHAR *)irp_status.Information); + } + return irp_status.Status; }
From: Claire Girka claire@sitedethib.com
--- dlls/hidclass.sys/hid.h | 1 + dlls/hidclass.sys/pnp.c | 3 +++ 2 files changed, 4 insertions(+)
diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index e20f12809eb..b8cec55fb7c 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -81,6 +81,7 @@ typedef struct _BASE_DEVICE_EXTENSION * for convenience. */ WCHAR device_id[MAX_DEVICE_ID_LEN]; WCHAR instance_id[MAX_DEVICE_ID_LEN]; + WCHAR container_id[MAX_GUID_STRING_LEN]; const GUID *class_guid;
BOOL is_fdo; diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 91d80f74403..a2315b686ca 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -172,6 +172,9 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b swprintf(ext->device_id, ARRAY_SIZE(ext->device_id), L"HID\%s", wcsrchr(device_id, '\') + 1); wcscpy(ext->instance_id, instance_id);
+ if (get_device_id(bus_pdo, BusQueryContainerID, ext->container_id)) + ext->container_id[0] = 0; + is_xinput_class = !wcsncmp(device_id, L"WINEXINPUT\", 7) && wcsstr(device_id, L"&XI_") != NULL; if (is_xinput_class) ext->class_guid = &GUID_DEVINTERFACE_WINEXINPUT; else ext->class_guid = &GUID_DEVINTERFACE_HID;
From: Claire Girka claire@sitedethib.com
--- dlls/hidclass.sys/pnp.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index a2315b686ca..271c777129d 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -231,6 +231,7 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) KeInitializeSpinLock( &pdo_ext->u.pdo.queues_lock ); wcscpy(pdo_ext->device_id, fdo_ext->device_id); wcscpy(pdo_ext->instance_id, fdo_ext->instance_id); + wcscpy(pdo_ext->container_id, fdo_ext->container_id); pdo_ext->class_guid = fdo_ext->class_guid;
pdo_ext->u.pdo.information.VendorID = attr.VendorID;
From: Claire Girka claire@sitedethib.com
--- dlls/hidclass.sys/pnp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 271c777129d..023a4d9fa44 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -419,8 +419,16 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Information = (ULONG_PTR)id; status = STATUS_SUCCESS; break; - case BusQueryContainerID: + if (ext->container_id[0]) { + lstrcpyW(id, ext->container_id); + irp->IoStatus.Information = (ULONG_PTR)id; + status = STATUS_SUCCESS; + } else { + ExFreePool(id); + } + break; + case BusQueryDeviceSerialNumber: FIXME("unimplemented id type %#x\n", irpsp->Parameters.QueryId.IdType); ExFreePool(id);
From: Claire Girka claire@sitedethib.com
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. --- dlls/ntoskrnl.exe/pnp.c | 8 ++++++++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 71c03586897..e5c9b441b87 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -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; @@ -353,6 +354,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 ); + } + start_device( device, set, &sp_device ); }
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 6d1185301eb..6d8513ffa35 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -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);
On 7/14/22 02:50, Claire Girka wrote:
From: Claire Girka claire@sitedethib.com
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.
dlls/ntoskrnl.exe/pnp.c | 8 ++++++++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 71c03586897..e5c9b441b87 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -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;
@@ -353,6 +354,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 );
- }
}start_device( device, set, &sp_device );
This test [1] and MSDN documentation [2] imply we probably should be querying ContainerID before installing the function driver, though.
[1] https://testbot.winehq.org/JobDetails.pl?Key=119104
[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/adding-a-pn...
On Wed Jul 13 18:57:44 2022 +0000, Claire wrote:
Oh, makes sense, I hadn't noticed the other envs skipped it. I added `broken` calls, but I can probably simplify the tests by just calling the widechar variant of the function if you prefer. I'm not sure how much sense replicating Windows' broken behavior would make, and the games I've seen actually use it use the widechar variant.
I tried it on Windows, and even with default drivers for generic devices, calling `SetupDiGetDeviceRegistryPropertyA` with `SPDRP_BASE_CONTAINERID` returns a WCHAR string. So I decided to rewrite the tests to use `SetupDiGetDeviceRegistryPropertyW` as this is more representative of what games actually use, and Windows' behavior for `SetupDiGetDeviceRegistryPropertyA` does not make much sense. I have not tried to match Windows' behavior for it as I doubt any app would call that variant and expect a WCHAR string.
On Tue Jul 12 18:38:39 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 7/12/22 13:01, Claire Girka wrote: > From: Claire Girka <claire@sitedethib.com> > > --- > dlls/setupapi/devinst.c | 2 ++ > include/setupapi.h | 3 ++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c > index 73e721753aa..1282285da4c 100644 > --- a/dlls/setupapi/devinst.c > +++ b/dlls/setupapi/devinst.c > @@ -96,6 +96,7 @@ static const WCHAR Capabilities[] = {'C','a','p','a','b','i','l','i','t','i','e' > static const WCHAR UINumber[] = {'U','I','N','u','m','b','e','r',0}; > static const WCHAR UpperFilters[] = {'U','p','p','e','r','F','i','l','t','e','r','s',0}; > static const WCHAR LowerFilters[] = {'L','o','w','e','r','F','i','l','t','e','r','s',0}; > +static const WCHAR BaseContainerId[] = {'B','a','s','e','C','o','n','t','a','i','n','e','r','I','d',0}; > static const WCHAR Phantom[] = {'P','h','a','n','t','o','m',0}; > static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0}; > static const WCHAR Control[] = {'C','o','n','t','r','o','l',0}; Can you please use wide-character constants for any new strings introduced? > @@ -654,6 +655,7 @@ static const struct PropertyMapEntry PropertyMap[] = { > { REG_DWORD, "UINumber", UINumber }, > { REG_MULTI_SZ, "UpperFilters", UpperFilters }, > { REG_MULTI_SZ, "LowerFilters", LowerFilters }, > + [0x24] = { REG_SZ, "BaseContainerId", BaseContainerId }, > }; Please use SPDRP_BASE_CONTAINERID instead of hardcoding the value. Also, are you sure that "BaseContainerId" is correct? On a Windows machine I see only "ContainerID"; is this supposed to be different somehow? _______________________________________________ wine-gitlab mailing list -- wine-gitlab@winehq.org To unsubscribe send an email to wine-gitlab-leave@winehq.org
Changed it to `ContainerID`, as it's indeed how it is stored in Windows' registry.
On Fri Jul 15 22:08:13 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 7/14/22 02:50, Claire Girka wrote: > From: Claire Girka <claire@sitedethib.com> > > 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. > --- > dlls/ntoskrnl.exe/pnp.c | 8 ++++++++ > dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++++- > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c > index 71c03586897..e5c9b441b87 100644 > --- a/dlls/ntoskrnl.exe/pnp.c > +++ b/dlls/ntoskrnl.exe/pnp.c > @@ -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; > @@ -353,6 +354,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 ); > + } > + > start_device( device, set, &sp_device ); > } > This test [1] and MSDN documentation [2] imply we probably should be querying ContainerID before installing the function driver, though. [1] https://testbot.winehq.org/JobDetails.pl?Key=119104 [2] https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/adding-a-pnp-device-to-a-running-system _______________________________________________ wine-gitlab mailing list -- wine-gitlab@winehq.org To unsubscribe send an email to wine-gitlab-leave@winehq.org
I am not sure what the test shows, running the test under Wine returns similar results (although the queries appear to be performed twice), with the same IDs being queried, none involving `BusQueryContainerId` (0x5): ``` driver_pnp.c:136: Test failed: Unexpected ID query of type 0. driver_pnp.c:136: Test failed: Unexpected ID query of type 0x3. driver_pnp.c:136: Test failed: Unexpected ID query of type 0. driver_pnp.c:136: Test failed: Unexpected ID query of type 0x3. ```
To my understanding, the documentation suggests that Windows queries all properties *before* saving those to the registry and installing the device driver, while Wine interleaves querying and storing in `install_device_driver`, and in the case of my patches, queries and stores the container ID after running `install_device_driver`.
So if I understand correctly, you're suggesting to move the ContainerID querying back to `install_device_driver`. However, as I explained earlier, I think we want the ContainerID to be re-queried in `enumerate_new_device` even if the driver is already installed (which seems to occur in the case of winebus HID devices across reboots and port changes when a Serial number is exposed), and my current implementation of ContainerID (not submitted so far) relies on this. Maybe the driver already being installed across reboots and ports is a bug, though.
On 7/16/22 03:41, Claire (@ClearlyClaire) wrote:
On Fri Jul 15 22:08:13 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 7/14/22 02:50, Claire Girka wrote: > From: Claire Girka <claire@sitedethib.com> > > 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. > --- > dlls/ntoskrnl.exe/pnp.c | 8 ++++++++ > dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++++- > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c > index 71c03586897..e5c9b441b87 100644 > --- a/dlls/ntoskrnl.exe/pnp.c > +++ b/dlls/ntoskrnl.exe/pnp.c > @@ -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; > @@ -353,6 +354,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 ); > + } > + > start_device( device, set, &sp_device ); > } > This test [1] and MSDN documentation [2] imply we probably should be querying ContainerID before installing the function driver, though. [1] https://testbot.winehq.org/JobDetails.pl?Key=119104 [2] https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/adding-a-pnp-device-to-a-running-system _______________________________________________ wine-gitlab mailing list -- wine-gitlab@winehq.org To unsubscribe send an email to wine-gitlab-leave@winehq.org
I am not sure what the test shows, running the test under Wine returns similar results (although the queries appear to be performed twice), with the same IDs being queried, none involving `BusQueryContainerId` (0x5):
driver_pnp.c:136: Test failed: Unexpected ID query of type 0. driver_pnp.c:136: Test failed: Unexpected ID query of type 0x3. driver_pnp.c:136: Test failed: Unexpected ID query of type 0. driver_pnp.c:136: Test failed: Unexpected ID query of type 0x3.
Eh, right, that test is meaningless because we don't go through enumerate_new_device() for root PnP devices.
To my understanding, the documentation suggests that Windows queries all properties *before* saving those to the registry and installing the device driver, while Wine interleaves querying and storing in `install_device_driver`, and in the case of my patches, queries and stores the container ID after running `install_device_driver`.
Right.
So if I understand correctly, you're suggesting to move the ContainerID querying back to `install_device_driver`. However, as I explained earlier, I think we want the ContainerID to be re-queried in `enumerate_new_device` even if the driver is already installed (which seems to occur in the case of winebus HID devices across reboots and port changes when a Serial number is exposed), and my current implementation of ContainerID (not submitted so far) relies on this. Maybe the driver already being installed across reboots and ports is a bug, though.
Right, I was thinking it should be done unconditionally in enumerate_new_device() as in your v10. That should probably apply to the hardware and compatible IDs as well eventually.