Hello,
When I checked out the latest CVS, all the dialog boxes in Finale stopped working (again) . This happened since Alexandre fixed a function call from GetModuleHandleA("USER") to GetModuleHandle16("USER") in my previous GetClassInfo16 patch (thanks Alexnadre!). My patch had worked because GetModuleHandleA returned hInstance 0 for USER and Finale would proceed to register a window class with hInstance 0. Since classes with hInst=0 are treated sort of like global classes in wine, the window class was found.
After more investigating, I discovered that in Win16, any window class that is registered with a USER instance handle will be found even if the hInstance passed to the function (GetClassInfo, CreateWindow etv c.) is completely different. This happens even for classes without the CS_GLOBALCLASS style. I have some small test apps if anyone is intrigued by this. Anyway, this patch implements this undocumented bug, uh.. er.. feature in wine and gets Finale working again .
Changelog: Local classes registered with USER instance handle now are now found in CLASS_FindClassByAtom.
Modified Files: wine/windows/wnd16.c
Josh Thielen
Index: wine/windows/class.c =================================================================== RCS file: /home/wine/wine/windows/class.c,v retrieving revision 1.42 diff -u -r1.42 class.c --- wine/windows/class.c 2001/11/06 20:57:27 1.42 +++ wine/windows/class.c 2001/11/13 23:23:39 @@ -279,10 +279,14 @@ * NOTES * 980805 a local class will be found now if registred with hInst=0 * and looed up with a hInst!=0. msmoney does it (jsch) + * + * Local class registered with a USER instance handle are found as if + * they were global classes. */ static CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance ) { - CLASS * class, *tclass=0; + CLASS * class, *tclass = 0, *user_class = 0; + HINSTANCE hUser = GetModuleHandle16("USER");
TRACE("0x%08x 0x%08x\n", atom, hinstance);
@@ -293,16 +297,20 @@ if (class->style & CS_GLOBALCLASS) continue; if (class->atomName == atom) { - if (hinstance==class->hInstance || hinstance==0xffff ) + if (hinstance==class->hInstance || hinstance==0xffff) { TRACE("-- found local %p\n", class); return class; } - if (class->hInstance==0) tclass = class; + if (class->hInstance == 0) tclass = class; + else if(class->hInstance == hUser) + { + user_class = class; + } } }
- /* Then search global classes */ + /* Then search global classes */
for (class = firstClass; (class); class = class->next) { @@ -312,6 +320,13 @@ TRACE("-- found global %p\n", class); return class; } + } + + /* Check if there was a local class registered with USER */ + if( user_class ) + { + TRACE("--found local USER class %p\n", user_class); + return user_class; }
/* Then check if there was a local class with hInst=0*/