Dmitry Timoshkov wrote:
"Julius Schwartzenberg" <[email protected]> wrote:
This obviously won't work for 64-bit. I'd suggest to make extra
2 * sizeof(void *). and add a comment about compatibility.
ok(cls.cbWndExtra > sizeof(void *), "blah ...\n") doesn't require
any intermediate variables.
Thanks for your feedback! I turns out however that Civilization II
crashes with anything other than 6, so I used an IFDEF to check for
64-bit as advised on IRC. The 64-bit version of Windows XP returns 8
instead of 6 and Civilization II crashes at exactly the same point as
Wine in it.
I've attached a new version and split the test and the patch. The test
will fail on 64-bit Windows XP however, just like Civilization II. What
is the best way to cope with this?
I also wondered whether it wouldn't be good to also test the extra
values of the other standard classes instead of just the edit class. I
created a table which shows all the return values for different Windows
versions & Wine:
http://haar.student.utwente.nl/~julius/extra_value_table
To my eyes it seems the edit class is the only candidate that needs a
test, but maybe someone more experienced could judge the table. In case
other classes may also cause problems I will also add tests for those.
Julius
From cba35b6ba1a5deb18f721780181907050091c596 Mon Sep 17 00:00:00 2001
From: Julius Schwartzenberg <[email protected]>
Date: Tue, 6 Oct 2009 22:59:54 +0200
Subject: Fix for bug #2181. Changes the extra value of the standard edit class
from 4 to 6.
---
dlls/user32/edit.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 8ad945b..e1159f9 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -5410,13 +5410,19 @@ static LRESULT WINAPI EditWndProcW(HWND hWnd, UINT
uMsg, WPARAM wParam, LPARAM l
* edit class descriptor
*/
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
--
1.6.0.4
From 4cc592854ca32856121e45f8440c43b4eeccdc98 Mon Sep 17 00:00:00 2001
From: Julius Schwartzenberg <[email protected]>
Date: Tue, 6 Oct 2009 23:02:34 +0200
Subject: The test passes on win98 & winxp. It fails on WinXP 64-bit, just like
Civ II does.
---
dlls/user32/tests/edit.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index 5ca012e..70a61a9 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -2260,6 +2260,19 @@ static void test_dialogmode(void)
destroy_child_editcontrol(hwEdit);
}
+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
+}
+}
+
START_TEST(edit)
{
hinst = GetModuleHandleA(NULL);
@@ -2285,6 +2298,7 @@ START_TEST(edit)
test_child_edit_wmkeydown();
test_fontsize();
test_dialogmode();
+ test_extra_value();
UnregisterWindowClasses();
}
--
1.6.0.4