Rémi Bernon (@rbernon) commented about dlls/user32/input.c:
+ NULL ); + handleA->dbch_size = offsetof( DEV_BROADCAST_HANDLE, dbch_data[handleW->dbch_nameoffset + lenA + 1] ); + } + else + handleA->dbch_size = offsetof(DEV_BROADCAST_HANDLE, dbch_data[handleW->dbch_reserved]); + + handleA->dbch_reserved = 0; + handleA->dbch_handle = handleW->dbch_handle; + handleA->dbch_hdevnotify = handleW->dbch_hdevnotify; + handleA->dbch_eventguid = handleW->dbch_eventguid; + handleA->dbch_nameoffset = handleW->dbch_nameoffset; + memcpy( &handleA->dbch_data, &handleW->dbch_data, + handleW->dbch_nameoffset == -1 ? data_size : handleW->dbch_nameoffset ); + SendMessageTimeoutA( handle, WM_DEVICECHANGE, flags, (LPARAM)handleA, SMTO_ABORTIFHUNG, + 2000, NULL ); + free( handleA ); This looks more complicated that I would expect, can't we simply convert from dbch_nameoffset to dbch_size?. Is this because you are using dbch_reserved, why do you care about it? Where do these -1 values come from?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6437#note_80864