Author: jimtabor
Date: Mon Oct 24 14:47:59 2011
New Revision: 54249
URL:
http://svn.reactos.org/svn/reactos?rev=54249&view=rev
Log:
[User32]
- Fix class window procedure checks, prevents misbehaving applications from calling wrong
class procs.
- Fixed callout for static control color brush.
Modified:
trunk/reactos/dll/win32/user32/controls/button.c
trunk/reactos/dll/win32/user32/controls/combo.c
trunk/reactos/dll/win32/user32/controls/edit.c
trunk/reactos/dll/win32/user32/controls/icontitle.c
trunk/reactos/dll/win32/user32/controls/listbox.c
trunk/reactos/dll/win32/user32/controls/scrollbar.c
trunk/reactos/dll/win32/user32/controls/static.c
Modified: trunk/reactos/dll/win32/user32/controls/button.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] Mon Oct 24 14:47:59
2011
@@ -266,6 +266,14 @@
{
NtUserSetWindowFNID(hWnd, FNID_BUTTON);
}
+ else
+ {
+ if (pWnd->fnid != FNID_BUTTON)
+ {
+ ERR("Wrong window class for Button!\n");
+ return 0;
+ }
+ }
}
#endif
Modified: trunk/reactos/dll/win32/user32/controls/combo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] Mon Oct 24 14:47:59 2011
@@ -1842,6 +1842,14 @@
if (!pWnd->fnid)
{
NtUserSetWindowFNID(hwnd, FNID_COMBOBOX);
+ }
+ else
+ {
+ if (pWnd->fnid != FNID_COMBOBOX)
+ {
+ ERR("Wrong window class for ComboBox!\n");
+ return 0;
+ }
}
}
#endif
Modified: trunk/reactos/dll/win32/user32/controls/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Mon Oct 24 14:47:59 2011
@@ -4477,6 +4477,14 @@
{
NtUserSetWindowFNID(hwnd, FNID_EDIT);
}
+ else
+ {
+ if (pWnd->fnid != FNID_EDIT)
+ {
+ ERR("Wrong window class for Edit!\n");
+ return 0;
+ }
+ }
}
#endif
Modified: trunk/reactos/dll/win32/user32/controls/icontitle.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/icontitle.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/icontitle.c [iso-8859-1] Mon Oct 24 14:47:59
2011
@@ -21,6 +21,7 @@
#include <user32.h>
#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(user32);
static BOOL bMultiLineTitle;
static HFONT hIconTitleFont;
@@ -197,6 +198,14 @@
if (!pWnd->fnid)
{
NtUserSetWindowFNID(hWnd, FNID_ICONTITLE);
+ }
+ else
+ {
+ if (pWnd->fnid != FNID_ICONTITLE)
+ {
+ ERR("Wrong window class for IconTitle!\n");
+ return 0;
+ }
}
}
#endif
Modified: trunk/reactos/dll/win32/user32/controls/listbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] Mon Oct 24 14:47:59
2011
@@ -2583,6 +2583,14 @@
if (!pWnd->fnid)
{
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
Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] Mon Oct 24 14:47:59
2011
@@ -1253,6 +1253,14 @@
{
NtUserSetWindowFNID(Wnd, FNID_SCROLLBAR);
}
+ else
+ {
+ if (pWnd->fnid != FNID_SCROLLBAR)
+ {
+ ERR("Wrong window class for Scrollbar!\n");
+ return 0;
+ }
+ }
}
#endif
Modified: trunk/reactos/dll/win32/user32/controls/static.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/static.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/static.c [iso-8859-1] Mon Oct 24 14:47:59
2011
@@ -324,15 +324,26 @@
}
}
+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 */
@@ -387,6 +398,14 @@
if (!pWnd->fnid)
{
NtUserSetWindowFNID(hwnd, FNID_STATIC);
+ }
+ else
+ {
+ if (pWnd->fnid != FNID_STATIC)
+ {
+ ERR("Wrong window class for Static!\n");
+ return 0;
+ }
}
}
#endif
@@ -505,10 +524,10 @@
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;