Commit in reactos on MAIN
ntoskrnl/include/internal/ex.h+1-361.37 -> 1.38
subsys/win32k/eng/mouse.c+14-131.69 -> 1.70
subsys/win32k/include/cursoricon.h+371.7 -> 1.8
subsys/win32k/ntuser/input.c+9-51.32 -> 1.33
                    /message.c+8-41.64 -> 1.65
                    /metric.c+9-51.20 -> 1.21
                    /misc.c+14-71.72 -> 1.73
                    /msgqueue.c+2-21.94 -> 1.95
                    /winsta.c+36-161.59 -> 1.60
subsys/win32k/objects/cursoricon.c+43-451.55 -> 1.56
+173-133
10 modified files
changed cursors/icons to use the window station handle table

reactos/ntoskrnl/include/internal
ex.h 1.37 -> 1.38
diff -u -r1.37 -r1.38
--- ex.h	5 May 2004 22:47:06 -0000	1.37
+++ ex.h	14 May 2004 23:57:31 -0000	1.38
@@ -8,41 +8,6 @@
 #define NTOS_MODE_KERNEL
 #include <ntos.h>
 
-typedef struct _CURSORCLIP_INFO
-{
-  BOOL IsClipped;
-  UINT Left;
-  UINT Top;
-  UINT Right;
-  UINT Bottom;
-} CURSORCLIP_INFO, *PCURSORCLIP_INFO;
-
-typedef struct _SYSTEM_CURSORINFO
-{
-  BOOL Enabled;
-  BOOL SwapButtons;
-  UINT ButtonsDown;
-  LONG x, y;
-  BOOL SafetySwitch;
-  UINT SafetyRemoveCount;
-  LONG PointerRectLeft;
-  LONG PointerRectTop;
-  LONG PointerRectRight;
-  LONG PointerRectBottom;
-  FAST_MUTEX CursorMutex;
-  CURSORCLIP_INFO CursorClipInfo;
-  PVOID CurIconHandleTable;
-  PVOID CurrentCursorObject;
-  BYTE ShowingCursor;
-  UINT DblClickSpeed;
-  UINT DblClickWidth;
-  UINT DblClickHeight;
-  DWORD LastBtnDown;
-  LONG LastBtnDownX;
-  LONG LastBtnDownY;
-  HANDLE LastClkWnd;
-} SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO;
-
 typedef struct _WINSTATION_OBJECT
 {
   CSHORT Type;
@@ -53,7 +18,7 @@
   PRTL_ATOM_TABLE AtomTable;
   PVOID HandleTable;
   HANDLE SystemMenuTemplate;
-  SYSTEM_CURSORINFO SystemCursor;
+  PVOID SystemCursor;
   UINT CaretBlinkRate;
   HANDLE ShellWindow;
   HANDLE ShellListView;

reactos/subsys/win32k/eng
mouse.c 1.69 -> 1.70
diff -u -r1.69 -r1.70
--- mouse.c	10 May 2004 17:07:17 -0000	1.69
+++ mouse.c	14 May 2004 23:57:32 -0000	1.70
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: mouse.c,v 1.69 2004/05/10 17:07:17 weiden Exp $
+/* $Id: mouse.c,v 1.70 2004/05/14 23:57:32 weiden Exp $
  *
  * PROJECT:          ReactOS kernel
  * PURPOSE:          Mouse
@@ -39,12 +39,13 @@
   PDC dc;
   SURFOBJ *SurfObj;
   PSURFGDI SurfGDI;
+  PSYSTEM_CURSORINFO CurInfo = IntGetSysCursorInfo(InputWindowStation);
 
   if( hDisplayDC && InputWindowStation)
   {
     if(!IntGetWindowStationObject(InputWindowStation))
     {
-       InputWindowStation->SystemCursor.Enabled = FALSE;
+       CurInfo->Enabled = FALSE;
        return;
     }
     
@@ -55,14 +56,14 @@
     
     /* Move the cursor to the screen center */
     DPRINT("Setting Cursor up at 0x%x, 0x%x\n", SurfObj->sizlBitmap.cx / 2, SurfObj->sizlBitmap.cy / 2);
-    ExAcquireFastMutex(&InputWindowStation->SystemCursor.CursorMutex);
-    InputWindowStation->SystemCursor.x = SurfObj->sizlBitmap.cx / 2;
-    InputWindowStation->SystemCursor.y = SurfObj->sizlBitmap.cy / 2;
-    ExReleaseFastMutex(&InputWindowStation->SystemCursor.CursorMutex);
+    ExAcquireFastMutex(&CurInfo->CursorMutex);
+    CurInfo->x = SurfObj->sizlBitmap.cx / 2;
+    CurInfo->y = SurfObj->sizlBitmap.cy / 2;
+    ExReleaseFastMutex(&CurInfo->CursorMutex);
     IntSetCursor(InputWindowStation, NULL, TRUE);
     
-    InputWindowStation->SystemCursor.Enabled = (SPS_ACCEPT_EXCLUDE == SurfGDI->PointerStatus ||
-                                                SPS_ACCEPT_NOEXCLUDE == SurfGDI->PointerStatus);
+    CurInfo->Enabled = (SPS_ACCEPT_EXCLUDE == SurfGDI->PointerStatus ||
+                        SPS_ACCEPT_NOEXCLUDE == SurfGDI->PointerStatus);
     
     ObDereferenceObject(InputWindowStation);
   }
