Commit d461cca1 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme: Avoid calling application dialog procedures repeatedly.

Application dialog procedures are called in UXTHEME_DefDlgProc(), then may be called again in USER_DefDlgProcA/W(). Lotus Approach doesn't expect this and run into infinite recursion. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52586Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com>
parent 2a6a2b04
......@@ -131,12 +131,25 @@ LRESULT WINAPI UXTHEME_DefDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, BOO
dlgproc = (WNDPROC)GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, 0);
lr = LOWORD(CallWindowProcW(dlgproc, hwnd, msg, wp, lp));
if (lr)
if (lr || !IsWindow(hwnd))
return GetWindowLongPtrW(hwnd, DWLP_MSGRESULT);
brush = get_dialog_background_brush(hwnd, TRUE);
if (!brush)
break;
{
/* Copied from DEFDLG_Proc() */
brush = (HBRUSH)SendMessageW(hwnd, WM_CTLCOLORDLG, wp, (LPARAM)hwnd);
if (!brush)
brush = (HBRUSH)DefWindowProcW(hwnd, WM_CTLCOLORDLG, wp, (LPARAM)hwnd);
if (brush)
{
hdc = (HDC)wp;
GetClientRect(hwnd, &rect);
DPtoLP(hdc, (LPPOINT)&rect, 2);
FillRect(hdc, &rect, brush);
}
return TRUE;
}
/* Using FillRect() to draw background could introduce a tiling effect if the destination
* rectangle is larger than the pattern brush size, which is usually 10x600. This bug is
......@@ -157,12 +170,12 @@ LRESULT WINAPI UXTHEME_DefDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, BOO
{
dlgproc = (WNDPROC)GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
lr = CallWindowProcW(dlgproc, hwnd, msg, wp, lp);
if (lr)
if (lr || !IsWindow(hwnd))
return lr;
brush = get_dialog_background_brush(hwnd, FALSE);
if (!brush)
break;
return DefWindowProcW(hwnd, msg, wp, lp);
hdc = (HDC)wp;
SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
......
......@@ -2319,7 +2319,7 @@ static void test_EnableThemeDialogTexture(void)
sprintf(buffer, "message %#x\n", message_tests[i].msg);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
SendMessageW(dialog, message_tests[i].msg, (WPARAM)child_hdc, (LPARAM)child);
ok_sequence(sequences, PARENT_SEQ_INDEX, message_tests[i].msg_seq, buffer, TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, message_tests[i].msg_seq, buffer, FALSE);
}
ReleaseDC(child, child_hdc);
EndDialog(dialog, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment