Author: jimtabor
Date: Sun Jun 28 07:02:15 2009
New Revision: 41656
URL:
http://svn.reactos.org/svn/reactos?rev=41656&view=rev
Log:
- Add more hooks, where wine has them placed. Fixed user32 hooks for win32k.
Modified:
trunk/reactos/dll/win32/user32/windows/defwnd.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Sun Jun 28 07:02:15 2009
@@ -682,13 +682,13 @@
DeleteObject(DesktopRgn);
}
}
-#if 0
- if (ISITHOOKED(WH_CBT))
+//#if 0
+// if (ISITHOOKED(WH_CBT))
{
- if (NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, (LPARAM)&sizingRect, 0,
FNID_DEFWINDOWPROC, FALSE))
+ if (NtUserMessageCall( hwnd, WM_CBT, HCBT_MOVESIZE, (LPARAM)&sizingRect, 0,
FNID_DEFWINDOWPROC, FALSE))
moved = FALSE;
}
-#endif
+//#endif
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, NULL);
SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
@@ -768,13 +768,15 @@
WINDOWPLACEMENT wp;
POINT Pt;
-#if 0
- if (ISITHOOKED(WH_CBT))
+ if (!IsWindowEnabled( hWnd )) return 0;
+
+//#if 0
+// if (ISITHOOKED(WH_CBT))
{
if (NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, 0, FNID_DEFWINDOWPROC,
FALSE))
return 0;
}
-#endif
+//#endif
switch (wParam & 0xfff0)
{
case SC_MOVE:
@@ -806,8 +808,8 @@
}
break;
case SC_CLOSE:
- SendMessageA(hWnd, WM_CLOSE, 0, 0);
- break;
+ return SendMessageW(hWnd, WM_CLOSE, 0, 0);
+
case SC_MOUSEMENU:
{
Pt.x = (short)LOWORD(lParam);
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun Jun 28 07:02:15 2009
@@ -559,6 +559,7 @@
//
#define WM_SYSTIMER 280
#define WM_POPUPSYSTEMMENU 787
+#define WM_CBT 1023 // ReactOS only.
//
// Non SDK DCE types.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Sun Jun 28 07:02:15
2009
@@ -12,25 +12,6 @@
#define NDEBUG
#include <debug.h>
-LRESULT FASTCALL
-IntDefWinHandleSysCommand( PWINDOW_OBJECT Window, WPARAM wParam, LPARAM lParam , BOOL
Ansi)
-{
- DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Window->hSelf, wParam, lParam
);
-
- if (!ISITHOOKED(WH_CBT)) return 0;
-
-// if (!UserCallNextHookEx(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, Ansi))
- return 0;
-
- switch (wParam & 0xfff0)
- {
- case SC_MOVE:
- case SC_SIZE:
- // return UserCallNextHookEx(WH_CBT, HCBT_MOVESIZE, (WPARAM)Window->hSelf,
lParam, Ansi);
- break;
- }
- return 1;
-}
/*
Win32k counterpart of User DefWindowProc
*/
@@ -54,7 +35,9 @@
{
case WM_SYSCOMMAND:
{
- lResult = IntDefWinHandleSysCommand( Window, wParam, lParam, Ansi );
+ DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Window->hSelf, wParam,
lParam );
+ if (!ISITHOOKED(WH_CBT)) break;
+ lResult = co_HOOK_CallHooks(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam);
break;
}
case WM_SHOWWINDOW:
@@ -76,8 +59,43 @@
}
}
break;
+ case WM_CBT:
+ {
+ if (!ISITHOOKED(WH_CBT)) break;
+
+ switch (wParam)
+ {
+ case HCBT_MOVESIZE:
+ {
+ RECTL rt;
+
+ if (lParam)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead((PVOID)lParam,
+ sizeof(RECT),
+ 1);
+
+ RtlCopyMemory(&rt,
+ (PVOID)lParam,
+ sizeof(RECT));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ lResult = 1;
+ }
+ _SEH2_END;
+ }
+ if (!lResult)
+ lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE,
(WPARAM)Window->hSelf, lParam ? (LPARAM)&rt : 0);
+ }
+ break;
+ }
+ break;
+ }
+ break;
}
-
return lResult;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Sun Jun 28 07:02:15
2009
@@ -320,6 +320,7 @@
HWND hWndPrev;
HWND hWnd = 0;
PWINDOW Wnd;
+ CBTACTIVATESTRUCT cbt;
if (Window)
ASSERT_REFS_CO(Window);
@@ -346,7 +347,11 @@
return hWndPrev;
}
- /* FIXME: Call hooks. */
+ /* call CBT hook chain */
+ cbt.fMouse = FALSE;
+ cbt.hWndActive = hWndPrev;
+ if (co_HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd, (LPARAM)&cbt))
+ return 0;
ThreadQueue->ActiveWindow = hWnd;
@@ -382,6 +387,9 @@
return hWndPrev;
}
+ if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)Window->hSelf,
(LPARAM)hWndPrev))
+ return 0;
+
ThreadQueue->FocusWindow = Window->hSelf;
co_IntSendKillFocusMessages(hWndPrev, Window->hSelf);
@@ -390,6 +398,9 @@
else
{
ThreadQueue->FocusWindow = 0;
+
+ if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)0, (LPARAM)hWndPrev))
+ return 0;
co_IntSendKillFocusMessages(hWndPrev, 0);
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Sun Jun 28 07:02:15
2009
@@ -307,6 +307,9 @@
Size.x = Wnd->WindowRect.left;
Size.y = Wnd->WindowRect.top;
WinPosInitInternalPos(Window, &Size, &Wnd->WindowRect);
+
+ if (co_HOOK_CallHooks( WH_CBT, HCBT_MINMAX, (WPARAM)Window->hSelf, ShowFlag))
+ return SWP_NOSIZE | SWP_NOMOVE;
if (Wnd->Style & WS_MINIMIZE)
{