summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2015-02-19 23:12:55 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2015-02-19 23:12:55 +0000
commit28c8e357d9b52584cca400864dbefed69b69f8f6 (patch)
tree2fdf0fc1934f504ce99b77c68a40baa21de538a6 /src
parent9b1fc3cd956ce527bd744c538db6cfb5fff572e6 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/subclass.cpp14
1 files changed, 14 insertions, 0 deletions
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);