- Fixed event code. Remove junk too.
authorJames Tabor <james.tabor@reactos.org>
Sun, 26 Jul 2009 12:27:15 +0000 (12:27 +0000)
committerJames Tabor <james.tabor@reactos.org>
Sun, 26 Jul 2009 12:27:15 +0000 (12:27 +0000)
svn path=/trunk/; revision=42230

reactos/include/reactos/win32k/ntuser.h
reactos/subsystems/win32/win32k/include/hook.h
reactos/subsystems/win32/win32k/ntuser/event.c

index 89c9edc..6110d03 100644 (file)
@@ -185,6 +185,21 @@ typedef struct _CLSMENUNAME
   PUNICODE_STRING pusMenuName;
 } CLSMENUNAME, *PCLSMENUNAME;
 
+typedef struct tagSBDATA
+{
+  INT posMin;
+  INT posMax;  
+  INT page;
+  INT pos;
+} SBDATA, *PSBDATA;
+
+typedef struct tagSBINFO
+{
+  INT WSBflags;
+  SBDATA Horz;
+  SBDATA Vert;
+} SBINFO, *PSBINFO;
+
 typedef enum _GETCPD
 {
     UserGetCPDU2A      = 0x01,
@@ -221,7 +236,7 @@ typedef struct _CLS
     struct _CLS *pclsNext;
     RTL_ATOM atomClassName;
     ATOM atomNVClassName;
-    DWORD fnid; // New ClassId
+    DWORD fnid;
     struct _DESKTOP *rpdeskParent;
     PVOID pdce;
     DWORD CSF_flags;
@@ -242,14 +257,17 @@ typedef struct _CLS
     INT cbwndExtra;
     HINSTANCE hModule;
     HANDLE hIcon; /* FIXME - Use pointer! */
+    //PCURSOR spicn;
     HANDLE hCursor; /* FIXME - Use pointer! */
+    //PCURSOR spcur;
     HBRUSH hbrBackground;
     PWSTR lpszMenuName;     // kernel use
     PSTR lpszAnsiClassName; // " 
     HANDLE hIconSm; /* FIXME - Use pointer! */
+    //PCURSOR spicnSm;
 
     UINT Destroying : 1; // CSF_WOWDEFERDESTROY
-    UINT Unicode : 1;
+    UINT Unicode : 1; // !CSF_ANSIPROC
     UINT System : 1;  // CSF_SYSTEMCLASS
     UINT Global : 1;  // CS_GLOBALCLASS
     UINT MenuNameIsString : 1;
@@ -382,11 +400,16 @@ typedef struct _WND
     /* Property list head.*/
     LIST_ENTRY PropListHead;
     ULONG PropListItems;
+    /* Scrollbar info */
+    PSBINFO pSBInfo;
+    /* system menu handle. */
+    HMENU SystemMenu;
+    //PMENU spmenuSys;
     /* Window menu handle or window id */
     UINT IDMenu; // Use spmenu
-    //PMENU spmenuSys;
     //PMENU spmenu;
-    HRGN      hrgnClip;
+    HRGN hrgnClip;
+    HRGN hrgnNewFrame;
     /* Window name. */
     UNICODE_STRING strName;
     /* Size of the extra data associated with the window. */
index 2042b1f..98d28db 100644 (file)
@@ -15,6 +15,7 @@ typedef struct tagHOOKTABLE
 
 typedef struct tagEVENTHOOK
 {
+  THRDESKHEAD    head;
   LIST_ENTRY     Chain;      /* Event chain entry */
   PETHREAD       Thread;     /* Thread owning the event */
   UINT           eventMin;
@@ -25,8 +26,6 @@ typedef struct tagEVENTHOOK
   ULONG          Flags;      /* Some internal flags */
   ULONG_PTR      offPfn;
   INT            ihmod;
-  THRDESKHEAD    head; // FIXME When on top it creates problems
-  UNICODE_STRING ModuleName; /* Module name for global events */
 } EVENTHOOK, *PEVENTHOOK;
 
 typedef struct tagEVENTTABLE
index c84037c..22f8f7e 100644 (file)
@@ -4,9 +4,6 @@
 #define NDEBUG
 #include <debug.h>
 
-#define WINEVENT_INIT      0x40000000
-#define WINEVENT_DESTROYED 0x80000000
-
 typedef struct _EVENTPACK
 {
   PEVENTHOOK pEH; 
@@ -176,6 +173,7 @@ IntNotifyWinEvent(
    LONG  idChild)
 {
    PEVENTHOOK pEH;
+   PLIST_ENTRY pLE;
    LRESULT Result;
 
    DPRINT("IntNotifyWinEvent GlobalEvents = 0x%x pWnd 0x%x\n",GlobalEvents, pWnd);
@@ -186,17 +184,10 @@ IntNotifyWinEvent(
 
    if (!GlobalEvents || !GlobalEvents->Counts) return;
 
-   if (!UserIsEntered()) return;
-
-   pEH = (PEVENTHOOK)GlobalEvents->Events.Flink;
-   DPRINT("IntNotifyWinEvent pEH 0x%x\n",pEH);
+   pLE = GlobalEvents->Events.Flink;
+   pEH = CONTAINING_RECORD(pLE, EVENTHOOK, Chain);
    do
    { 
-     if (pEH->Flags & WINEVENT_INIT)
-     {
-        DPRINT("IntNotifyWinEvent is still in INIT MODE!! pEH 0x%x\n",pEH);
-     }
-
      UserReferenceObject(pEH);
      // Must be inside the event window.
      if ( (pEH->eventMin <= Event) && (pEH->eventMax >= Event))
@@ -206,7 +197,11 @@ IntNotifyWinEvent(
            if (!(pEH->idProcess) || !(pEH->idThread) || 
                (NtCurrentTeb()->ClientId.UniqueProcess == (PVOID)pEH->idProcess))
            {
-              Result = IntCallLowLevelEvent(pEH, Event, UserHMGetHandle(pWnd), idObject, idChild);
+              Result = IntCallLowLevelEvent( pEH,
+                                             Event,
+                                             UserHMGetHandle(pWnd),
+                                             idObject,
+                                             idChild);
            }
         }// if ^skip own thread && ((Pid && CPid == Pid && ^skip own process) || all process)
         else if ( !(pEH->Flags & WINEVENT_SKIPOWNTHREAD) &&
@@ -215,22 +210,20 @@ IntNotifyWinEvent(
                      !(pEH->Flags & WINEVENT_SKIPOWNPROCESS)) ||
                      !pEH->idProcess ) )
         {
-
-           Result = co_IntCallEventProc( pEH->head.h,
-                                               Event,
-                               UserHMGetHandle(pWnd),
-                                            idObject,
-                                             idChild,
+           Result = co_IntCallEventProc( UserHMGetHandle(pEH),
+                                                        Event,
+                                        UserHMGetHandle(pWnd),
+                                                     idObject,
+                                                      idChild,
              PtrToUint(NtCurrentTeb()->ClientId.UniqueThread),
-                            (DWORD)EngGetTickCount(),
-                                           pEH->Proc);
-
+                                     (DWORD)EngGetTickCount(),
+                                                    pEH->Proc);
         }
      }
      UserDereferenceObject(pEH);
-
-     pEH = (PEVENTHOOK)pEH->Chain.Flink;
-   } while (pEH != (PEVENTHOOK)&GlobalEvents->Events.Flink);
+     pLE = pEH->Chain.Flink;
+     pEH = CONTAINING_RECORD(pLE, EVENTHOOK, Chain);
+   } while (pLE != &GlobalEvents->Events);
 }            
 
 VOID
