[ros-diffs] [jimtabor] 41646: - Fix callback set and changed data. Process hooks if we are hooked.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Sun Jun 28 10:32:22 CEST 2009


Author: jimtabor
Date: Sun Jun 28 00:52:33 2009
New Revision: 41646

URL: http://svn.reactos.org/svn/reactos?rev=41646&view=rev
Log:
- Fix callback set and changed data. Process hooks if we are hooked.

Modified:
    trunk/reactos/dll/win32/user32/windows/hook.c
    trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
    trunk/reactos/subsystems/win32/win32k/ntuser/window.c

Modified: trunk/reactos/dll/win32/user32/windows/hook.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/hook.c?rev=41646&r1=41645&r2=41646&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Sun Jun 28 00:52:33 2009
@@ -480,6 +480,8 @@
         case HCBT_SYSCOMMAND:
         case HCBT_DESTROYWND:
         case HCBT_QS:
+            wParam = Common->wParam;
+            lParam = Common->lParam;
             break;
         default:
           ERR("HCBT_ not supported = %d\n", Common->Code);

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/callback.c?rev=41646&r1=41645&r2=41646&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Sun Jun 28 00:52:33 2009
@@ -401,7 +401,7 @@
             case HCBT_CLICKSKIPPED:
                ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
                break;
-/* ATM pass on */
+/*   ATM pass on */
             case HCBT_KEYSKIPPED:
             case HCBT_MINMAX:
             case HCBT_SETFOCUS:
@@ -469,7 +469,7 @@
             case HCBT_CREATEWND:
                Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
                CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
-               CbtCreatewndExtra->Cs = *(CbtCreateWnd->lpcs);
+               RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
                CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
                Extra = (PCHAR) (CbtCreatewndExtra + 1);
                RtlCopyMemory(Extra, WindowName.Buffer, WindowName.Length);
@@ -581,7 +581,22 @@
    {
       if (CbtCreatewndExtra)
       {
-         CbtCreateWnd->hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
+         _SEH2_TRY
+         { /*
+              The parameters could have been changed, include the coordinates
+              and dimensions of the window. We copy it back.
+            */
+            CbtCreateWnd->hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
+            CbtCreateWnd->lpcs->x  = CbtCreatewndExtra->Cs.x;
+            CbtCreateWnd->lpcs->y  = CbtCreatewndExtra->Cs.y;
+            CbtCreateWnd->lpcs->cx = CbtCreatewndExtra->Cs.cx;
+            CbtCreateWnd->lpcs->cy = CbtCreatewndExtra->Cs.cy;
+         }
+         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+         {
+            Result = 0;
+         }
+         _SEH2_END;
       }
    }
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=41646&r1=41645&r2=41646&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Sun Jun 28 00:52:33 2009
@@ -1883,18 +1883,22 @@
    Cs.dwExStyle = dwExStyle;
    CbtCreate.lpcs = &Cs;
    CbtCreate.hwndInsertAfter = HWND_TOP;
-   if (co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) &CbtCreate))
-   {
-      /* FIXME - Delete window object and remove it from the thread windows list */
-      /* FIXME - delete allocated DCE */
-      DPRINT1("CBT-hook returned !0\n");
-      RETURN( (HWND) NULL);
-   }
-
+   if (ISITHOOKED(WH_CBT))
+   {
+      if (co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) &CbtCreate))
+      {
+         /* FIXME - Delete window object and remove it from the thread windows list */
+         /* FIXME - delete allocated DCE */
+         DPRINT1("CBT-hook returned !0\n");
+         RETURN( (HWND) NULL);
+      }
+   }
    x = Cs.x;
    y = Cs.y;
    nWidth = Cs.cx;
    nHeight = Cs.cy;
+// FIXME: Need to set the Z order in the window link list if the hook callback changed it!
+//   hwndInsertAfter = CbtCreate.hwndInsertAfter;
 
    /* default positioning for overlapped windows */
    if(!(Wnd->Style & (WS_POPUP | WS_CHILD)))
@@ -2396,8 +2400,11 @@
 {
    BOOLEAN isChild;
    PWINDOW Wnd;
+   HWND hWnd;
 
    ASSERT_REFS_CO(Window); // FIXME: temp hack?
+
+   hWnd = Window->hSelf;
 
    Wnd = Window->Wnd;
 
@@ -2430,9 +2437,9 @@
 
    IntDereferenceMessageQueue(Window->MessageQueue);
    /* Call hooks */
-   if (co_HOOK_CallHooks(WH_CBT, HCBT_DESTROYWND, (WPARAM) Window->hSelf, 0))
-   {
-      return FALSE;
+   if (ISITHOOKED(WH_CBT))
+   {
+      if (co_HOOK_CallHooks(WH_CBT, HCBT_DESTROYWND, (WPARAM) hWnd, 0)) return FALSE;
    }
 
    IntEngWindowChanged(Window, WOC_DELETE);



More information about the Ros-diffs mailing list