Author: jimtabor
Date: Sat Jul 26 17:06:31 2008
New Revision: 34814
URL:
http://svn.reactos.org/svn/reactos?rev=34814&view=rev
Log:
- Fix crash in callback and disable HCBT_CREATEWND until it is implemented correctly.
Hooks seem to be working.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Sat Jul 26
17:06:31 2008
@@ -339,7 +339,7 @@
{
ULONG ArgumentLength;
PVOID Argument;
- LRESULT Result;
+ LRESULT Result = 0;
NTSTATUS Status;
PVOID ResultPointer;
ULONG ResultLength;
@@ -491,10 +491,21 @@
&ResultPointer,
&ResultLength);
- /* Simulate old behaviour: copy into our local buffer */
- Result = *(LRESULT*)ResultPointer;
-
UserEnterCo();
+
+ _SEH_TRY
+ {
+ ProbeForRead((PVOID)*(LRESULT*)ResultPointer,
+ sizeof(LRESULT),
+ 1);
+ /* Simulate old behaviour: copy into our local buffer */
+ Result = *(LRESULT*)ResultPointer;
+ }
+ _SEH_HANDLE
+ {
+ Result = 0;
+ }
+ _SEH_END;
IntCbFreeMemory(Argument);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Sat Jul 26 17:06:31
2008
@@ -413,6 +413,7 @@
FASTCALL
co_HOOK_CallHookNext(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam)
{
+ DPRINT("CALLING HOOK %d\n",Hook->HookId);
return co_IntCallHookProc(Hook->HookId, Code, wParam, lParam, Hook->Proc,
Hook->Ansi, &Hook->ModuleName);
}
@@ -708,16 +709,18 @@
}
case WH_CBT:
+ DPRINT1("HOOK WH_CBT!\n");
switch (Code)
{
case HCBT_CREATEWND: // Use Ansi.
- lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
+ DPRINT1("HOOK HCBT_CREATEWND\n");
+// lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
break;
case HCBT_MOVESIZE:
{
RECT rt;
-
+ DPRINT1("HOOK HCBT_MOVESIZE\n");
if (lParam)
{
_SEH_TRY
@@ -749,7 +752,7 @@
case HCBT_ACTIVATE:
{
CBTACTIVATESTRUCT CbAs;
-
+ DPRINT1("HOOK HCBT_ACTIVATE\n");
if (lParam)
{
_SEH_TRY
@@ -781,6 +784,7 @@
The rest just use default.
*/
default:
+ DPRINT1("HOOK HCBT_ %d\n",Code);
lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
break;
}
@@ -909,6 +913,10 @@
NextObj = IntGetNextHook(HookObj);
ClientInfo->phkCurrent = NextObj; // Preset next hook from list.
+ if (HookObj->HookId == WH_GETMESSAGE)
+ {
+ DPRINT1(" WH_GETMESSAGE, Hook %x NextHook %x \n", HookObj, NextObj);
+ }
UserCallNextHookEx( HookObj, Code, wParam, lParam, Ansi);
UserDereferenceObject(HookObj);