From: Sanskar Jaiswal <phoenix2810@protonmail.com> On Windows the container id identifies the physical device, and applications use it to group a composite device's HID interfaces together. winebus.sys currently assigns each interface its own container id. Reuse the container id already assigned to a sibling interface of the same physical device (matched by VID/PID and shared serial number, see previous commit) instead of generating a new one. Signed-off-by: Sanskar Jaiswal <phoenix2810@protonmail.com> --- dlls/winebus.sys/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 3efc17baf21..7988374e48f 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -381,6 +381,24 @@ static void make_unique_container_id(struct device_extension *device) struct device_extension *ext; LARGE_INTEGER ticks; + /* + * If a sibling interface of the same physical device (same VID/PID and + * serial number, different interface index) was already added, reuse its + * container id instead of generating a new one. + */ + if (*device->desc.serialnumber) + { + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) + if (ext->desc.vid == device->desc.vid && ext->desc.pid == device->desc.pid && + ext->desc.input != device->desc.input && + !wcscmp(ext->desc.serialnumber, device->desc.serialnumber) && + !IsEqualGUID(&ext->container_id, &GUID_NULL)) + { + device->container_id = ext->container_id; + return; + } + } + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) if (IsEqualGUID(&device->container_id, &ext->container_id)) break; if (&ext->entry == &device_list && !IsEqualGUID(&device->container_id, &GUID_NULL)) return; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11745