[Bug 14350] New: SetClassLongW() to subclass window EDIT control Problem
http://bugs.winehq.org/show_bug.cgi?id=14350 Summary: SetClassLongW() to subclass window EDIT control Problem Product: Wine Version: 1.0.0 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: user32 AssignedTo: wine-bugs(a)winehq.org ReportedBy: hongbo(a)njstar.com CC: hongbo(a)njstar.com Created an attachment (id=14649) --> (http://bugs.winehq.org/attachment.cgi?id=14649) MSVC6 MFC test project with exe in debug dir Summary: SetClassLongW(hEditWnd, GCL_WNDPROC, (DWORD)EditWndProc) behave different on WINE 1.0 from Windows. Any EDIT window created after will be ANSI window on Windows, but Unicode Windows on Wine. How To Repeat: In the attached VC6 MFC ANSI App project, SetClassLongW is called in ------------------------------------------------------------------- static WNDPROC lpfnOldEditWndProc=NULL; LONG FAR PASCAL EditWndProc(HWND hWnd, WORD Message, WORD wParam, LONG lParam) { return CallWindowProcW((WNDPROC)lpfnOldEditWndProc, hWnd, Message, wParam,lParam); } int CDialogTestView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; HWND hEditWnd1 = CreateWindowEx(0,"EDIT", "E1",WS_POPUP,0, 0, 1, 1,NULL,NULL,NULL,NULL); lpfnOldEditWndProc =(WNDPROC)SetClassLongW(hEditWnd1, GCL_WNDPROC, (DWORD)EditWndProc); // TODO: Add your specialized creation code here return 0; } ------------------------------------------------------------------- There is a EDIT control on the About dialogbox, when click 'OK' on window the program report the Edit Box is NOT unicode Window. But Under Wine 1.0, It says 'the Edit Box IS unicode Window'. To Test: run the EXE in debug folder, Help - About DialogTest - click 'OK'. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Mikolaj Zalewski <mikolaj.zalewski(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikolaj.zalewski(a)gmail.com --- Comment #1 from Mikolaj Zalewski <mikolaj.zalewski(a)gmail.com> 2008-07-08 02:43:01 --- You are using CreateWindowExA or CreateWindowExW (do you have UNICODE defined)? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #2 from Hongbo Ni <hongbo(a)njstar.com> 2008-07-08 07:39:42 --- UNICODE is not defined because it's a ANSI (non-unicode) MFC application. So all Edit windows (include on About dialog) are created by CreateWindowExA. The problem is after subclassing the Edit class with a Unicode ProcW, any window created by CreateWindowExA will become a Unicode window on Wine, not on windowz. I checked wine souce, when built-in Edit control class is registered, it has ProcA and ProcW, so if you create a Edit window with CreateWindowExA, it will be ANSI, if you create a Edit window with CreateWindowExW, it will be Unicode. This behaviour is same on wine and windows. But in WINE, after we subclass Edit class with SetClassLongW(hEditWnd1, GCL_WNDPROC,(DWORD)EditWndProcW); The Edit Control only have one ProcW, ProcA is set to NULL. ------class.c line 908 -------------------------------- case GCLP_WNDPROC: retval = (ULONG_PTR)WINPROC_GetProc( class->winproc, unicode ); class->winproc = WINPROC_AllocProc( unicode ? NULL : (WNDPROC)newval, unicode ? (WNDPROC)newval : NULL ); break; ------------------------------------------------------- Now regardless you call CreateWindowExA or CreateWindowExW, the created window will be Unicode. This wine behaviour is different from Windows, where even after Edit class is subclass with SetClassLongW(hEditWnd1, GCL_WNDPROC,(DWORD)EditWndProcW); CreateWindowExA still create ANSI window, CreateWindowExW creates Unciode Windows. (EditWndProcW needs to handle both message from Ansi and Unicode edit windows). -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #3 from Hongbo Ni <hongbo(a)njstar.com> 2008-07-08 08:15:21 --- I suspect this is how micrsoft window works regarding to SetClassLongW(hEditWnd, GCL_WNDPROC,(DWORD)EditWndProc); ------/user32/class.c line 910 in CLASS_SetClassLong() ---------- + if (the class of hEditWnd has both ProcA and ProcW) { + class->winproc = WINPROC_AllocProc((WNDPROC)newval,(WNDPROC)newval); + }else{ class->winproc = WINPROC_AllocProc( unicode ? NULL : (WNDPROC)newval, unicode ? (WNDPROC)newval : NULL ); + } ---------------------------------------------------------------------- This means if you subclass a built-in class with SetClassLongW(h,GCL_WNDPROC,Proc) the Proc provided must be able to handle both ANSI and Unicode Edit Msg. This is what I have done in my EditWndProc using IsWindowUnicode() to distingush ANSI or Unicode Windows message. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Vitaliy Margolen <vitaliy(a)kievinfo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |major -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #4 from Hongbo Ni <hongbo(a)njstar.com> 2008-07-08 21:21:08 --- Sorry, above change is not working. Assertion fail for WINPROC_AllocProc((WNDPROC)newval,(WNDPROC)newval); in /user32/winproc.c function alloc_winproc() -------------------------------------------------------- if (funcA && funcW) { assert( builtin_used < BUILTIN_WINPROCS ); <---------------- proc = &winproc_array[builtin_used++]; proc->procA = funcA; proc->procW = funcW; TRACE( "allocated %p for builtin %p/%p (%d/%d used)\n", proc_to_handle(proc), funcA, funcW, builtin_used, BUILTIN_WINPROCS ); } -------------------------------------------------------- It seems we can only assign procA and proW for built-in class at initial call registration. I am still wonder how windows did this: After Edit class is subclassed with a Unicode procW, how come the CreateWindowExA still create Edit window as ANSI. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Hongbo Ni <hongbo(a)njstar.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED --- Comment #5 from Hongbo Ni <hongbo(a)njstar.com> 2008-07-14 02:57:44 --- I have posted the patch to wine-devel http://www.winehq.org/pipermail/wine-devel/2008-July/067379.html Please test or comment. Regards Hongbo Ni -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Hongbo Ni <hongbo(a)njstar.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |LATER --- Comment #6 from Hongbo Ni <hongbo(a)njstar.com> 2008-07-14 07:39:56 --- Sorry the Patch has not been accepted. Working on it. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Hongbo Ni <hongbo(a)njstar.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|1.0.0 |1.1.1 -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 James Hawkins <truiken(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|LATER | Version|1.1.1 |1.0.0 --- Comment #7 from James Hawkins <truiken(a)gmail.com> 2008-07-14 12:11:49 --- Don't change the original version. Keep the bug open. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Dmitry Timoshkov <dmitry(a)codeweavers.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal --- Comment #8 from Dmitry Timoshkov <dmitry(a)codeweavers.com> 2008-08-06 03:44:27 --- Not major. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #9 from Hongbo Ni <hongbo(a)njstar.com> 2008-08-06 21:31:53 --- Hi, I have submited my 2nd patch to add test cases for this behaviour. http://www.winehq.org/pipermail/wine-patches/2008-August/059295.html This behaviour applies to all builtin controls: Edit, Button, Static, ComboBox, ComboLBox, ListBox and even DialogBox On Windows 2000, XP, 2003, Vista. Can anyone test my test cases to confirm the behaviour ? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #10 from Austin English <austinenglish(a)gmail.com> 2010-07-26 01:56:31 --- Program crashes for me (that's after getting mfc42d.dll) in wine-1.2-423-g1f92dd3. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 butraxz(a)gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |butraxz(a)gmail.com --- Comment #11 from butraxz(a)gmail.com 2012-05-16 14:34:37 CDT --- No update from OP for four years. Is this still an issue in 1.5.4 or should this be closed as abandoned ? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=14350 Bruno Jesus <00cpxxx(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |00cpxxx(a)gmail.com Ever Confirmed|0 |1 --- Comment #12 from Bruno Jesus <00cpxxx(a)gmail.com> 2012-07-23 21:09:10 CDT --- Still present in wine 1.5.9. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=14350 --- Comment #13 from Ken Sharp <imwellcushtymelike(a)gmail.com> --- Is this still an issue in Wine 1.7.45 or later? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=14350 super_man(a)post.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man(a)post.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=14350 François Gouget <fgouget(a)codeweavers.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source CC| |fgouget(a)codeweavers.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (2)
-
wine-bugs@winehq.org -
WineHQ Bugzilla