[ros-diffs] [jimtabor] 41656: - Add more hooks, where wine has them placed. Fixed user32 hooks for win32k.
jimtabor at svn.reactos.org
jimtabor at svn.reactos.org
Sun Jun 28 10:32:39 CEST 2009
- Previous message: [ros-diffs] [tkreuzer] 41655: unbreak build of rostests
- Next message: [ros-diffs] [ros-arm-bringup] 41657: - Reimplement MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, MmFreeContiguousMemory, MmFreeContiguousMemorySpecifyCache: - Use a smarter algorithm (as described here: http://www.microsoft.com/whdc/Driver/tips/ContigMem.mspx) to first try to satisfy the allocation by a simple nonpaged pool allocation (for cached requests only). - This range is then checked for physical continuity, since it's not guaranteed for non-initial-pool allocations (and right now in ReactOS, it never is). - As a fallback, Windows NT then attempts to scan free nonpaged pool pages. This is not yet implemented since the ReactOS nonpaged pool is not usually contiguous (to the level that NT's is). - When the ARM pool is implemented and replaces nonpaged pool, this code path will have to be implemented. - As a last resort, the actual PFN database is scanned for contiguous free pages. - ReactOS used MmGetContiguousPages for this, which blindly scanned the PFN database. New MiFindContinuousPages will scan the physical memory descriptor block recently implemented, which avoids going over pages we already know are going to be unusable. - The ReactOS function also held the PFN lock for the entire duration of the scan, which is significant on systems with large memory. Instead, we make an initial unsafe scan first, and only lock when we think we've found a correct range (and we'll then reconfirm the ranges). - Finally, the older function actually did a double-scan to try to avoid using memory ranges under 16MB, which was useless on today's systems and also rather inefficient. - Other than that, the actual setup of the PFN entry is copy-pasted from the old ReactOS function, so nothing's changed there -- the page still looks the same, but the selection algorithm is faster and more accurate. - Once the pages are found, we piggyback on the new I/O mapping mechanism (which uses System PTEs) instead of doing it all over by hand as before. - Since the underlying support is still System PTEs, once again, optimizations to that component will yield significant improvements here too.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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/defwnd.c?rev=41656&r1=41655&r2=41656&view=diff
==============================================================================
--- 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/ntuser.h?rev=41656&r1=41655&r2=41656&view=diff
==============================================================================
--- 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/ntuser/defwnd.c?rev=41656&r1=41655&r2=41656&view=diff
==============================================================================
--- 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/ntuser/focus.c?rev=41656&r1=41655&r2=41656&view=diff
==============================================================================
--- 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/ntuser/winpos.c?rev=41656&r1=41655&r2=41656&view=diff
==============================================================================
--- 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)
{
- Previous message: [ros-diffs] [tkreuzer] 41655: unbreak build of rostests
- Next message: [ros-diffs] [ros-arm-bringup] 41657: - Reimplement MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, MmFreeContiguousMemory, MmFreeContiguousMemorySpecifyCache: - Use a smarter algorithm (as described here: http://www.microsoft.com/whdc/Driver/tips/ContigMem.mspx) to first try to satisfy the allocation by a simple nonpaged pool allocation (for cached requests only). - This range is then checked for physical continuity, since it's not guaranteed for non-initial-pool allocations (and right now in ReactOS, it never is). - As a fallback, Windows NT then attempts to scan free nonpaged pool pages. This is not yet implemented since the ReactOS nonpaged pool is not usually contiguous (to the level that NT's is). - When the ARM pool is implemented and replaces nonpaged pool, this code path will have to be implemented. - As a last resort, the actual PFN database is scanned for contiguous free pages. - ReactOS used MmGetContiguousPages for this, which blindly scanned the PFN database. New MiFindContinuousPages will scan the physical memory descriptor block recently implemented, which avoids going over pages we already know are going to be unusable. - The ReactOS function also held the PFN lock for the entire duration of the scan, which is significant on systems with large memory. Instead, we make an initial unsafe scan first, and only lock when we think we've found a correct range (and we'll then reconfirm the ranges). - Finally, the older function actually did a double-scan to try to avoid using memory ranges under 16MB, which was useless on today's systems and also rather inefficient. - Other than that, the actual setup of the PFN entry is copy-pasted from the old ReactOS function, so nothing's changed there -- the page still looks the same, but the selection algorithm is faster and more accurate. - Once the pages are found, we piggyback on the new I/O mapping mechanism (which uses System PTEs) instead of doing it all over by hand as before. - Since the underlying support is still System PTEs, once again, optimizations to that component will yield significant improvements here too.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list