On Sat Aug 31 16:30:43 2024 +0000, Elizabeth Figura wrote:
Sorry it's taken me so long to get to this, but 3/4 seems suspicious. I'd think BroadcastDeviceNotification() [or SendMessageNotify() or whatever it calls internally] should be making a copy of the message data itself. Are we not doing that? Should we be doing that instead?
Yeah, I might be wrong here. A quick inspection of the code does suggest that we do make copies in `(un)pack_message`. MSDN's documentation for `SendNotifyMessageW`[1] warned that messages containing pointers could not be sent as they would result in access to a dangling reference, which is what prompted me to write 3/4. However, `DEV_BROADCAST_DEVICEINTERFACE` messages don't contain any pointers, so this doesn't apply here.
[1] https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendn...