Author: gedmurphy
Date: Wed Jan 9 19:04:34 2008
New Revision: 31687
URL:
http://svn.reactos.org/svn/reactos?rev=31687&view=rev
Log:
- Fall back onto some of the previous win32k icon handling code, and fix user32 to suit.
- 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
Modified:
trunk/reactos/dll/win32/user32/windows/bitmap.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
trunk/reactos/subsystems/win32/win32k/ntuser/object.c
trunk/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: trunk/reactos/dll/win32/user32/windows/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/b…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/bitmap.c (original)
+++ trunk/reactos/dll/win32/user32/windows/bitmap.c Wed Jan 9 19:04:34 2008
@@ -268,7 +268,7 @@
if (hIcon && 0 != (fuLoad & LR_SHARED))
{
-#if 0
+#if 1
NtUserSetCursorIconData((HICON)hIcon, NULL, NULL, hinst, hResInfo,
(HRSRC)NULL);
#else
@@ -762,7 +762,7 @@
return pbi->bmiHeader.biBitCount;
}
-
+#if 0
static BOOL
SetCursorIconData(
HANDLE Handle,
@@ -770,6 +770,7 @@
LPWSTR lpResName,
PICONINFO pIconInfo)
{
+
UNICODE_STRING Res;
if (!Handle || !pIconInfo)
@@ -778,6 +779,7 @@
RtlInitUnicodeString(&Res, lpResName);
return NtUserSetCursorIconData(Handle, hMod, &Res, pIconInfo);
+
}
@@ -840,7 +842,7 @@
return hNewIcon;
}
-
+#endif
/*
* @unimplemented
@@ -873,7 +875,8 @@
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:
{
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h Wed Jan 9 19:04:34 2008
@@ -2067,9 +2067,11 @@
NTAPI
NtUserSetCursorIconData(
HANDLE Handle,
+ PBOOL fIcon,
+ POINT *Hotspot,
HMODULE hModule,
- PUNICODE_STRING pstrResName,
- PICONINFO pIconInfo);
+ HRSRC hRsrc,
+ HRSRC hGroupRsrc);
DWORD
NTAPI
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Wed Jan 9 19:04:34 2008
@@ -1187,6 +1187,7 @@
/*
* @implemented
*/
+#if 0
BOOL
NTAPI
NtUserSetCursorIconData(
@@ -1272,7 +1273,89 @@
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
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/object.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/object.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/object.c Wed Jan 9 19:04:34 2008
@@ -108,6 +108,8 @@
}
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
Modified: trunk/reactos/subsystems/win32/win32k/w32ksvc.db
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/w3…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/w32ksvc.db (original)
+++ trunk/reactos/subsystems/win32/win32k/w32ksvc.db Wed Jan 9 19:04:34 2008
@@ -519,7 +519,7 @@
NtUserSetConsoleReserveKeys 2
NtUserSetCursor 1
NtUserSetCursorContents 2
-NtUserSetCursorIconData 4
+NtUserSetCursorIconData 6 #4
NtUserSetDbgTag 2
NtUserSetFocus 1
NtUserSetImeHotKey 5