You don't check SetMenuItemInfo return code after the above calls and I
very
much suspect that they fail leading to the observed results.
Well spotted, thanks!
In the one case of string -> ownerdraw you are right, and I have now modified the tests to flag a todo where this unexpectedly works on wine but fails on windows.
In the case of ownerdraw -> string -> ownerdraw, the calls do indeed work and keep the saved string. Debugging on windows seems to show the string is copied and saved as well, which concurs with the rest of the patch.
The fix (rather than the tests) is still accurate for this as far as I can tell.
Attached is new patch, which checks the rc of the SetMenuItemInfo (and InsertMenuItem) calls...
Changelog
Copy and store the dwTypeData of a menu item even for a ownerdraw item, and ensure the memory allocations/freeing occurs correctly
Jason