[Bug 30392] Amazon digital downloads down loader crashes upon use (DrawText ellipsification fails on strings with very small width given)

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Apr 9 12:24:52 CDT 2012


http://bugs.winehq.org/show_bug.cgi?id=30392

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
          Component|-unknown                    |user32
            Summary|Amazon digital downloads    |Amazon digital downloads
                   |down loader crashes upon    |down loader crashes upon
                   |use                         |use (DrawText
                   |                            |ellipsification fails on
                   |                            |strings with very small
                   |                            |width given)
     Ever Confirmed|0                           |1

--- Comment #9 from Anastasius Focht <focht at gmx.net> 2012-04-09 12:24:52 CDT ---
Hello,

confirming.
I also requested the deletion of downloader binaries before writing anything.
You purchased the content so it belongs to you, not to be shared. 

With a quick-fix for this bug on my side I was actually able to start
downloading the content.
Don't worry, I didn't complete the download ;-)

The problem seems to be a DrawText ellipsification attempt on a string with a
very small drawing rectangle (width) given.

--- snip ---
...
0025:Call user32.SetWindowTextW(00010080,004d9f40 L"Elven Legacy Collection")
ret=0042efd9
0025:trace:msg:send_inter_thread_message hwnd 0x10080 msg c (WM_SETTEXT) wp 0
lp 4d9f40 
...
0024:Call window proc 0x7ebf56bb
(hwnd=0x10080,msg=WM_SETTEXT,wp=00000000,lp=004d9f40) 
...
0024:Ret  window proc 0x7eb6fd93
(hwnd=0x60052,msg=WM_CTLCOLORSTATIC,wp=000003a8,lp=00010080) retval=0000010c
/home/focht/projects/wine/wine-git/dlls/user32/text.c:719: TEXT_NextLineW:
Assertion `pellip->under == 0 && pellip->after == 0' failed.
0024:trace:seh:raise_exception code=80000101 flags=1 addr=0xf77cd430
ip=f77cd430 tid=0024
0024:trace:seh:raise_exception  eax=00000000 ebx=00003406 ecx=00003406
edx=00000006 esi=00000000 edi=f7622ff4
0024:trace:seh:raise_exception  ebp=0032ec78 esp=0032ea14 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00000296 
...
Backtrace:
=>0 0xf77cd430 __kernel_vsyscall+0x10() in [vdso].so (0x0032ec78)
  1 0xf74a898f gsignal+0x4e() in libc.so.6 (0x0032ec78)
  2 0xf74aa2d5 abort+0x174() in libc.so.6 (0x0032ec78)
  3 0xf74a16a5 __assert_fail_base+0x154() in libc.so.6 (0x0032ec78)
  4 0xf74a1757 __assert_fail+0x56() in libc.so.6 (0x0032ec78)
  5 0x7ebd943e TEXT_NextLineW+0x586(hdc=0x3a8, str="Elven Legacy Collection",
count=0x32ed2c, dest="......en Legacy Collection?2??", len=0x32ed30, width=0xc,
format=0x44060, retsize=0x32f538, last_line=0, p_retstr=0x32f534,
tabwidth=0x30, pprefix_offset=0x32ecec, pellip=0x32ecdc)
[/home/focht/projects/wine/wine-git/dlls/user32/text.c:719] in user32
(0x0032ec78)
  6 0x7ebd9c74 DrawTextExW+0x4d7(hdc=0x3a8, str="Elven Legacy Collection",
i_count=0xffffffff, rect=0x32f638, flags=0x44060, dtp=0x32f5ec)
[/home/focht/projects/wine/wine-git/dlls/user32/text.c:948] in user32
(0x0032f5b8)
  7 0x7ebda422 DrawTextW+0x8c(hdc=0x3a8, str="Elven Legacy Collection",
count=0xffffffff, rect=0x32f638, flags=0x44070)
[/home/focht/projects/wine/wine-git/dlls/user32/text.c:1132] in user32
(0x0032f608) 
...
--- snip ---

format 0x44060 = (DT_WORD_ELLIPSIS | DT_PATH_ELLIPSIS | DT_EXPANDTABS |
DT_SINGLELINE)

Debugging session:

--- snip ---
=>0 0x7ebd8eb7 TEXT_NextLineW(hdc=0x3a8, str="Elven Legacy Collection",
count=0x33edb8, dest="", len=0x33edbc, width=0xc, format=0x44060,
retsize=0x33f5c4, last_line=0, p_retstr=0x33f5c0, tabwidth=0x30,
pprefix_offset=0x33ed78, pellip=0x33ed68)
[/home/focht/projects/wine/wine-git/dlls/user32/text.c:590] in user32
(0x0033f644)

Wine-dbg>frame 1
1132        return DrawTextExW(hdc, (LPWSTR)str, count, rect, flags, &dtp);
Wine-dbg>p *rect
{left=0, top=0, right=0xc, bottom=0xd}
--- snip ---

Very small drawing rectangle for the static control.
The string won't fit at all, even ellipsified.

DT_PATH_ELLIPSIS being applied:

--- snip ---
        if (!line_fits && (format & DT_PATH_ELLIPSIS))
        {
            TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg,
                                max_seg_width, &size, *p_retstr, pellip);
            line_fits = (size.cx <= max_seg_width);
            ellipsified = 1;
        }

=>0 0x7ebd9327 TEXT_NextLineW+0x470(hdc=0x3a8, str="Elven Legacy Collection",
count=0x33edb8, dest="...Elven Legacy Collection", len=0x33edbc, width=0xc,
format=0x44060, retsize=0x33f

Wine-dbg>n
695                line_fits = (size.cx <= max_seg_width);
Wine-dbg>n
696                ellipsified = 1;
Wine-dbg>p line_fits
0
--- snip ---

DT_WORD_ELLIPSIS being applied:

--- snip ---
        if ((!line_fits && (format & DT_WORD_ELLIPSIS)) ||
            ((format & DT_END_ELLIPSIS) &&
              ((last_line && *count) ||
               (remainder_is_none_or_newline (*count, &str[i]) &&
!line_fits))))
        {
            int before, len_ellipsis;
            TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg,
                            max_seg_width, &size, *p_retstr, &before,
&len_ellipsis);

Wine-dbg>p dest
"......en Legacy Collection"

Wine-dbg>n
719                    assert (pellip->under == 0 && pellip->after == 0);
Wine-dbg>p *pellip
{before=0, len=0x3, under=0, after=0x17}
--- snip ---

Whoops ;-)

Loading the dialog resource into "Resource Hacker" tool yields:

--- snip ---
123 DIALOGEX 0, 0, 319, 94
STYLE DS_FIXEDSYS | DS_NOFAILCREATE | DS_MODALFRAME | DS_CENTER |
WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Amazon Downloader"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg", FW_NORMAL, FALSE, 0
{
   CONTROL "", 1001, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 15, 13 
   CONTROL "", 1002, STATIC, SS_LEFT | SS_PATHELLIPSIS | WS_CHILD | WS_VISIBLE
| WS_GROUP, 65, 7, 8, 8 
   CONTROL "", 1003, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 114,
7, 8, 8 
   CONTROL "", 1004, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 126,
7, 8, 8 
   CONTROL "", 1012, STATIC, SS_LEFT | SS_WORDELLIPSIS | WS_CHILD | WS_VISIBLE
| WS_GROUP, 65, 19, 244, 8 , 0x00000020
   CONTROL "Pause", 1005, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED |
WS_TABSTOP, 258, 35, 51, 14 
   CONTROL "Resume", 1006, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED |
WS_TABSTOP, 258, 35, 51, 14 
   CONTROL "", 1020, STATIC, SS_ETCHEDFRAME | WS_CHILD | WS_VISIBLE | WS_GROUP,
0, 56, 400, 1 
   CONTROL 103, 1022, STATIC, SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE |
WS_CHILD | WS_VISIBLE, 14, 64, 21, 2
--- snip ---

Dialog and first child control creation:

--- snip ---
0024:Call
user32.CreateDialogParamW(00400000,0000007b,00000000,004320f0,004d8e10)
ret=0042d6db 
...
0024:trace:win:WIN_CreateWindowEx L"Amazon Downloader" #8002 ex=00050001
style=80ca08dc 717,466 485x178 parent=(nil) menu=(nil) inst=0x400000
params=(nil)
0024:trace:win:dump_window_styles style: WS_POPUP WS_CAPTION WS_SYSMENU
WS_MINIMIZEBOX 000008dc
0024:trace:win:dump_window_styles exstyle: WS_EX_DLGMODALFRAME
WS_EX_CONTROLPARENT WS_EX_APPWINDOW 
...
0024:trace:win:GetWindowRect hwnd 0x60052 (717,466)-(1202,644) 
...
0024:trace:win:WIN_CreateWindowEx created window 0x60052 
...
0024:trace:win:WIN_CreateWindowEx L"" L"Static" ex=00000004 style=5000000e
11,11 23x21 parent=0x60052 menu=0x3e9 inst=0x400000 params=(nil)
0024:trace:win:dump_window_styles style: WS_CHILD WS_VISIBLE 0000000e
0024:trace:win:dump_window_styles exstyle: WS_EX_NOPARENTNOTIFY
...
0024:trace:win:WIN_CreateWindowEx hwnd 0x1007e cs 11,11 23x21
...
0024:trace:win:WIN_CreateWindowEx created window 0x1007e
--- snip ---

Next, the child control in question which has id 1002 (0x3ea):
The control has SS_PATHELLIPSIS set so it automatically becomes a single line
control.

--- snip ---
0024:trace:win:WIN_CreateWindowEx L"" L"Static" ex=00000004 style=50028000
98,11 12x13 parent=0x60052 menu=0x3ea inst=0x400000 params=(nil)
0024:trace:win:dump_window_styles style: WS_CHILD WS_VISIBLE WS_GROUP 00008000
0024:trace:win:dump_window_styles exstyle: WS_EX_NOPARENTNOTIFY
0024:trace:win:WIN_SetWindowLong 0x10080 -12 3ea W
0024:trace:win:GetWindowRect hwnd 0x10080 (818,499)-(830,512) 
...
0024:trace:win:WIN_CreateWindowEx hwnd 0x10080 cs 98,11 12x13 
...
0024:trace:win:WIN_CreateWindowEx created window 0x10080 
...
0024:Call dialog proc 0x4320f0
(hwnd=0x60052,msg=WM_INITDIALOG,wp=000100aa,lp=004d8e10) 
...
0024:Call user32.GetDlgItem(00060052,000003ea) ret=00430cc6
0024:Ret  user32.GetDlgItem() retval=00010080 ret=00430cc6
...
0024:Call user32.SendMessageW(00010080,00000030,000003e8,00000000) ret=00430d38
0024:Call window proc 0x7ebf56bb
(hwnd=0x10080,msg=WM_SETFONT,wp=000003e8,lp=00000000)
0024:trace:win:WIN_SetWindowLong 0x10080 0 3e8 W
0024:Ret  window proc 0x7ebf56bb
(hwnd=0x10080,msg=WM_SETFONT,wp=000003e8,lp=00000000) retval=00000000
0024:Ret  user32.SendMessageW() retval=00000000 ret=00430d38
...
0024:Call user32.GetWindowRect(00010080,0032f244) ret=00442269
0024:trace:win:GetWindowRect hwnd 0x10080 (818,499)-(830,512)
0024:Ret  user32.GetWindowRect() retval=00000001 ret=00442269
...
--- snip ---

The control in question (hwnd=0x10080, id=1002) is not resized by app after
creation to allow text to fit.

If you display/simulate the whole dialog in "Resource Hacker" tool (Dialog 123
-> 1033) the dialog layout seems a bit strange (many small/overlapping
controls).
Maybe the dialog resource is reused several times with some controls being made
visible or hidden, depending on use case.

Not sure what should be done if the width is so small that even ellipsification
alone "..." won't fit (truncation?).

I modified the code to better handle the case when width is too small for
ellipsification and it helped: the downloader proceeds and actually starts to
download the content.

Regards

-- 
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.



More information about the wine-bugs mailing list