At 11:32 AM 1/7/01 +0800, you wrote:
>"gerard patel" <[EMAIL PROTECTED]> wrote:

>After listbox will be unicoded, welcome to report any bugs...

First, your last send to wine-patches is fixing the combobox problem,
thanks.

>Even 16-bit EM_GETHANDLE16 should work. It works by allocating alias buffer
>on EM_GETHANDLE/EM_GETHANDLE16 call and does synchronization with external
>buffer every time when internal unicode buffer is accessed.
>
>Do you have an application that doesn't work after the edit control rewrite?

Notepad 16 bits. The version I use for testing was coming with Wfw 3.11 I think.
I have searched a bit and the problem seems to be the buffer length.

I launch it and enter "01234567890hh0123456789"
Then I save to disk and reload, and get something along the lines of 
"01234567890hh01234+6x7 ^@"

I have added a few traces and here is what happens when it is saving the
data : 

Call KERNEL.85: _LOPEN(0x029e00c0 "C:\\aa.txt",0x0002) ret=0287:00bd ds=029e
Ret  KERNEL.85: _LOPEN() retval=0x0005 ret=0287:00bd ds=029e
Call USER.111: SENDMESSAGE(0x0334,0x0418,0x0000,0x00000000) ret=0287:0119 ds=029e
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_USER+0018,wp=00000000,lp=00000000)
trace:edit:EDIT_LockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EditWndProc_locked 16 bit : EM_FMTLINES: hwnd=00000334, wParam=00000000, 
lParam=00000000
trace:edit:EditWndProc_locked 32 bit A : EM_FMTLINES: hwnd=00000334, wParam=00000000, 
lParam=00000000
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"01234567890hh01234567890" wsiz=35 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=01234567890hh01234+6x7
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_USER+0018,wp=00000000,lp=00000000) 
ret=00000000
Ret  USER.111: SENDMESSAGE() retval=0x00000000 ret=0287:0119 ds=029e
Call KERNEL.8: LOCALLOCK(0x36f6) ret=0287:0125 ds=029e
Ret  KERNEL.8: LOCALLOCK() retval=0x029e36de ret=0287:0125 ds=029e
Call USER.111: SENDMESSAGE(0x0334,0x000e,0x0000,0x00000000) ret=0287:013c ds=029e
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000)
trace:edit:EDIT_LockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EditWndProc_locked 32 bit A : WM_GETTEXTLENGTH: hwnd=00000334, 
wParam=00000000, lParam=00000000
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"01234567890hh01234567890" wsiz=35 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=01234567890hh01234+6x7
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000) 
ret=00000018
Ret  USER.111: SENDMESSAGE() retval=0x00000018 ret=0287:013c ds=029e     

As you see, the ascii length (the countA in the EDIT_UnlockBuffer) is too small. The 
end
of the string is not converted.

Here is the first call to this code :

Call USER.111: SENDMESSAGE(0x0334,0x040d,0x0000,0x00000000) ret=027f:03d6 ds=029f
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_USER+000d,wp=00000000,lp=00000000)
trace:edit:EditWndProc_locked 16 bit : EM_GETHANDLE: hwnd=00000334, wParam=00000000, 
lParam=00000000
trace:edit:EDIT_EM_GetHandle16 Allocating 16-bit ANSI alias buffer
trace:edit:EDIT_EM_GetHandle16 Returning 36F6, LocalSize() = 18
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"" wsiz=15 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_USER+000d,wp=00000000,lp=00000000) 
ret=000036f6                       

I have not investigated from where this 18 value is coming.
It's not incremented as I type text in the edit buffer :

Ret  USER.111: SENDMESSAGE() retval=0x00000001 ret=0277:0499 ds=029e
CallTo16() ss:sp=029f:2334
     AX=0000 BX=0000 CX=0000 DX=0000 BP=235e SP=2334
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"0" wsiz=15 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=0

(...)

Call USER.114: DISPATCHMESSAGE(029f:236c) ret=0277:0c84 ds=029f
trace:relay:WINPROC_CallWndProc 
(wndproc=0x405e113c,hwnd=00000334,msg=WM_CHAR,wp=00000032,lp=00500001)
trace:edit:EDIT_LockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EditWndProc_locked 32 bit A : WM_CHAR: hwnd=00000334, wParam=00000032, 
lParam=00500001
trace:edit:EDIT_EM_ReplaceSel L"2", can_undo 1, send_update 1
trace:edit:EDIT_MakeFit trying to ReAlloc to 16+1 characters
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"01234567890hh01" wsiz=15 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=01234567890hh01
trace:edit:EDIT_MakeFit Old 32 bit handle 403832ee, new handle 403832ee
trace:edit:EDIT_LockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_MakeFit We now have 35+1    

Here is the place when some synchronization is missing I guess...

(...)

Ret  USER.111: SENDMESSAGE() retval=0x00000010 ret=0277:0499 ds=029e
CallTo16() ss:sp=029f:2334
     AX=0000 BX=0000 CX=0000 DX=0000 BP=235e SP=2334
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"01234567890hh012" wsiz=35 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=01234567890hh012 

(...)

     AX=0000 BX=0000 CX=0000 DX=0000 BP=235e SP=2334
trace:edit:EDIT_UnlockBuffer Synchronizing with 16-bit ANSI buffer
trace:edit:EDIT_UnlockBuffer unic text=L"01234567890hh01234" wsiz=35 asiz=18
trace:edit:EDIT_UnlockBuffer ansi text=01234567890hh01234+6x7         

This is working somewhat better :

--- edit.c.orig Fri Jan  5 09:20:14 2001
+++ edit.c      Sun Jan  7 16:05:34 2001
@@ -1662,6 +1662,9 @@
                TRACE("Old 32 bit handle %08x, new handle %08x\n", es->hloc32W, 
hNew32W);
                es->hloc32W = hNew32W;
                es->buffer_size = LocalSize(hNew32W)/sizeof(WCHAR) - 1;
+                if (es->hloc16)
+                   es->hloc16 = LOCAL_ReAlloc(wnd->hInstance, es->hloc16,
+                                               es->buffer_size+1, LMEM_MOVEABLE);
            }
        }

But I'd prefer you take a look at the problem.
               
Did you consider to keep an ansi buffer for ansi apps ? I don't know how easy
a double compilation would be to implement inside Wine (like it's done for 
applications,
with a call like GetText generating GetTextA or GetTextW according to the state
of the UNICODE flag), but maybe it could have made the code simpler and somewhat 
more efficient.

Gerard


Reply via email to