From 6f15b54ade21c2c1cbf5a64692eb27c6173db706 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Wed, 2 Aug 2006 22:54:03 +0200 Subject: [PATCH] riched20: Handle incorrect calls of window procedure. --- dlls/riched20/editor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 390ac3bdb2a..5b42584a706 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1060,6 +1060,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) { CHARFORMAT2W chf; char buf[2048]; + chf.cbSize = sizeof(chf); ME_GetSelectionCharFormat(editor, &chf); ME_DumpStyleToBuf(&chf, buf); @@ -1393,11 +1394,16 @@ get_msg_name(UINT msg) */ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { SCROLLINFO si; - ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongW(hWnd, 0); + ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(hWnd, 0); TRACE("hWnd %p msg %04x (%s) %08x %08lx\n", hWnd, msg, get_msg_name(msg), wParam, lParam); + if (!editor && msg != WM_NCCREATE && msg != WM_NCDESTROY) { + ERR("RichEditANSIWndProc called with invalid hWnd %p - application bug?\n", hWnd); + return 0; + } + switch(msg) { UNSUPPORTED_MSG(EM_DISPLAYBAND)