@@ -71,9 +72,9 @@
     if(IntGetWindowStationObject(InputWindowStation))
     {
        IntSetCursor(InputWindowStation, NULL, TRUE);
-       InputWindowStation->SystemCursor.Enabled = FALSE;
-       InputWindowStation->SystemCursor.CursorClipInfo.IsClipped = FALSE;
-	   ObDereferenceObject(InputWindowStation);
+       CurInfo->Enabled = FALSE;
+       CurInfo->CursorClipInfo.IsClipped = FALSE;
+       ObDereferenceObject(InputWindowStation);
        return;
     }
   }
@@ -97,7 +98,7 @@
    
   if(IntGetWindowStationObject(InputWindowStation))
   {
-    CurInfo = &InputWindowStation->SystemCursor;
+    CurInfo = IntGetSysCursorInfo(InputWindowStation);
     
     MouseEnabled = CurInfo->Enabled && CurInfo->ShowingCursor;
   }
@@ -183,7 +184,7 @@
     
   if(IntGetWindowStationObject(InputWindowStation))
   {
-    CurInfo = &InputWindowStation->SystemCursor;
+    CurInfo = IntGetSysCursorInfo(InputWindowStation);
   }
   else
     return FALSE;

reactos/subsys/win32k/include
cursoricon.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- cursoricon.h	26 Feb 2004 22:23:54 -0000	1.7
+++ cursoricon.h	14 May 2004 23:57:32 -0000	1.8
@@ -16,12 +16,49 @@
   ICONINFO IconInfo;
 } CURICON_OBJECT, *PCURICON_OBJECT;
 
+typedef struct _CURSORCLIP_INFO
+{
+  BOOL IsClipped;
+  UINT Left;
+  UINT Top;
+  UINT Right;
+  UINT Bottom;
+} CURSORCLIP_INFO, *PCURSORCLIP_INFO;
+
+typedef struct _SYSTEM_CURSORINFO
+{
+  BOOL Enabled;
+  BOOL SwapButtons;
+  UINT ButtonsDown;
+  LONG x, y;
+  BOOL SafetySwitch;
+  UINT SafetyRemoveCount;
+  LONG PointerRectLeft;
+  LONG PointerRectTop;
+  LONG PointerRectRight;
+  LONG PointerRectBottom;
+  FAST_MUTEX CursorMutex;
+  CURSORCLIP_INFO CursorClipInfo;
+  PCURICON_OBJECT CurrentCursorObject;
+  BYTE ShowingCursor;
+  UINT DblClickSpeed;
+  UINT DblClickWidth;
+  UINT DblClickHeight;
+  DWORD LastBtnDown;
+  LONG LastBtnDownX;
+  LONG LastBtnDownY;
+  HANDLE LastClkWnd;
+} SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO;
+
 HCURSOR FASTCALL IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange);
 BOOL FASTCALL IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject);
 PCURICON_OBJECT FASTCALL IntGetCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle);
 PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject);
 VOID FASTCALL IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process);
 
