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 Tel.: +49-711-96437-199 System Administration Fax.: +49-711-96437-111 Red Hat GmbH Email: mstefani@redhat.com Hauptstaetterstr. 58 http://www.redhat.de/ D-70178 Stuttgart
Index: include/commdlg.h =================================================================== RCS file: /home/wine/wine/include/commdlg.h,v retrieving revision 1.36 diff -u -r1.36 commdlg.h --- include/commdlg.h 17 Aug 2002 18:31:12 -0000 1.36 +++ include/commdlg.h 16 Sep 2002 17:43:37 -0000 @@ -135,7 +135,12 @@ typedef struct { DWORD lStructSize; HWND hwndOwner; - HWND hInstance; /* Should be an HINSTANCE but MS made a typo */ + /* Should be an HINSTANCE but MS made a typo */ +#ifdef __WINE__ + HINSTANCE hInstance; +#else + HWND hInstance; +#endif DWORD rgbResult; LPDWORD lpCustColors; DWORD Flags; @@ -148,7 +153,12 @@ typedef struct { DWORD lStructSize; HWND hwndOwner; - HWND hInstance; /* Should be an HINSTANCE but MS made a typo */ + /* Should be an HINSTANCE but MS made a typo */ +#ifdef __WINE__ + HINSTANCE hInstance; +#else + HWND hInstance; +#endif DWORD rgbResult; LPDWORD lpCustColors; DWORD Flags;
Attachment:
pgp00049.pgp
Description: PGP signature