06-06-2024, 02:09 PM
(06-06-2024, 03:15 AM)madscijr Wrote: I don't see any of the UNIONed type being hidden in _OFFSET, or any "padding" or MEMGET or any of that stuff happening to access the members of that type.Well that has a lot to do with what you're trying to do with these APIs. The APIs can return any of RAWMOUSE, RAWHID, and RAWKEYBOARD responses, that's the purpose of the union. If you only care about the RAWMOUSE ones (that's the case for the program you posted), then you can ignore the `union` and just pretend it's a `RAWMOUSE` struct (since that's the only one of the union members you would use anyway). If you want to be able to process all three of RAWMOUSE, RAWHID, and RAWKEYBOARD then the union issues come into play.
I don't see any of that funny stuff, but it still works. How? Why?
Also, the code does having padding inserted, that's the `Aiignment` members in the TYPEs `RAWINPUTDEVICELIST`, `PAINTSTRUCT`, and `RAWMOUSE` have padding added (though I'm not entirely sure `RAWMOUSE` is correct, I think that padding is also needed for 32-bit).
(06-06-2024, 01:56 PM)bplus Wrote: so is a union different than math / logic version of the name? ie a set with no repeating elementsYes, they're not related