+#define IntGetSysCursorInfo(WinStaObj) \
+  (PSYSTEM_CURSORINFO)((WinStaObj)->SystemCursor)
+
 #define IntReleaseCurIconObject(CurIconObj) \
   ObmDereferenceObject(CurIconObj)
 

reactos/subsys/win32k/ntuser
input.c 1.32 -> 1.33
diff -u -r1.32 -r1.33
--- input.c	10 May 2004 17:07:18 -0000	1.32
+++ input.c	14 May 2004 23:57:32 -0000	1.33
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: input.c,v 1.32 2004/05/10 17:07:18 weiden Exp $
+/* $Id: input.c,v 1.33 2004/05/14 23:57:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -515,8 +515,12 @@
 BOOL FASTCALL
 IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap)
 {
-  BOOL res = WinStaObject->SystemCursor.SwapButtons;
-  WinStaObject->SystemCursor.SwapButtons = Swap;
+  PSYSTEM_CURSORINFO CurInfo;
+  BOOL res;
+  
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
+  res = CurInfo->SwapButtons;
+  CurInfo->SwapButtons = Swap;
   return res;
 }
 
@@ -557,7 +561,7 @@
 #endif
   ASSERT(WinSta);
   
-  CurInfo = &WinSta->SystemCursor;
+  CurInfo = IntGetSysCursorInfo(WinSta);
   
   dc = DC_LockDc(hDC);
   SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
@@ -573,7 +577,7 @@
     mi->time = LargeTickCount.u.LowPart;
   }
   
-  SwapButtons = WinSta->SystemCursor.SwapButtons;
+  SwapButtons = CurInfo->SwapButtons;
   DoMove = FALSE;
   ExAcquireFastMutex(&CurInfo->CursorMutex);
   MousePos.x = CurInfo->x;

reactos/subsys/win32k/ntuser
message.c 1.64 -> 1.65
diff -u -r1.64 -r1.65
--- message.c	14 May 2004 16:48:04 -0000	1.64
+++ message.c	14 May 2004 23:57:32 -0000	1.65
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: message.c,v 1.64 2004/05/14 16:48:04 navaraf Exp $
+/* $Id: message.c,v 1.65 2004/05/14 23:57:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -342,12 +342,14 @@
     case WM_XBUTTONDBLCLK:
     {
       WPARAM wParam;
+      PSYSTEM_CURSORINFO CurInfo;
       
       if(!IntGetWindowStationObject(InputWindowStation))
       {
         break;
       }
-      wParam = (WPARAM)InputWindowStation->SystemCursor.ButtonsDown;
+      CurInfo = IntGetSysCursorInfo(InputWindowStation);
+      wParam = (WPARAM)(CurInfo->ButtonsDown);
       ObDereferenceObject(InputWindowStation);
       
       IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam);
@@ -1025,6 +1027,7 @@
     }
   else
     {
+      PSYSTEM_CURSORINFO CurInfo;
       Window = IntGetWindowObject(Wnd);
       if (NULL == Window)
         {
@@ -1043,8 +1046,9 @@
           SetLastWin32Error(ERROR_INVALID_PARAMETER);
           return FALSE;
         }
-      KernelModeMsg.pt.x = PsGetWin32Process()->WindowStation->SystemCursor.x;
-      KernelModeMsg.pt.y = PsGetWin32Process()->WindowStation->SystemCursor.y;
+      CurInfo = IntGetSysCursorInfo(PsGetWin32Process()->WindowStation);
+      KernelModeMsg.pt.x = CurInfo->x;
+      KernelModeMsg.pt.y = CurInfo->y;
       KeQueryTickCount(&LargeTickCount);
       KernelModeMsg.time = LargeTickCount.u.LowPart;
       MsqPostMessage(Window->MessageQueue, &KernelModeMsg,

reactos/subsys/win32k/ntuser
metric.c 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- metric.c	10 May 2004 17:07:18 -0000	1.20
+++ metric.c	14 May 2004 23:57:32 -0000	1.21
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: metric.c,v 1.20 2004/05/10 17:07:18 weiden Exp $
+/* $Id: metric.c,v 1.21 2004/05/14 23:57:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -66,6 +66,8 @@
     case SM_CXDOUBLECLK:
     case SM_CYDOUBLECLK:
     case SM_SWAPBUTTON:
+    {
+      PSYSTEM_CURSORINFO CurInfo;
       Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
                                               KernelMode,
                                               0,
@@ -73,22 +75,24 @@
       if (!NT_SUCCESS(Status))
         return 0xFFFFFFFF;
       
+      CurInfo = IntGetSysCursorInfo(WinStaObject);
       switch(Index)
       {
         case SM_CXDOUBLECLK:
-          Result = WinStaObject->SystemCursor.DblClickWidth;
+          Result = CurInfo->DblClickWidth;
           break;
         case SM_CYDOUBLECLK:
-          Result = WinStaObject->SystemCursor.DblClickWidth;
+          Result = CurInfo->DblClickWidth;
           break;
         case SM_SWAPBUTTON:
-          Result = (UINT)WinStaObject->SystemCursor.SwapButtons;
+          Result = (UINT)CurInfo->SwapButtons;
           break;
       }
       
       ObDereferenceObject(WinStaObject);
       return Result;
-
+    }
+    
     case SM_CXDRAG:
     case SM_CYDRAG:
       return(2);

reactos/subsys/win32k/ntuser
misc.c 1.72 -> 1.73
diff -u -r1.72 -r1.73
--- misc.c	12 May 2004 15:28:01 -0000	1.72
+++ misc.c	14 May 2004 23:57:32 -0000	1.73
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.72 2004/05/12 15:28:01 weiden Exp $
+/* $Id: misc.c,v 1.73 2004/05/14 23:57:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -238,6 +238,7 @@
     
     case ONEPARAM_ROUTINE_GETCURSORPOSITION:
     {
+      PSYSTEM_CURSORINFO CurInfo;
       PWINSTATION_OBJECT WinStaObject;
       NTSTATUS Status;
       POINT Pos;
@@ -251,9 +252,10 @@
       if (!NT_SUCCESS(Status))
         return (DWORD)FALSE;
       
+      CurInfo = IntGetSysCursorInfo(WinStaObject);
       /* FIXME - check if process has WINSTA_READATTRIBUTES */
