Hello,
this email is CC'ed to wine-devel because it's controversial.
MS made a typo in CHOOSECOLOR (commdlg.h) and kept it till today (at least that's what msdn says): the struct member hInstance is a HWND instead of a HINSTANCE. Until now it wasn't a problem in wine but with the conversions of the handles to void* a lot of casts are necessary. And this casts are looking just wrong: cast to HINSTANCE when using the hInstance member as rvalue and cast to HWND when using it as lvalue. The casts looks so wrong so that we would need comments like "Yes, this cast is needed, see struct CHOOSECOLOR in include/commdlg.h". The attached patch fixes the typo for wine (but keeps it for compatibility reasons for winelib) and removes the need of some ugly casts.
License: LGPL, X11 Changelog: Michael Stefaniuc mstefani@redhat.com - workaround for MS typo
bye michael
Michael Stefaniuc mstefani@redhat.de writes:
MS made a typo in CHOOSECOLOR (commdlg.h) and kept it till today (at least that's what msdn says): the struct member hInstance is a HWND instead of a HINSTANCE. Until now it wasn't a problem in wine but with the conversions of the handles to void* a lot of casts are necessary. And this casts are looking just wrong: cast to HINSTANCE when using the hInstance member as rvalue and cast to HWND when using it as lvalue. The casts looks so wrong so that we would need comments like "Yes, this cast is needed, see struct CHOOSECOLOR in include/commdlg.h". The attached patch fixes the typo for wine (but keeps it for compatibility reasons for winelib) and removes the need of some ugly casts.
The problem is that our code would no longer be compatible with other Windows headers, which could be a problem for instance for the ReactOS folks. I think it's better to remain compatible and live with the ugly casts.