@@ -275,7 +268,6 @@ NtUserSetWinEventHook(
 {
    PEVENTHOOK pEH;
    HWINEVENTHOOK Ret = NULL;
-   UNICODE_STRING ModuleName;
    NTSTATUS Status;
    HANDLE Handle;
    PETHREAD Thread = NULL;
@@ -330,8 +322,7 @@ NtUserSetWinEventHook(
       InsertTailList(&GlobalEvents->Events, &pEH->Chain);
       GlobalEvents->Counts++;
 
-      pEH->Flags     = dwflags|WINEVENT_INIT;
-      pEH->head.h    = Handle;
+      UserHMGetHandle(pEH) = Handle;
 //      pEH->head.pti  =?
 //      pEH->head.rpdesk
       if (Thread)
@@ -342,50 +333,10 @@ NtUserSetWinEventHook(
       pEH->eventMax  = eventMax;
       pEH->idProcess = idProcess;
       pEH->idThread  = idThread;
+      pEH->Flags     = dwflags;
 
       if (NULL != hmodWinEventProc)
       {
-         Status = MmCopyFromCaller(&ModuleName,
-                                      puString,
-                        sizeof(UNICODE_STRING));
-
-         if (! NT_SUCCESS(Status))
-         {
-            UserDereferenceObject(pEH);
-            IntRemoveEvent(pEH);
-            SetLastNtError(Status);
-            goto SetEventExit;
-         }
-
-         pEH->ModuleName.Buffer = ExAllocatePoolWithTag(PagedPool,
-                                   ModuleName.MaximumLength,
-                                   TAG_HOOK);
-
-         if (NULL == pEH->ModuleName.Buffer)
-         {
-            UserDereferenceObject(pEH);
-            IntRemoveEvent(pEH);
-            SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-            goto SetEventExit;
-          }
-
-         pEH->ModuleName.MaximumLength = ModuleName.MaximumLength;
-
-         Status = MmCopyFromCaller(pEH->ModuleName.Buffer,
-                                   ModuleName.Buffer,
-                                   ModuleName.MaximumLength);
-
-         if (! NT_SUCCESS(Status))
-         {
-            ExFreePoolWithTag(pEH->ModuleName.Buffer, TAG_HOOK);
-            UserDereferenceObject(pEH);
-            IntRemoveEvent(pEH);
-            SetLastNtError(Status);
-            goto SetEventExit;
-         }
-
-         pEH->ModuleName.Length = ModuleName.Length;
-
          pEH->offPfn = (ULONG_PTR)((char *)lpfnWinEventProc - (char *)hmodWinEventProc);
          pEH->ihmod = (INT)hmodWinEventProc;
          pEH->Proc = lpfnWinEventProc;
@@ -393,8 +344,6 @@ NtUserSetWinEventHook(
       else
          pEH->Proc = lpfnWinEventProc;
 
-      pEH->Flags &= ~WINEVENT_INIT;
-
       UserDereferenceObject(pEH);
 
       Ret = Handle;