-      Pos.x = WinStaObject->SystemCursor.x;
-      Pos.y = WinStaObject->SystemCursor.y;
+      Pos.x = CurInfo->x;
+      Pos.y = CurInfo->y;
       
       Status = MmCopyToCaller((PPOINT)Param, &Pos, sizeof(POINT));
       if(!NT_SUCCESS(Status))
@@ -636,6 +638,8 @@
     case SPI_SETDOUBLECLKHEIGHT:
     case SPI_SETDOUBLECLICKTIME:
     {
+      PSYSTEM_CURSORINFO CurInfo;
+      
       Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
                                               KernelMode,
                                               0,
@@ -646,19 +650,20 @@
         return (DWORD)FALSE;
       }
       
+      CurInfo = IntGetSysCursorInfo(WinStaObject);
       switch(uiAction)
       {
         case SPI_SETDOUBLECLKWIDTH:
           /* FIXME limit the maximum value? */
-          WinStaObject->SystemCursor.DblClickWidth = uiParam;
+          CurInfo->DblClickWidth = uiParam;
           break;
         case SPI_SETDOUBLECLKHEIGHT:
           /* FIXME limit the maximum value? */
-          WinStaObject->SystemCursor.DblClickHeight = uiParam;
+          CurInfo->DblClickHeight = uiParam;
           break;
         case SPI_SETDOUBLECLICKTIME:
           /* FIXME limit the maximum time to 1000 ms? */
-          WinStaObject->SystemCursor.DblClickSpeed = uiParam;
+          CurInfo->DblClickSpeed = uiParam;
           break;
       }
       
@@ -914,6 +919,7 @@
   UINT Result;
   NTSTATUS Status;
   PWINSTATION_OBJECT WinStaObject;
+  PSYSTEM_CURSORINFO CurInfo;
   
   Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
                                           KernelMode,
@@ -922,7 +928,8 @@
   if (!NT_SUCCESS(Status))
     return (DWORD)FALSE;
 
-  Result = WinStaObject->SystemCursor.DblClickSpeed;
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
+  Result = CurInfo->DblClickSpeed;
       
   ObDereferenceObject(WinStaObject);
   return Result;

reactos/subsys/win32k/ntuser
msgqueue.c 1.94 -> 1.95
diff -u -r1.94 -r1.95
--- msgqueue.c	10 May 2004 17:07:18 -0000	1.94
+++ msgqueue.c	14 May 2004 23:57:32 -0000	1.95
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: msgqueue.c,v 1.94 2004/05/10 17:07:18 weiden Exp $
+/* $Id: msgqueue.c,v 1.95 2004/05/14 23:57:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -187,7 +187,7 @@
   {
     return FALSE;
   }
-  CurInfo = &WinStaObject->SystemCursor;
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
   Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) && 
         ((Msg->time - CurInfo->LastBtnDown) < CurInfo->DblClickSpeed);
   if(Res)

reactos/subsys/win32k/ntuser
winsta.c 1.59 -> 1.60
diff -u -r1.59 -r1.60
--- winsta.c	10 May 2004 17:07:18 -0000	1.59
+++ winsta.c	14 May 2004 23:57:32 -0000	1.60
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- *  $Id: winsta.c,v 1.59 2004/05/10 17:07:18 weiden Exp $
+ *  $Id: winsta.c,v 1.60 2004/05/14 23:57:32 weiden Exp $
  *
  *  COPYRIGHT:        See COPYING in the top level directory
  *  PROJECT:          ReactOS kernel
@@ -274,6 +274,7 @@
    DWORD Unknown4,
    DWORD Unknown5)
 {
+   PSYSTEM_CURSORINFO CurInfo;
    UNICODE_STRING WindowStationName;
    PWINSTATION_OBJECT WindowStationObject;
    HWINSTA WindowStation;
@@ -367,11 +368,22 @@
     * Initialize the new window station object
     */
 
+   if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
+   {
+     ExFreePool(WindowStationName.Buffer);
+     /* FIXME - Delete window station object */
+     ObDereferenceObject(WindowStationObject);
+     SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
+     return 0;
+   }
+
    WindowStationObject->HandleTable = ObmCreateHandleTable();
    if (!WindowStationObject->HandleTable)
    {
       DPRINT("Failed creating handle table\n");
+      ExFreePool(CurInfo);
       ExFreePool(WindowStationName.Buffer);
+      /* FIXME - Delete window station object */
       ObDereferenceObject(WindowStationObject);
       SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
       return 0;
@@ -379,23 +391,25 @@
   
    InitHotKeys(WindowStationObject);
   
-   ExInitializeFastMutex(&WindowStationObject->SystemCursor.CursorMutex);
-   WindowStationObject->SystemCursor.Enabled = FALSE;
-   WindowStationObject->SystemCursor.ButtonsDown = 0;
-   WindowStationObject->SystemCursor.x = (LONG)0;
-   WindowStationObject->SystemCursor.y = (LONG)0;
-   WindowStationObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;
-   WindowStationObject->SystemCursor.LastBtnDown = 0;
-   WindowStationObject->SystemCursor.CurrentCursorObject = NULL;
-   WindowStationObject->SystemCursor.ShowingCursor = 0;
+   ExInitializeFastMutex(&CurInfo->CursorMutex);
+   CurInfo->Enabled = FALSE;
+   CurInfo->ButtonsDown = 0;
+   CurInfo->x = (LONG)0;
+   CurInfo->y = (LONG)0;
+   CurInfo->CursorClipInfo.IsClipped = FALSE;
+   CurInfo->LastBtnDown = 0;
+   CurInfo->CurrentCursorObject = NULL;
+   CurInfo->ShowingCursor = 0;
   
    /* FIXME: Obtain the following information from the registry */
-   WindowStationObject->SystemCursor.SwapButtons = FALSE;
-   WindowStationObject->SystemCursor.SafetySwitch = FALSE;
-   WindowStationObject->SystemCursor.SafetyRemoveCount = 0;
-   WindowStationObject->SystemCursor.DblClickSpeed = 500;
-   WindowStationObject->SystemCursor.DblClickWidth = 4;
-   WindowStationObject->SystemCursor.DblClickHeight = 4;
+   CurInfo->SwapButtons = FALSE;
+   CurInfo->SafetySwitch = FALSE;
+   CurInfo->SafetyRemoveCount = 0;
+   CurInfo->DblClickSpeed = 500;
+   CurInfo->DblClickWidth = 4;
+   CurInfo->DblClickHeight = 4;
+   
+   WindowStationObject->SystemCursor = CurInfo;
   
    if (!IntSetupCurIconHandles(WindowStationObject))
    {
@@ -529,6 +543,12 @@
       return FALSE;
    }
 
+   #if 0
+   /* FIXME - free the cursor information when actually deleting the object!! */
+   ASSERT(Object->SystemCursor);
+   ExFreePool(Object->SystemCursor);
+   #endif
+
    ObDereferenceObject(Object);
 
    DPRINT("Closing window station handle (0x%X)\n", hWinSta);

reactos/subsys/win32k/objects
cursoricon.c 1.55 -> 1.56
diff -u -r1.55 -r1.56
--- cursoricon.c	10 May 2004 17:07:20 -0000	1.55
+++ cursoricon.c	14 May 2004 23:57:32 -0000	1.56
@@ -16,23 +16,22 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: cursoricon.c,v 1.55 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: cursoricon.c,v 1.56 2004/05/14 23:57:32 weiden Exp $ */
 #include <w32k.h>
 
 PCURICON_OBJECT FASTCALL
 IntGetCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle)
 {
-  PCURICON_OBJECT Object;
-  PUSER_HANDLE_TABLE HandleTable;
-  
-  HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
-  if(!NT_SUCCESS(ObmReferenceObjectByHandle(HandleTable, Handle, otCursorIcon, 
-                 (PVOID*)&Object)))
-  {
-    return FALSE;
-  }
-  
-  return Object;
+   PCURICON_OBJECT Object;
+   NTSTATUS Status;
+
+   Status = ObmReferenceObjectByHandle(WinStaObject->HandleTable,
+      Handle, otCursorIcon, (PVOID*)&Object);
+   if (!NT_SUCCESS(Status))
+   {
+      return NULL;
+   }
+   return Object;
 }
 
 HBITMAP FASTCALL
@@ -74,7 +73,7 @@
    RECTL PointerRect;
    HDC Screen;
   
-   CurInfo = &WinStaObject->SystemCursor;
+   CurInfo = IntGetSysCursorInfo(WinStaObject);
    OldCursor = CurInfo->CurrentCursorObject;
    if (OldCursor)
    {
@@ -241,11 +240,7 @@
 BOOL FASTCALL
 IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject)
 {
-  if((WinStaObject->SystemCursor.CurIconHandleTable = (PVOID)ObmCreateHandleTable()))
-  {
-    ObmInitializeHandleTable((PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable);
-  }
-  return (WinStaObject->SystemCursor.CurIconHandleTable != NULL);
+  return TRUE;
 }
 
 PCURICON_OBJECT FASTCALL
@@ -258,7 +253,7 @@
   PCURICON_OBJECT Object;
   ULONG i;
   
-  HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
+  HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->HandleTable;
   ObmpLockHandleTable(HandleTable);
   
   CurrentEntry = HandleTable->ListHead.Flink;
@@ -268,15 +263,19 @@
     for(i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
     {
       Object = (PCURICON_OBJECT)Current->Handles[i].ObjectBody;
-      if(Object && (Object->hModule == hModule) && (Object->hRsrc == hRsrc))
+      if(Object && (ObmReferenceObjectByPointer(Object, otCursorIcon) == STATUS_SUCCESS))
       {
-        if(cx && ((cx != Object->Size.cx) || (cy != Object->Size.cy)))
+        if((Object->hModule == hModule) && (Object->hRsrc == hRsrc))
         {
-          continue;
+          if(cx && ((cx != Object->Size.cx) || (cy != Object->Size.cy)))
+          {
+	    ObmDereferenceObject(Object);
+	    continue;
+          }
+          ObmpUnlockHandleTable(HandleTable);
+          return Object;
         }
-        ObmReferenceObject(Object);
-        ObmpUnlockHandleTable(HandleTable);
-        return Object;
+        ObmDereferenceObject(Object);
       }
     }
     CurrentEntry = CurrentEntry->Flink;
@@ -289,14 +288,11 @@
 PCURICON_OBJECT FASTCALL
 IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
 {
-  PUSER_HANDLE_TABLE HandleTable;
   PCURICON_OBJECT Object;
   HANDLE Handle;
   PW32PROCESS Win32Process;
   
-  HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
-  
-  Object = ObmCreateObject(HandleTable, &Handle, otCursorIcon, sizeof(CURICON_OBJECT));
+  Object = ObmCreateObject(WinStaObject->HandleTable, &Handle, otCursorIcon, sizeof(CURICON_OBJECT));
   
   if(!Object)
   {
@@ -319,15 +315,13 @@
 BOOL FASTCALL
 IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle, BOOL RemoveFromProcess)
 {
-  PUSER_HANDLE_TABLE HandleTable;
+  PSYSTEM_CURSORINFO CurInfo;
   PCURICON_OBJECT Object;
   HBITMAP bmpMask, bmpColor;
   NTSTATUS Status;
   BOOL Ret;
   
-  HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
-  
-  Status = ObmReferenceObjectByHandle(HandleTable, Handle, otCursorIcon, (PVOID*)&Object);
+  Status = ObmReferenceObjectByHandle(WinStaObject->HandleTable, Handle, otCursorIcon, (PVOID*)&Object);
   if(!NT_SUCCESS(Status))
   {
     return FALSE;
@@ -335,10 +329,13 @@
   
   if (Object->Process != PsGetWin32Process())
   {
+    ObmDereferenceObject(Object);
     return FALSE;
   }
 
-  if (WinStaObject->SystemCursor.CurrentCursorObject == Object)
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
+
+  if (CurInfo->CurrentCursorObject == Object)
   {
     /* Hide the cursor if we're destroying the current cursor */
     IntSetCursor(WinStaObject, NULL, TRUE);
@@ -354,7 +351,7 @@
     IntUnLockProcessCursorIcons(Object->Process);
   }
   
-  Ret = NT_SUCCESS(ObmCloseHandle(HandleTable, Handle));
+  Ret = NT_SUCCESS(ObmCloseHandle(WinStaObject->HandleTable, Handle));
   
   /* delete bitmaps */
   if(bmpMask)
@@ -362,7 +359,7 @@
   if(bmpColor)
     NtGdiDeleteObject(bmpColor);
 
-/*  ObmDereferenceObject(Object);*/
+  ObmDereferenceObject(Object);
   
   return Ret;
 }
@@ -643,7 +640,7 @@
     return FALSE;
   }
   
-  CurInfo = &WinStaObject->SystemCursor;
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
   CursorObject = (PCURICON_OBJECT)CurInfo->CurrentCursorObject;
   
   SafeCi.flags = ((CurInfo->ShowingCursor && CursorObject) ? CURSOR_SHOWING : 0);
@@ -698,7 +695,7 @@
     return FALSE;
   }
   
-  CurInfo = &WinStaObject->SystemCursor;
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
   if(WinStaObject->ActiveDesktop)
     DesktopWindow = IntGetWindowObject(WinStaObject->ActiveDesktop->DesktopWindow);
   
@@ -725,7 +722,7 @@
     return TRUE;
   }
   
-  WinStaObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;
+  CurInfo->CursorClipInfo.IsClipped = FALSE;
   ObDereferenceObject(WinStaObject);
   
   return TRUE;
@@ -819,7 +816,7 @@
   RECT *lpRect)
 {
   /* FIXME - check if process has WINSTA_READATTRIBUTES */
-  
+  PSYSTEM_CURSORINFO CurInfo;
   PWINSTATION_OBJECT WinStaObject;
   RECT Rect;
   NTSTATUS Status;
@@ -839,12 +836,13 @@
     return FALSE;
   }
   
-  if(WinStaObject->SystemCursor.CursorClipInfo.IsClipped)
+  CurInfo = IntGetSysCursorInfo(WinStaObject);
+  if(CurInfo->CursorClipInfo.IsClipped)
   {
-    Rect.left = WinStaObject->SystemCursor.CursorClipInfo.Left;
-    Rect.top = WinStaObject->SystemCursor.CursorClipInfo.Top;
-    Rect.right = WinStaObject->SystemCursor.CursorClipInfo.Right;
-    Rect.bottom = WinStaObject->SystemCursor.CursorClipInfo.Bottom;
+    Rect.left = CurInfo->CursorClipInfo.Left;
+    Rect.top = CurInfo->CursorClipInfo.Top;
+    Rect.right = CurInfo->CursorClipInfo.Right;
+    Rect.bottom = CurInfo->CursorClipInfo.Bottom;
   }
   else
   {
CVSspam 0.2.8