- Fall back onto some of the previous win32k icon handling code, and fix user32 to...
authorGed Murphy <gedmurphy@reactos.org>
Wed, 9 Jan 2008 16:04:34 +0000 (16:04 +0000)
committerGed Murphy <gedmurphy@reactos.org>
Wed, 9 Jan 2008 16:04:34 +0000 (16:04 +0000)
- This fixes the handle problem we were seeing which was caused by a failing NtUserFindExistingCursorIcon call in user32. It was incompatible with the new code and thus, creating a new icon for all LR_SHARED resources.
- The new code is correct, and will be re-enabled once I've finished the cursoricon object rewrite (which will make it compatible with windows)
- You'll probably need to 'make win32k_clean' before building

svn path=/trunk/; revision=31687

reactos/dll/win32/user32/windows/bitmap.c
reactos/include/reactos/win32k/ntuser.h
reactos/subsystems/win32/win32k/ntuser/cursoricon.c
reactos/subsystems/win32/win32k/ntuser/object.c
reactos/subsystems/win32/win32k/w32ksvc.db

index 139a2c8..f8a8d45 100644 (file)
@@ -268,7 +268,7 @@ LoadCursorIconImage(
 
       if (hIcon && 0 != (fuLoad & LR_SHARED))
       {
-#if 0
+#if 1
          NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, hResInfo,
                                  (HRSRC)NULL);
 #else
@@ -762,7 +762,7 @@ GetIconCurBpp(PICONINFO pIconInfo)
     return pbi->bmiHeader.biBitCount;
 }
 
-
+#if 0
 static BOOL
 SetCursorIconData(
   HANDLE Handle,
@@ -770,6 +770,7 @@ SetCursorIconData(
   LPWSTR lpResName,
   PICONINFO pIconInfo)
 {
+
     UNICODE_STRING Res;
 
     if (!Handle || !pIconInfo)
@@ -778,6 +779,7 @@ SetCursorIconData(
     RtlInitUnicodeString(&Res, lpResName);
 
     return NtUserSetCursorIconData(Handle, hMod, &Res, pIconInfo);
+
 }
 
 
@@ -840,7 +842,7 @@ CopyIcoCur(HANDLE hIconCur,
 
     return hNewIcon;
 }
-
+#endif
 
 /*
  * @unimplemented
@@ -873,7 +875,8 @@ CopyImage(
         return CopyBmp(hnd, type, desiredx, desiredy, flags);
 
       case IMAGE_ICON:
-        return CopyIcoCur(hnd, type, desiredx, desiredy, flags);
+        //return CopyIcoCur(hnd, type, desiredx, desiredy, flags);
+          return CopyIcon(hnd);
 
       case IMAGE_CURSOR:
          {
index 751c720..c072e37 100644 (file)
@@ -2067,9 +2067,11 @@ BOOL
 NTAPI
 NtUserSetCursorIconData(
   HANDLE Handle,
+  PBOOL fIcon,
+  POINT *Hotspot,
   HMODULE hModule,
-  PUNICODE_STRING pstrResName,
-  PICONINFO pIconInfo);
+  HRSRC hRsrc,
+  HRSRC hGroupRsrc);
 
 DWORD
 NTAPI
index 1abba52..3c03623 100644 (file)
@@ -1187,6 +1187,7 @@ CLEANUP:
 /*
  * @implemented
  */
+#if 0
 BOOL
 NTAPI
 NtUserSetCursorIconData(
@@ -1272,7 +1273,89 @@ CLEANUP:
    UserLeave();
    END_CLEANUP;
 }
+#else
+BOOL
+STDCALL
+NtUserSetCursorIconData(
+   HANDLE hCurIcon,
+   PBOOL fIcon,
+   POINT *Hotspot,
+   HMODULE hModule,
+   HRSRC hRsrc,
+   HRSRC hGroupRsrc)
+{
+   PCURICON_OBJECT CurIcon;
+   PWINSTATION_OBJECT WinSta;
+   NTSTATUS Status;
+   POINT SafeHotspot;
+   BOOL Ret = FALSE;
+   DECLARE_RETURN(BOOL);
+
+   DPRINT("Enter NtUserSetCursorIconData\n");
+   UserEnterExclusive();
+
+   WinSta = IntGetWinStaObj();
+   if(WinSta == NULL)
+   {
+      RETURN( FALSE);
+   }
+
+   if(!(CurIcon = UserGetCurIconObject(hCurIcon)))
+   {
+      ObDereferenceObject(WinSta);
+      RETURN(FALSE);
+   }
+
+   CurIcon->hModule = hModule;
+   CurIcon->hRsrc = hRsrc;
+   CurIcon->hGroupRsrc = hGroupRsrc;
+
+   /* Copy fields */
+   if(fIcon)
+   {
+      Status = MmCopyFromCaller(&CurIcon->IconInfo.fIcon, fIcon, sizeof(BOOL));
+      if(!NT_SUCCESS(Status))
+      {
+         SetLastNtError(Status);
+         goto done;
+      }
+   }
+   else
+   {
+      if(!Hotspot)
+         Ret = TRUE;
+   }
+
+   if(Hotspot)
+   {
+      Status = MmCopyFromCaller(&SafeHotspot, Hotspot, sizeof(POINT));
+      if(NT_SUCCESS(Status))
+      {
+         CurIcon->IconInfo.xHotspot = SafeHotspot.x;
+         CurIcon->IconInfo.yHotspot = SafeHotspot.y;
+
+         Ret = TRUE;
+      }
+      else
+         SetLastNtError(Status);
+   }
+
+   if(!fIcon && !Hotspot)
+   {
+      Ret = TRUE;
+   }
+
+done:
+   ObDereferenceObject(WinSta);
+   RETURN( Ret);
+
 
+CLEANUP:
+   DPRINT("Leave NtUserSetCursorIconData, ret=%i\n",_ret_);
+   UserLeave();
+   END_CLEANUP;
+}
+#endif
 
 /*
  * @unimplemented
index cc4b6eb..ea4858b 100644 (file)
@@ -108,6 +108,8 @@ __inline static PUSER_HANDLE_ENTRY alloc_user_entry(PUSER_HANDLE_TABLE ht)
       }
       DPRINT1("Handle Count by Type:\n Free = %d Window = %d Menu = %d CursorIcon = %d Hook = %d\n CallProc = %d Accel = %d Monitor = %d\n",
       iFree, iWindow, iMenu, iCursorIcon, iHook, iCallProc, iAccel, iMonitor );
+
+      ASSERT(FALSE);
 //#endif      
       return NULL;
 #if 0
index aafae7a..e5d44d2 100644 (file)
@@ -519,7 +519,7 @@ NtUserSetClipboardViewer                         1
 NtUserSetConsoleReserveKeys                      2
 NtUserSetCursor                                  1
 NtUserSetCursorContents                          2
-NtUserSetCursorIconData                          4
+NtUserSetCursorIconData                          6 #4
 NtUserSetDbgTag                                  2
 NtUserSetFocus                                   1
 NtUserSetImeHotKey                               5