@alexhenrie @zhiyi
Description: When flags does not include DT_CALCRECT, since len is calculated in the middle, it will be reduced to zero. Resulting in the length of the processed string that is finally returned to zero and the non-processing string length is unchanged. But some application taking the non-processing string length to zero as the loop end condition.
The test case's merge request number is 8177.
Signed-off-by: chenjiangyi chenjiangyi@uniontech.com
From: chenjiangyi chenjiangyi@uniontech.com
Description: When flags does not include DT_CALCRECT, since len is calculated in the middle, it will be reduced to zero. Resulting in the length of the processed string that is finally returned to zero and the non-processing string length is unchanged. But some application taking the non-processing string length to zero as the loop end condition.
Signed-off-by: chenjiangyi chenjiangyi@uniontech.com --- dlls/user32/text.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/text.c b/dlls/user32/text.c index 1896627c893..b026ca7b4ed 100644 --- a/dlls/user32/text.c +++ b/dlls/user32/text.c @@ -871,7 +871,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, WCHAR *retstr; size_t size_retstr; WCHAR line[MAX_BUFFER]; - int len, lh, count=i_count; + int len, lh, old_count, count=i_count; TEXTMETRICW tm; int lmargin = 0, rmargin = 0; int x, y, width; @@ -978,7 +978,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, last_line = !(flags & DT_NOCLIP) && y - ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) < rect->bottom; else last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; + + old_count = count; strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, retstr, tabwidth, &prefix_offset, &ellip); + if (dtp) dtp->uiLengthDrawn += old_count - count;
if (flags & DT_CENTER) x = (rect->left + lmargin + rect->right - rmargin - size.cx) / 2; @@ -1051,8 +1054,6 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, y -= lh; else y += lh; - if (dtp) - dtp->uiLengthDrawn += len; } while (strPtr && !last_line);