mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[User32]
- Fix class window procedure checks, prevents misbehaving applications from calling wrong class procs. - Fixed callout for static control color brush. svn path=/trunk/; revision=54249
This commit is contained in:
parent
3581e033d0
commit
519e75748d
7 changed files with 71 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <user32.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue