Hello.
Fixing MSHTML tests I found a bug in Windows. In tests I passed const WNDCLASSEX, to RegisterClassEx what should work as its declaration is:
ATOM WINAPI RegisterClassExW(const WNDCLASSEXW *);
Changing passed WNDCLASS to nonconst makes it works. I wrote small tests (attached) showing that if hInstance of WNDCLASSEX is NULL, RegisterClassEx sets it to GetModuleHandle(NULL). It, of course, couses segmentation fault in case CMASSWNDEX is const. This problem seams to happen on XP, NT 4, 2k and 2k3. So the question is if we should clone this bug? Some applications may expect it, but other may crash. They will crash on Windows anyway... Or we should mark test as todo_wine and change it if we found application that depend on it?
Thanks, Jacek
Index: dlls/user/tests/class.c =================================================================== RCS file: /home/wine/wine/dlls/user/tests/class.c,v retrieving revision 1.19 diff -u -p -r1.19 class.c --- dlls/user/tests/class.c 15 Jun 2005 10:21:19 -0000 1.19 +++ dlls/user/tests/class.c 25 Jul 2005 16:14:10 -0000 @@ -301,6 +301,15 @@ static void test_instances(void) HINSTANCE user32 = GetModuleHandleA("user32"); HINSTANCE main_module = GetModuleHandleA(NULL);
+ WNDCLASSEXA clsex = { + sizeof(WNDCLASSEXW), + 0, + ClassTest_WndProc, + 0, 0, NULL, NULL, NULL, NULL, NULL, + "const_test", + NULL + }; + memset( &cls, 0, sizeof(cls) ); cls.style = CS_HREDRAW | CS_VREDRAW; cls.lpfnWndProc = ClassTest_WndProc; @@ -436,6 +445,10 @@ static void test_instances(void) ok( !GetClassInfo( 0, name, &wc ), "Class found with null instance\n" ); ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() ); ok( UnregisterClassA( name, 0 ), "Unregister failed for null instance\n" ); + + ok( RegisterClassExA( &clsex), "RegisterClassExA failed\n"); + ok( clsex.hInstance == GetModuleHandle(NULL), "hInstance=%08lx\n, expected %08lx\n", + clsex.hInstance, GetModuleHandle(NULL));
/* registering for user32 always fails */ cls.lpszMenuName = "user32";
Jacek Caban wrote:
Hello.
Fixing MSHTML tests I found a bug in Windows. In tests I passed const WNDCLASSEX, to RegisterClassEx what should work as its declaration is:
ATOM WINAPI RegisterClassExW(const WNDCLASSEXW *);
Changing passed WNDCLASS to nonconst makes it works. I wrote small tests (attached) showing that if hInstance of WNDCLASSEX is NULL, RegisterClassEx sets it to GetModuleHandle(NULL). It, of course, couses segmentation fault in case CMASSWNDEX is const. This problem seams to happen on XP, NT 4, 2k and 2k3. So the question is if we should clone this bug? Some applications may expect it, but other may crash. They will crash on Windows anyway... Or we should mark test as todo_wine and change it if we found application that depend on it?
Thanks, Jacek
Maybe it's just me, but I thought this is well-known "feature" of the API. It's implemented in ReactOS for quite some time. *g*
- Filip
Filip Navara wrote:
Maybe it's just me, but I thought this is well-known "feature" of the API. It's implemented in ReactOS for quite some time. *g*
- Filip
It wasn't well-known for me. So if it's not yet implemented in Wine, probably it shouldn't be.
Thanks, Jacek
Filip Navara wrote:
Maybe it's just me, but I thought this is well-known "feature" of the API. It's implemented in ReactOS for quite some time. *g*
- Filip
Yes! but the headers, are they fixed? What do you do in react OS do you have 2 different definitions for RegisterClassExW
Free Life Boaz