user32: fix create_window_handle to create Ansi Edit after SetClassLongPtrW
Hongbo Ni
hongbo at njstar.com
Wed Jul 16 07:25:14 CDT 2008
This patch fixes Bug#14350
CreateWindowA("Edit"...) should create an Ansi window even after the builtin
Edit class has been subclassed by SetClassLongPtrW(hEdit,GCLP_WNDPROC,procW).
This bug applies to all builtin classes, but only Edit needs to be fixed
since in other builtin classes, user can not change the text in the control.
A->W->A conversion will get same string back. Edit is special since user
interact with it.
---
dlls/user32/win.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 9a97a3a..3e916da 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -173,6 +173,16 @@ static WND *create_window_handle( HWND parent, HWND owner, LPCWSTR name,
win->owner = full_owner;
win->class = class;
win->winproc = get_class_winproc( class );
+ /* This is a window hack - When builtin class is subclassed by SetClassLongW */
+ /* If creating an ansi Edit window & the class has no ansi proc, use unicode */
+ /* proc as ansi proc. While this hack applies to all builtin classes, only Edit */
+ /* class needs to to be fixed, because the text in the other builtin classes */
+ /* do not interact with the user, a A->W->A conversion will get same str back*/
+ if(!unicode && !IS_INTRESOURCE(name) && !strcmpiW( name, EDIT_builtin_class.name )
+ && WINPROC_IsUnicode( win->winproc, 0 ) && WINPROC_IsUnicode( win->winproc, 1 ))
+ {
+ win->winproc = WINPROC_AllocProc( WINPROC_GetProc( win->winproc, 1 ), NULL );
+ }
win->dwMagic = WND_MAGIC;
win->cbWndExtra = extra_bytes;
if (WINPROC_IsUnicode( win->winproc, unicode )) win->flags |= WIN_ISUNICODE;
--
1.5.2.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20080716/6502f0c9/attachment-0001.htm
More information about the wine-patches
mailing list