Author: gedmurphy
Date: Tue Dec 18 16:49:00 2007
New Revision: 31301
URL:
http://svn.reactos.org/svn/reactos?rev=31301&view=rev
Log:
- Fix NtUserGetIconInfo and use SEH directly.
- Fix the NtUserSetCursorIconData definition and rewrite it (not fully complete)
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
trunk/reactos/subsystems/win32/win32k/w32ksvc.db
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 Tue Dec 18 16:49:00 2007
@@ -623,12 +623,16 @@
STDCALL
NtUserGetIconInfo(
HANDLE hCurIcon,
- PICONINFO IconInfo, DWORD UnkOne, DWORD UnkTwo, DWORD UnkThree, DWORD UnkFour )
+ PICONINFO IconInfo,
+ PUNICODE_STRING lpInstName, // optional
+ PUNICODE_STRING lpResName, // optional
+ LPDWORD pbpp, // optional
+ BOOL bInternal)
{
ICONINFO ii;
PCURICON_OBJECT CurIcon;
PWINSTATION_OBJECT WinSta;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
BOOL Ret = FALSE;
DECLARE_RETURN(BOOL);
@@ -656,12 +660,22 @@
RtlCopyMemory(&ii, &CurIcon->IconInfo, sizeof(ICONINFO));
/* Copy bitmaps */
- ii.hbmMask = BITMAPOBJ_CopyBitmap(ii.hbmMask);
- ii.hbmColor = BITMAPOBJ_CopyBitmap(ii.hbmColor);
+ ii.hbmMask = BITMAPOBJ_CopyBitmap(CurIcon->IconInfo.hbmMask);
+ ii.hbmColor = BITMAPOBJ_CopyBitmap(CurIcon->IconInfo.hbmColor);
/* Copy fields */
- Status = MmCopyToCaller(IconInfo, &ii, sizeof(ICONINFO));
- if(NT_SUCCESS(Status))
+ _SEH_TRY
+ {
+ ProbeForWrite(IconInfo, sizeof(ICONINFO), 1);
+ RtlCopyMemory(IconInfo, &ii, sizeof(ICONINFO));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END
+
+ if (NT_SUCCESS(Status))
Ret = TRUE;
else
SetLastNtError(Status);
@@ -1156,19 +1170,17 @@
* @implemented
*/
BOOL
-STDCALL
+NTAPI
NtUserSetCursorIconData(
- HANDLE hCurIcon,
- PBOOL fIcon,
- POINT *Hotspot,
- HMODULE hModule,
- HRSRC hRsrc,
- HRSRC hGroupRsrc)
+ HANDLE Handle,
+ HMODULE hModule,
+ PUNICODE_STRING pstrResName,
+ PICONINFO pIconInfo)
{
PCURICON_OBJECT CurIcon;
PWINSTATION_OBJECT WinSta;
- NTSTATUS Status;
- POINT SafeHotspot;
+ PBITMAPOBJ pBmpObj;
+ NTSTATUS Status = STATUS_SUCCESS;
BOOL Ret = FALSE;
DECLARE_RETURN(BOOL);
@@ -1181,55 +1193,61 @@
RETURN( FALSE);
}
- if(!(CurIcon = UserGetCurIconObject(hCurIcon)))
+ if(!(CurIcon = UserGetCurIconObject(Handle)))
{
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;
- }
- }
+ CurIcon->hRsrc = NULL; //hRsrc;
+ CurIcon->hGroupRsrc = NULL; //hGroupRsrc;
+
+ _SEH_TRY
+ {
+ ProbeForRead(pIconInfo, sizeof(ICONINFO), 1);
+ RtlCopyMemory(&CurIcon->IconInfo, pIconInfo, sizeof(ICONINFO));
+
+ CurIcon->IconInfo.hbmMask = BITMAPOBJ_CopyBitmap(pIconInfo->hbmMask);
+ CurIcon->IconInfo.hbmColor = BITMAPOBJ_CopyBitmap(pIconInfo->hbmColor);
+
+ if (CurIcon->IconInfo.hbmColor)
+ {
+ if ((pBmpObj = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmColor)))
+ {
+ CurIcon->Size.cx = pBmpObj->SurfObj.sizlBitmap.cx;
+ CurIcon->Size.cy = pBmpObj->SurfObj.sizlBitmap.cy;
+ BITMAPOBJ_UnlockBitmap(pBmpObj);
+ GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL);
+ }
+ }
+ if (CurIcon->IconInfo.hbmMask)
+ {
+ if (CurIcon->IconInfo.hbmColor == NULL)
+ {
+ if ((pBmpObj = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmMask)))
+ {
+ CurIcon->Size.cx = pBmpObj->SurfObj.sizlBitmap.cx;
+ CurIcon->Size.cy = pBmpObj->SurfObj.sizlBitmap.cy;
+ BITMAPOBJ_UnlockBitmap(pBmpObj);
+ }
+ }
+ GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL);
+ }
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END
+
+ if(!NT_SUCCESS(Status))
+ SetLastNtError(Status);
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_);
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 Tue Dec 18 16:49:00 2007
@@ -519,7 +519,7 @@
NtUserSetConsoleReserveKeys 2
NtUserSetCursor 1
NtUserSetCursorContents 2
-# NtUserSetCursorIconData 4 Wrong number of param ?
+NtUserSetCursorIconData 4
NtUserSetCursorIconData 6
NtUserSetDbgTag 2
NtUserSetFocus 1