From 28c8e357d9b52584cca400864dbefed69b69f8f6 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Thu, 19 Feb 2015 23:12:55 +0000 Subject: core: WINE fix - handle invalid WNDPROC for edit control TabSRMM: wine fixes for settings, code rewrited SimpleStatusMsg: resourses changed git-svn-id: http://svn.miranda-ng.org/main/trunk@12206 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/subclass.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/mir_core/src/subclass.cpp b/src/mir_core/src/subclass.cpp index 0852668d79..0a29634a67 100644 --- a/src/mir_core/src/subclass.cpp +++ b/src/mir_core/src/subclass.cpp @@ -48,6 +48,13 @@ static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP return DefWindowProc(hwnd, uMsg, wParam, lParam); } +/* This is for wine: it return wrong WNDPROC for edit control in some cases. */ +#ifdef WIN64 +#define STD_WND_PROC_ADDR_MASK 0x7FFF00000 +#else +#define STD_WND_PROC_ADDR_MASK 0xFFFF0000 +#endif + MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc) { MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd); @@ -55,6 +62,13 @@ MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc) p = new MSubclassData; p->m_hWnd = hWnd; p->m_origWndProc = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)MSubclassWndProc); + if (((SIZE_T)p->m_origWndProc & STD_WND_PROC_ADDR_MASK) == STD_WND_PROC_ADDR_MASK) { /* XXX: fix me. Wine fix. */ + //MessageBox(NULL, _T("mir_subclassWindow"), NULL, 0); + p->m_origWndProc = (WNDPROC)GetClassLongPtr(hWnd, GCLP_WNDPROC); + if (((SIZE_T)p->m_origWndProc & 0x7FFF0000) == 0x7FFF0000) { /* Delay crash. */ + p->m_origWndProc = DefWindowProc; + } + } p->m_iHooks = 0; p->m_hooks = (WNDPROC*)malloc( sizeof(WNDPROC)); arSubclass.insert(p); -- cgit v1.2.3