WM_GETTEXTLENGTH change in winproc.c

Gerard Patel gerard.patel at nerim.net
Sat Aug 18 17:54:55 CDT 2001


At 01:19 PM 18/08/2001 -0700, you wrote:
>
>The idea is that 6 Unicode chars can yield more than 6 ASCII chars
>with DBCS text. The MSDN doc states that WM_GETTEXTLENGTH can return
>more than the actual size when mixing ASCII and Unicode.
>
>What does the app do exactly?  Maybe there are cases where the
>conversion can be avoided.

WM_GETTEXTLENGTH, WM_GETTEXT, then DrawText with the
length returned by WM_GETTEXTLENGTH.
If the app had used the length returned by WM_GETTEXT, it would
have worked all right of course - maybe that's the reason why
the problem does not appear more often ?

In the following trace Cancel is the text of a button in a dialog box.

Gerard

080682e8:Call window proc 0x5f404ae6
(hwnd=000026dc,msg=WM_DRAWITEM,wp=00000002,lp=40586474)
080682e8:Call user32.GetPropA(000026dc,5f49c94c "AfxOldWndProc423") ret=5f404b09
080682e8:Ret  user32.GetPropA() retval=40ac0259 ret=5f404b09
080682e8:Call
user32.CallWindowProcA(40ac0259,000026dc,0000002b,00000002,40586474)
ret=5f404b4b
080682e8:Call window proc 0x406a7980
(hwnd=000026dc,msg=WM_DRAWITEM,wp=00000002,lp=40586474)
080682e8:Call window proc 0x43d715
(hwnd=000026dc,msg=WM_DRAWITEM,wp=00000002,lp=40586474)
080682e8:Call user32.GetWindowLongA(000026dc,00000008) ret=0043d727
080682e8:Ret  user32.GetWindowLongA() retval=40586914 ret=0043d727
080682e8:Call user32.GetWindowTextLengthA(00002e0c) ret=0043bb82
trace:message:SPY_EnterMessage             (00002e0c) "Cancel"
message [000e] WM_GETTEXTLENGTH sent from self wp=00000000 lp=00000000
080682e8:Call window proc 0x43d28b
(hwnd=00002e0c,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000)
080682e8:Call
user32.CallWindowProcA(40ac00f1,00002e0c,0000000e,00000000,00000000)
ret=0043d2b8
080682e8:Call window proc 0x40679e8c
(hwnd=00002e0c,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000)
trace:message:SPY_EnterMessage                 (00002e0c)  DefWindowProc32:
WM_GETTEXTLENGTH [000e]  wp=00000000 lp=00000000
trace:message:SPY_ExitMessage                  (00002e0c)  DefWindowProc32:
WM_GETTEXTLENGTH [000e] returned 00000006
080682e8:Ret  window proc 0x40679e8c
(hwnd=00002e0c,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000) retval=00000006
080682e8:Ret  user32.CallWindowProcA() retval=0000000c ret=0043d2b8
080682e8:Ret  window proc 0x43d28b
(hwnd=00002e0c,msg=WM_GETTEXTLENGTH,wp=00000000,lp=00000000) retval=0000000c
trace:message:SPY_ExitMessage              (00002e0c) "Cancel"
message [000e] WM_GETTEXTLENGTH returned 0000000c
080682e8:Ret  user32.GetWindowTextLengthA() retval=0000000c ret=0043bb82
080682e8:Call ntdll.RtlEnterCriticalSection(5f4d0088) ret=5f4020bd
080682e8:Ret  ntdll.RtlEnterCriticalSection() retval=00000000 ret=5f4020bd
080682e8:Call ntdll.RtlLeaveCriticalSection(5f4d0088) ret=5f402103
080682e8:Ret  ntdll.RtlLeaveCriticalSection() retval=00000000 ret=5f402103
080682e8:Call user32.GetWindowTextA(00002e0c,413904e0,0000000d) ret=0043bba9
trace:message:SPY_EnterMessage             (00002e0c) "Cancel"
message [000d] WM_GETTEXT sent from self wp=0000000d lp=413904e0
080682e8:Call window proc 0x43d28b
(hwnd=00002e0c,msg=WM_GETTEXT,wp=0000000d,lp=413904e0)
080682e8:Call
user32.CallWindowProcA(40ac00f1,00002e0c,0000000d,0000000d,413904e0)
ret=0043d2b8
080682e8:Call window proc 0x40679e8c
(hwnd=00002e0c,msg=WM_GETTEXT,wp=0000000d,lp=403a7328)
trace:message:SPY_EnterMessage                 (00002e0c)  DefWindowProc32:
WM_GETTEXT [000d]  wp=0000000d lp=403a7328
trace:message:SPY_ExitMessage                  (00002e0c)  DefWindowProc32:
WM_GETTEXT [000d] returned 00000006
080682e8:Ret  window proc 0x40679e8c
(hwnd=00002e0c,msg=WM_GETTEXT,wp=0000000d,lp=403a7328) retval=00000006
080682e8:Ret  user32.CallWindowProcA() retval=00000006 ret=0043d2b8
080682e8:Ret  window proc 0x43d28b
(hwnd=00002e0c,msg=WM_GETTEXT,wp=0000000d,lp=413904e0) retval=00000006
trace:message:SPY_ExitMessage              (00002e0c) "Cancel"
message [000d] WM_GETTEXT returned 00000006
080682e8:Ret  user32.GetWindowTextA() retval=00000006 ret=0043bba9

<snip unrelated painting instructions>

080682e8:Call
gdi32.GetTextExtentPoint32A(00000088,413b00d0,00000006,40585f68) ret=0043c022
080682e8:Call x11drv.GetTextExtentPoint(4037c808,4039d238,00000006,40585f68)
ret=40747c04
trace:text:X11DRV_GetTextExtentPoint L"Cancel"... 6
080682e8:Ret  x11drv.GetTextExtentPoint() retval=00000001 ret=40747c04
080682e8:Ret  gdi32.GetTextExtentPoint32A() retval=00000001 ret=0043c022

<snip a few text painting preparation>

080682e8:Call user32.DrawTextA(00000088,413904e0
"Cancel",0000000c,40585f28,00000100) ret=0043c13a
trace:text:DrawTextExW L"Cancel", 12 , [(9,4),(51,20)]







More information about the wine-devel mailing list