diff --git a/reactos/dll/win32/user32/controls/button.c b/reactos/dll/win32/user32/controls/button.c index 3fef42efc56..760d8149aaa 100644 --- a/reactos/dll/win32/user32/controls/button.c +++ b/reactos/dll/win32/user32/controls/button.c @@ -266,6 +266,14 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, { NtUserSetWindowFNID(hWnd, FNID_BUTTON); } + else + { + if (pWnd->fnid != FNID_BUTTON) + { + ERR("Wrong window class for Button!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/combo.c b/reactos/dll/win32/user32/controls/combo.c index 4d678b790d9..1c474ec66d9 100644 --- a/reactos/dll/win32/user32/controls/combo.c +++ b/reactos/dll/win32/user32/controls/combo.c @@ -1843,6 +1843,14 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, { NtUserSetWindowFNID(hwnd, FNID_COMBOBOX); } + else + { + if (pWnd->fnid != FNID_COMBOBOX) + { + ERR("Wrong window class for ComboBox!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/edit.c b/reactos/dll/win32/user32/controls/edit.c index 1b4c80c0268..eef6d5e1ef4 100644 --- a/reactos/dll/win32/user32/controls/edit.c +++ b/reactos/dll/win32/user32/controls/edit.c @@ -4477,6 +4477,14 @@ LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP { NtUserSetWindowFNID(hwnd, FNID_EDIT); } + else + { + if (pWnd->fnid != FNID_EDIT) + { + ERR("Wrong window class for Edit!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/icontitle.c b/reactos/dll/win32/user32/controls/icontitle.c index edcdd6bbfc2..f5f66f7aa84 100644 --- a/reactos/dll/win32/user32/controls/icontitle.c +++ b/reactos/dll/win32/user32/controls/icontitle.c @@ -21,6 +21,7 @@ #include #include +WINE_DEFAULT_DEBUG_CHANNEL(user32); static BOOL bMultiLineTitle; static HFONT hIconTitleFont; @@ -198,6 +199,14 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, { NtUserSetWindowFNID(hWnd, FNID_ICONTITLE); } + else + { + if (pWnd->fnid != FNID_ICONTITLE) + { + ERR("Wrong window class for IconTitle!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/listbox.c b/reactos/dll/win32/user32/controls/listbox.c index 15de6ee7bf3..3dddb3bf5a2 100644 --- a/reactos/dll/win32/user32/controls/listbox.c +++ b/reactos/dll/win32/user32/controls/listbox.c @@ -2584,6 +2584,14 @@ LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, { NtUserSetWindowFNID(hwnd, FNID_LISTBOX); // Could be FNID_COMBOLBOX by class. } + else + { + if (pWnd->fnid != FNID_LISTBOX) + { + ERR("Wrong window class for listbox!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/scrollbar.c b/reactos/dll/win32/user32/controls/scrollbar.c index bbd94d454cd..64dced5ef4b 100644 --- a/reactos/dll/win32/user32/controls/scrollbar.c +++ b/reactos/dll/win32/user32/controls/scrollbar.c @@ -1253,6 +1253,14 @@ ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARA { NtUserSetWindowFNID(Wnd, FNID_SCROLLBAR); } + else + { + if (pWnd->fnid != FNID_SCROLLBAR) + { + ERR("Wrong window class for Scrollbar!\n"); + return 0; + } + } } #endif diff --git a/reactos/dll/win32/user32/controls/static.c b/reactos/dll/win32/user32/controls/static.c index 811bae47043..3b2491e48d2 100644 --- a/reactos/dll/win32/user32/controls/static.c +++ b/reactos/dll/win32/user32/controls/static.c @@ -324,15 +324,26 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style) } } +BOOL WINAPI GdiValidateHandle(HGDIOBJ hobj); + static HBRUSH STATIC_SendWmCtlColorStatic(HWND hwnd, HDC hdc) { + PWND pwnd; HBRUSH hBrush; HWND parent = GetParent(hwnd); if (!parent) parent = hwnd; + // ReactOS + pwnd = ValidateHwnd(parent); + if (pwnd && !TestWindowProcess(pwnd)) + { + return (HBRUSH)DefWindowProcW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd); + } + //// hBrush = (HBRUSH) SendMessageW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd ); - if (!hBrush) /* did the app forget to call DefWindowProc ? */ + if (!hBrush || /* did the app forget to call DefWindowProc ? */ + !GdiValidateHandle(hBrush)) // ReactOS { /* FIXME: DefWindowProc should return different colors if a manifest is present */ @@ -388,6 +399,14 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM { NtUserSetWindowFNID(hwnd, FNID_STATIC); } + else + { + if (pWnd->fnid != FNID_STATIC) + { + ERR("Wrong window class for Static!\n"); + return 0; + } + } } #endif @@ -505,10 +524,10 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM if (HIWORD(lParam)) { if(unicode) - lResult = DefWindowProcW( hwnd, uMsg, wParam, lParam ); + lResult = DefWindowProcW( hwnd, uMsg, wParam, lParam ); else lResult = DefWindowProcA( hwnd, uMsg, wParam, lParam ); - STATIC_TryPaintFcn( hwnd, full_style ); + STATIC_TryPaintFcn( hwnd, full_style ); } } break;