"Julius Schwartzenberg" <julius.schwartzenberg(a)gmail.com> wrote:
static const WCHAR editW[] = {'E','d','i','t',0}; +#ifdef _WIN64 +#define EDIT_EXTRA_VALUE sizeof(EDITSTATE *) +#else +#define EDIT_EXTRA_VALUE 6 /* This has to be 6 for 32-bit, otherwise Civilization II crashes, bug #2181 */ +#endif const struct builtin_class_descr EDIT_builtin_class = { editW, /* name */ CS_DBLCLKS | CS_PARENTDC, /* style */ EditWndProcA, /* procA */ EditWndProcW, /* procW */ - sizeof(EDITSTATE *), /* extra */ + EDIT_EXTRA_VALUE, /* extra */ IDC_IBEAM, /* cursor */ 0 /* brush */ }; +#undef EDIT_EXTRA_VALUE
It would be cleaner IMHO to have it the following way: #ifdef _WIN64 #define EDIT_EXTRA_VALUE 0 #else #define EDIT_EXTRA_VALUE 2 #endif const struct builtin_class_descr EDIT_builtin_class = { editW, /* name */ CS_DBLCLKS | CS_PARENTDC, /* style */ EditWndProcA, /* procA */ EditWndProcW, /* procW */ sizeof(EDITSTATE *) + EDIT_EXTRA_VALUE, /* extra */ ... and completely omit the comment about the bug #, but explain that there are applications (Civilization II is one of them) that depend on having 2 extra bytes in the extra class storage.
+static void test_extra_value() +{ +todo_wine { + WNDCLASSEX cls; + GetClassInfoEx(NULL,"Edit",&cls); + #ifdef _WIN64 + ok(cls.cbWndExtra == 8, "expected 6, got %d\n", cls.cbWndExtra); + #else + ok(cls.cbWndExtra == 6, "expected 6, got %d\n", cls.cbWndExtra); + #endif +} +}
You should check the return value of GetClassInfoEx() and put todo_wine only around the failing ok() call (otherwise it will fail under 64-bit). -- Dmitry.