-cursoricon: naming changes, cleanup
-fix: hide/show caret to accept NULL hWnds
-some handle to pointer converions
-double handle table size
-fix: co_WinPosActivateOtherWindow was trying to access desktop parent
Modified: trunk/reactos/subsys/win32k/include/object.h
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
Modified: trunk/reactos/subsys/win32k/ntuser/caret.c
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/subsys/win32k/ntuser/focus.c
Modified: trunk/reactos/subsys/win32k/ntuser/object.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
_____
Modified: trunk/reactos/subsys/win32k/include/object.h
--- trunk/reactos/subsys/win32k/include/object.h 2005-09-08
23:10:17 UTC (rev 17755)
+++ trunk/reactos/subsys/win32k/include/object.h 2005-09-09
00:25:52 UTC (rev 17756)
@@ -42,7 +42,7 @@
otWindow,
otMenu,
otAccel,
- otCursor,
+ otCursorIcon,
otHook,
otMonitor,
otClass //fixme: remove
_____
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
--- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-08
23:10:17 UTC (rev 17755)
+++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-09
00:25:52 UTC (rev 17756)
@@ -21,6 +21,8 @@
#define IntReferenceWindowObject(o) ObmReferenceObject(o)
+#define UserDerefObject(o) ObmReferenceObject(o)
+
VOID FASTCALL IntReleaseWindowObject(PWINDOW_OBJECT Window);
PWINDOW_OBJECT FASTCALL IntGetWindowObject(HWND hWnd);
PVOID FASTCALL
@@ -136,7 +138,7 @@
LONG FASTCALL UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi);
-HWND FASTCALL UserGetAncestor(HWND hWnd, UINT Type);
+PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type);
/*************** MENU.C ***************/
_____
Modified: trunk/reactos/subsys/win32k/ntuser/caret.c
--- trunk/reactos/subsys/win32k/ntuser/caret.c 2005-09-08 23:10:17 UTC
(rev 17755)
+++ trunk/reactos/subsys/win32k/ntuser/caret.c 2005-09-09 00:25:52 UTC
(rev 17756)
@@ -317,11 +317,13 @@
}
-BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window)
+BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window OPTIONAL)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
- if(Window->OwnerThread != PsGetCurrentThread())
+ if (Window) ASSERT_REFS_CO(Window);
+
+ if(Window && Window->OwnerThread != PsGetCurrentThread())
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@@ -329,7 +331,7 @@
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
- if(ThreadQueue->CaretInfo->hWnd != Window->hSelf)
+ if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@@ -337,7 +339,7 @@
if(ThreadQueue->CaretInfo->Visible)
{
- IntKillTimer(Window->hSelf, IDCARETTIMER, TRUE);
+ IntKillTimer((Window ? Window->hSelf : 0), IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo);
ThreadQueue->CaretInfo->Visible = 0;
@@ -350,24 +352,23 @@
BOOL
STDCALL
-NtUserHideCaret(
- HWND hWnd)
+NtUserHideCaret(HWND hWnd OPTIONAL)
{
- PWINDOW_OBJECT Window;
+ PWINDOW_OBJECT Window = NULL;
DECLARE_RETURN(BOOL);
BOOL ret;
DPRINT("Enter NtUserHideCaret\n");
UserEnterExclusive();
- if(!(Window = UserGetWindowObject(hWnd)))
+ if(hWnd && !(Window = UserGetWindowObject(hWnd)))
{
RETURN(FALSE);
}
- UserRefObjectCo(Window);
+ if (Window) UserRefObjectCo(Window);
ret = co_UserHideCaret(Window);
- UserDerefObjectCo(Window);
+ if (Window) UserDerefObjectCo(Window);
RETURN(ret);
@@ -378,11 +379,13 @@
}
-BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window)
+BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
- if(Window->OwnerThread != PsGetCurrentThread())
+ if (Window) ASSERT_REFS_CO(Window);
+
+ if(Window && Window->OwnerThread != PsGetCurrentThread())
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@@ -390,7 +393,7 @@
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
- if(ThreadQueue->CaretInfo->hWnd != Window->hSelf)
+ if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@@ -403,7 +406,7 @@
{
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER,
IDCARETTIMER, 0);
}
- IntSetTimer(Window->hSelf, IDCARETTIMER, IntGetCaretBlinkTime(),
NULL, TRUE);
+ IntSetTimer((Window ? Window->hSelf : 0), IDCARETTIMER,
IntGetCaretBlinkTime(), NULL, TRUE);
}
return TRUE;
@@ -412,24 +415,23 @@
BOOL
STDCALL
-NtUserShowCaret(
- HWND hWnd)
+NtUserShowCaret(HWND hWnd OPTIONAL)
{
- PWINDOW_OBJECT Window;
+ PWINDOW_OBJECT Window = NULL;
DECLARE_RETURN(BOOL);
BOOL ret;
DPRINT("Enter NtUserShowCaret\n");
UserEnterExclusive();
- if(!(Window = UserGetWindowObject(hWnd)))
+ if(hWnd && !(Window = UserGetWindowObject(hWnd)))
{
RETURN(FALSE);
}
- UserRefObjectCo(Window);
+ if (Window) UserRefObjectCo(Window);
ret = co_UserShowCaret(Window);
- UserDerefObjectCo(Window);
+ if (Window) UserDerefObjectCo(Window);
RETURN(ret);
_____
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
--- trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-08
23:10:17 UTC (rev 17755)
+++ trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-09
00:25:52 UTC (rev 17756)
@@ -41,14 +41,14 @@
#define NDEBUG
#include <debug.h>
-static PAGED_LOOKASIDE_LIST ProcessLookasideList;
-static LIST_ENTRY CurIconList;
+static PAGED_LOOKASIDE_LIST gProcessLookasideList;
+static LIST_ENTRY gCurIconList;
/* Look up the location of the cursor in the GDIDEVICE structure
* when all we know is the window station object
* Actually doesn't use the window station, but should... */
BOOL FASTCALL
-IntGetCursorLocation(PWINSTATION_OBJECT WinStaObject, POINT *loc)
+IntGetCursorLocation(PWINSTATION_OBJECT WinSta, POINT *loc)
{
HDC hDC;
PDC dc;
@@ -72,25 +72,27 @@
}
-#if 0
static
-PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCursor)
+PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
{
- PCURICON_OBJECT Cursor;
+ PCURICON_OBJECT CurIcon;
- if (!hCursor) return NULL;
+ if (!hCurIcon) return NULL;
- Cursor = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCursor,
otCursor);
- if (!Cursor)
+ CurIcon = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCurIcon,
otCursorIcon);
+ if (!CurIcon)
{
+ /* we never set ERROR_INVALID_ICON_HANDLE. lets hope noone ever
checks for it */
SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
return NULL;
}
- ASSERT(USER_BODY_TO_HEADER(Cursor)->RefCount >= 0);
- return Cursor;
+ ASSERT(USER_BODY_TO_HEADER(CurIcon)->RefCount >= 0);
+ return CurIcon;
}
-#endif
+
+#if 0
+
static
PCURICON_OBJECT FASTCALL IntGetCurIconObject(HCURSOR hCursor)
{
@@ -98,7 +100,7 @@
if (!hCursor) return NULL;
- Cursor = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCursor,
otCursor);
+ Cursor = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCursor,
otCursorIcon);
if (!Cursor)
{
SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
@@ -111,12 +113,12 @@
return Cursor;
}
+#endif
-
#define COLORCURSORS_ALLOWED FALSE
HCURSOR FASTCALL
-IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT
NewCursor,
+IntSetCursor(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT NewCursor,
BOOL ForceChange)
{
BITMAPOBJ *BitmapObj;
@@ -132,7 +134,7 @@
XLATEOBJ *XlateObj = NULL;
HDC Screen;
- CurInfo = IntGetSysCursorInfo(WinStaObject);
+ CurInfo = IntGetSysCursorInfo(WinSta);
OldCursor = CurInfo->CurrentCursorObject;
if (OldCursor)
{
@@ -322,16 +324,16 @@
}
BOOL FASTCALL
-IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject)
+IntSetupCurIconHandles(PWINSTATION_OBJECT WinSta)
{
- ExInitializePagedLookasideList(&ProcessLookasideList,
+ ExInitializePagedLookasideList(&gProcessLookasideList,
NULL,
NULL,
0,
sizeof(CURICON_PROCESS),
0,
128);
- InitializeListHead(&CurIconList);
+ InitializeListHead(&gCurIconList);
return TRUE;
}
@@ -346,7 +348,7 @@
* life...
*/
static BOOLEAN FASTCALL
-ReferenceCurIconByProcess(PCURICON_OBJECT Object)
+ReferenceCurIconByProcess(PCURICON_OBJECT CurIcon)
{
PW32PROCESS Win32Process;
PLIST_ENTRY Search;
@@ -354,8 +356,8 @@
Win32Process = PsGetWin32Process();
- Search = Object->ProcessList.Flink;
- while (Search != &Object->ProcessList)
+ Search = CurIcon->ProcessList.Flink;
+ while (Search != &CurIcon->ProcessList)
{
Current = CONTAINING_RECORD(Search, CURICON_PROCESS, ListEntry);
if (Current->Process == Win32Process)
@@ -367,49 +369,49 @@
}
/* Not registered yet */
- Current = ExAllocateFromPagedLookasideList(&ProcessLookasideList);
+ Current = ExAllocateFromPagedLookasideList(&gProcessLookasideList);
if (NULL == Current)
{
return FALSE;
}
- InsertHeadList(&Object->ProcessList, &Current->ListEntry);
+ InsertHeadList(&CurIcon->ProcessList, &Current->ListEntry);
Current->Process = Win32Process;
return TRUE;
}
PCURICON_OBJECT FASTCALL
-IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE
hModule,
+IntFindExistingCurIconObject(PWINSTATION_OBJECT WinSta, HMODULE
hModule,
HRSRC hRsrc, LONG cx, LONG cy)
{
PLIST_ENTRY CurrentEntry;
- PCURICON_OBJECT Object;
+ PCURICON_OBJECT CurIcon;
- CurrentEntry = CurIconList.Flink;
- while (CurrentEntry != &CurIconList)
+ CurrentEntry = gCurIconList.Flink;
+ while (CurrentEntry != &gCurIconList)
{
- Object = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT,
ListEntry);
+ CurIcon = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT,
ListEntry);
CurrentEntry = CurrentEntry->Flink;
// if(NT_SUCCESS(ObmReferenceObjectByPointer(Object,
otCursorIcon))) //<- huh????
- ObmReferenceObject( Object);
+// ObmReferenceObject( CurIcon);
+// {
+ if((CurIcon->hModule == hModule) && (CurIcon->hRsrc == hRsrc))
{
- if((Object->hModule == hModule) && (Object->hRsrc == hRsrc))
+ if(cx && ((cx != CurIcon->Size.cx) || (cy !=
CurIcon->Size.cy)))
{
- if(cx && ((cx != Object->Size.cx) || (cy !=
Object->Size.cy)))
- {
- ObmDereferenceObject(Object);
- continue;
- }
- if (! ReferenceCurIconByProcess(Object))
- {
- return NULL;
- }
-
- return Object;
+// ObmDereferenceObject(CurIcon);
+ continue;
}
+ if (! ReferenceCurIconByProcess(CurIcon))
+ {
+ return NULL;
+ }
+
+ return CurIcon;
}
- ObmDereferenceObject(Object);
+// }
+// ObmDereferenceObject(CurIcon);
}
@@ -417,39 +419,39 @@
}
PCURICON_OBJECT FASTCALL
-IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
+IntCreateCurIconHandle(PWINSTATION_OBJECT WinSta)
{
- PCURICON_OBJECT Object;
- HANDLE Handle;
+ PCURICON_OBJECT CurIcon;
+ HANDLE hCurIcon;
- Object = ObmCreateObject(&gHandleTable, &Handle, otCursor,
sizeof(CURICON_OBJECT));
+ CurIcon = ObmCreateObject(&gHandleTable, &hCurIcon, otCursorIcon,
sizeof(CURICON_OBJECT));
- if(!Object)
+ if(!CurIcon)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
- Object->Self = Handle;
- InitializeListHead(&Object->ProcessList);
+ CurIcon->Self = hCurIcon;
+ InitializeListHead(&CurIcon->ProcessList);
- if (! ReferenceCurIconByProcess(Object))
+ if (! ReferenceCurIconByProcess(CurIcon))
{
DPRINT1("Failed to add process\n");
- ObmDeleteObject(Handle, otCursor);
- ObmDereferenceObject(Object);
+ ObmDeleteObject(hCurIcon, otCursorIcon);
+ ObmDereferenceObject(CurIcon);
return NULL;
}
- InsertHeadList(&CurIconList, &Object->ListEntry);
+ InsertHeadList(&gCurIconList, &CurIcon->ListEntry);
- ObmDereferenceObject(Object);
+ ObmDereferenceObject(CurIcon);
- return Object;
+ return CurIcon;
}
BOOLEAN FASTCALL
-IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject,
PCURICON_OBJECT Object, BOOL ProcessCleanup)
+IntDestroyCurIconObject(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT
CurIcon, BOOL ProcessCleanup)
{
PSYSTEM_CURSORINFO CurInfo;
HBITMAP bmpMask, bmpColor;
@@ -459,10 +461,10 @@
PW32PROCESS W32Process = PsGetWin32Process();
/* Private objects can only be destroyed by their own process */
- if (NULL == Object->hModule)
+ if (NULL == CurIcon->hModule)
{
- ASSERT(Object->ProcessList.Flink->Flink == &Object->ProcessList);
- Current = CONTAINING_RECORD(Object->ProcessList.Flink,
CURICON_PROCESS, ListEntry);
+ ASSERT(CurIcon->ProcessList.Flink->Flink ==
&CurIcon->ProcessList);
+ Current = CONTAINING_RECORD(CurIcon->ProcessList.Flink,
CURICON_PROCESS, ListEntry);
if (Current->Process != W32Process)
{
DPRINT1("Trying to destroy private icon/cursor of another
process\n");
@@ -477,8 +479,8 @@
/* Now find this process in the list of processes referencing this
object and
remove it from that list */
- Search = Object->ProcessList.Flink;
- while (Search != &Object->ProcessList)
+ Search = CurIcon->ProcessList.Flink;
+ while (Search != &CurIcon->ProcessList)
{
Current = CONTAINING_RECORD(Search, CURICON_PROCESS, ListEntry);
if (Current->Process == W32Process)
@@ -487,12 +489,12 @@
}
Search = Search->Flink;
}
- ASSERT(Search != &Object->ProcessList);
+ ASSERT(Search != &CurIcon->ProcessList);
RemoveEntryList(Search);
- ExFreeToPagedLookasideList(&ProcessLookasideList, Current);
+ ExFreeToPagedLookasideList(&gProcessLookasideList, Current);
/* If there are still processes referencing this object we can't
destroy it yet */
- if (! IsListEmpty(&Object->ProcessList))
+ if (! IsListEmpty(&CurIcon->ProcessList))
{
return TRUE;
}
@@ -500,21 +502,21 @@
if (! ProcessCleanup)
{
- RemoveEntryList(&Object->ListEntry);
+ RemoveEntryList(&CurIcon->ListEntry);
}
- CurInfo = IntGetSysCursorInfo(WinStaObject);
+ CurInfo = IntGetSysCursorInfo(WinSta);
- if (CurInfo->CurrentCursorObject == Object)
+ if (CurInfo->CurrentCursorObject == CurIcon)
{
/* Hide the cursor if we're destroying the current cursor */
- IntSetCursor(WinStaObject, NULL, TRUE);
+ IntSetCursor(WinSta, NULL, TRUE);
}
- bmpMask = Object->IconInfo.hbmMask;
- bmpColor = Object->IconInfo.hbmColor;
+ bmpMask = CurIcon->IconInfo.hbmMask;
+ bmpColor = CurIcon->IconInfo.hbmColor;
- Ret = ObmDeleteObject(Object->Self, otCursor);
+ Ret = ObmDeleteObject(CurIcon->Self, otCursorIcon);
/* delete bitmaps */
if(bmpMask)
@@ -534,48 +536,48 @@
VOID FASTCALL
IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
{
- PWINSTATION_OBJECT WinStaObject;
+ PWINSTATION_OBJECT WinSta;
PLIST_ENTRY CurrentEntry;
- PCURICON_OBJECT Object;
+ PCURICON_OBJECT CurIcon;
PLIST_ENTRY ProcessEntry;
PCURICON_PROCESS ProcessData;
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
{
return;
}
- CurrentEntry = CurIconList.Flink;
- while (CurrentEntry != &CurIconList)
+ CurrentEntry = gCurIconList.Flink;
+ while (CurrentEntry != &gCurIconList)
{
- Object = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT,
ListEntry);
+ CurIcon = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT,
ListEntry);
CurrentEntry = CurrentEntry->Flink;
- ObmReferenceObject(Object);
+// ObmReferenceObject(CurIcon);
// if(NT_SUCCESS(ObmReferenceObjectByPointer(Object,
otCursorIcon)))
{
- ProcessEntry = Object->ProcessList.Flink;
- while (ProcessEntry != &Object->ProcessList)
+ ProcessEntry = CurIcon->ProcessList.Flink;
+ while (ProcessEntry != &CurIcon->ProcessList)
{
ProcessData = CONTAINING_RECORD(ProcessEntry,
CURICON_PROCESS, ListEntry);
if (Win32Process == ProcessData->Process)
{
- RemoveEntryList(&Object->ListEntry);
- IntDestroyCurIconObject(WinStaObject, Object, TRUE);
+ RemoveEntryList(&CurIcon->ListEntry);
+ IntDestroyCurIconObject(WinSta, CurIcon, TRUE);
break;
}
ProcessEntry = ProcessEntry->Flink;
}
- ObmDereferenceObject(Object);
+// ObmDereferenceObject(Object);
}
}
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
}
/*
@@ -583,10 +585,10 @@
*/
HANDLE
STDCALL
-NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect)
+NtUserCreateCursorIconHandle(PICONINFO IconInfo OPTIONAL, BOOL
Indirect)
{
- PCURICON_OBJECT CurIconObject;
- PWINSTATION_OBJECT WinStaObject;
+ PCURICON_OBJECT CurIcon;
+ PWINSTATION_OBJECT WinSta;
PBITMAPOBJ bmp;
NTSTATUS Status;
HANDLE Ret;
@@ -595,61 +597,60 @@
DPRINT("Enter NtUserCreateCursorIconHandle\n");
UserEnterExclusive();
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
{
RETURN( (HANDLE)0);
}
- CurIconObject = IntCreateCurIconHandle(WinStaObject);
- if(CurIconObject)
+ if (!(CurIcon = IntCreateCurIconHandle(WinSta)))
{
- Ret = CurIconObject->Self;
+ SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+ ObDereferenceObject(WinSta);
+ RETURN( (HANDLE)0);
+ }
+
+ Ret = CurIcon->Self;
- if(IconInfo)
+ if(IconInfo)
+ {
+ Status = MmCopyFromCaller(&CurIcon->IconInfo, IconInfo,
sizeof(ICONINFO));
+ if(NT_SUCCESS(Status))
{
- Status = MmCopyFromCaller(&CurIconObject->IconInfo, IconInfo,
sizeof(ICONINFO));
- if(NT_SUCCESS(Status))
+ if(Indirect)
{
- if(Indirect)
- {
- CurIconObject->IconInfo.hbmMask =
BITMAPOBJ_CopyBitmap(CurIconObject->IconInfo.hbmMask);
- CurIconObject->IconInfo.hbmColor =
BITMAPOBJ_CopyBitmap(CurIconObject->IconInfo.hbmColor);
- }
- if(CurIconObject->IconInfo.hbmColor &&
- (bmp =
BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor)))
- {
- CurIconObject->Size.cx = bmp->SurfObj.sizlBitmap.cx;
- CurIconObject->Size.cy = bmp->SurfObj.sizlBitmap.cy;
- BITMAPOBJ_UnlockBitmap(bmp);
- GDIOBJ_SetOwnership(CurIconObject->IconInfo.hbmColor,
NULL);
- }
- if(CurIconObject->IconInfo.hbmMask &&
- (bmp =
BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmMask)))
- {
- if (CurIconObject->IconInfo.hbmColor == NULL)
- {
- CurIconObject->Size.cx = bmp->SurfObj.sizlBitmap.cx;
- CurIconObject->Size.cy = bmp->SurfObj.sizlBitmap.cy /
2;
- }
- BITMAPOBJ_UnlockBitmap(bmp);
- GDIOBJ_SetOwnership(CurIconObject->IconInfo.hbmMask,
NULL);
- }
+ CurIcon->IconInfo.hbmMask =
BITMAPOBJ_CopyBitmap(CurIcon->IconInfo.hbmMask);
+ CurIcon->IconInfo.hbmColor =
BITMAPOBJ_CopyBitmap(CurIcon->IconInfo.hbmColor);
}
- else
+ if(CurIcon->IconInfo.hbmColor &&
+ (bmp =
BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmColor)))
{
- SetLastNtError(Status);
- /* FIXME - Don't exit here */
+ CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx;
+ CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy;
+ BITMAPOBJ_UnlockBitmap(bmp);
+ GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL);
}
+ if(CurIcon->IconInfo.hbmMask &&
+ (bmp = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmMask)))
+ {
+ if (CurIcon->IconInfo.hbmColor == NULL)
+ {
+ CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx;
+ CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2;
+ }
+ BITMAPOBJ_UnlockBitmap(bmp);
+ GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL);
+ }
}
-
- ObDereferenceObject(WinStaObject);
- RETURN( Ret);
+ else
+ {
+ SetLastNtError(Status);
+ /* FIXME - Don't exit here */
+ }
}
- SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
- ObDereferenceObject(WinStaObject);
- RETURN( (HANDLE)0);
+ ObDereferenceObject(WinSta);
+ RETURN( Ret);
CLEANUP:
DPRINT("Leave NtUserCreateCursorIconHandle, ret=%i\n",_ret_);
@@ -663,12 +664,12 @@
BOOL
STDCALL
NtUserGetCursorIconInfo(
- HANDLE Handle,
+ HANDLE hCurIcon,
PICONINFO IconInfo)
{
ICONINFO ii;
- PCURICON_OBJECT CurIconObject;
- PWINSTATION_OBJECT WinStaObject;
+ PCURICON_OBJECT CurIcon;
+ PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
BOOL Ret = FALSE;
DECLARE_RETURN(BOOL);
@@ -676,44 +677,40 @@
DPRINT("Enter NtUserGetCursorIconInfo\n");
UserEnterExclusive();
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ if(!IconInfo)
{
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ RETURN(FALSE);
+ }
+
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
+ {
RETURN( FALSE);
}
- CurIconObject = IntGetCurIconObject(Handle);
- if(CurIconObject)
+ if (!(CurIcon = UserGetCurIconObject(hCurIcon)))
{
- if(IconInfo)
- {
- RtlCopyMemory(&ii, &CurIconObject->IconInfo,
sizeof(ICONINFO));
+ ObDereferenceObject(WinSta);
+ RETURN( FALSE);
+ }
+
+ RtlCopyMemory(&ii, &CurIcon->IconInfo, sizeof(ICONINFO));
- /* Copy bitmaps */
- ii.hbmMask = BITMAPOBJ_CopyBitmap(ii.hbmMask);
- ii.hbmColor = BITMAPOBJ_CopyBitmap(ii.hbmColor);
+ /* Copy bitmaps */
+ ii.hbmMask = BITMAPOBJ_CopyBitmap(ii.hbmMask);
+ ii.hbmColor = BITMAPOBJ_CopyBitmap(ii.hbmColor);
- /* Copy fields */
- Status = MmCopyToCaller(IconInfo, &ii, sizeof(ICONINFO));
- if(NT_SUCCESS(Status))
- Ret = TRUE;
- else
- SetLastNtError(Status);
- }
- else
- {
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- }
+ /* Copy fields */
+ Status = MmCopyToCaller(IconInfo, &ii, sizeof(ICONINFO));
+ if(NT_SUCCESS(Status))
+ Ret = TRUE;
+ else
+ SetLastNtError(Status);
- IntReleaseCurIconObject(CurIconObject);
- ObDereferenceObject(WinStaObject);
- RETURN( Ret);
- }
+ ObDereferenceObject(WinSta);
+ RETURN( Ret);
- SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
- ObDereferenceObject(WinStaObject);
- RETURN( FALSE);
-
CLEANUP:
DPRINT("Leave NtUserGetCursorIconInfo, ret=%i\n",_ret_);
UserLeave();
@@ -727,13 +724,13 @@
BOOL
STDCALL
NtUserGetCursorIconSize(
- HANDLE Handle,
+ HANDLE hCurIcon,
BOOL *fIcon,
SIZE *Size)
{
- PCURICON_OBJECT CurIconObject;
+ PCURICON_OBJECT CurIcon;
PBITMAPOBJ bmp;
- PWINSTATION_OBJECT WinStaObject;
+ PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
BOOL Ret = FALSE;
SIZE SafeSize;
@@ -742,47 +739,44 @@
DPRINT("Enter NtUserGetCursorIconSize\n");
UserEnterExclusive();
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
{
RETURN( FALSE);
}
- CurIconObject = IntGetCurIconObject(Handle);
- if(CurIconObject)
+ if (!(CurIcon = UserGetCurIconObject(hCurIcon)))
{
- /* Copy fields */
- Status = MmCopyToCaller(fIcon, &CurIconObject->IconInfo.fIcon,
sizeof(BOOL));
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- goto done;
- }
+ ObDereferenceObject(WinSta);
+ RETURN(FALSE);
+ }
+
+ /* Copy fields */
+ Status = MmCopyToCaller(fIcon, &CurIcon->IconInfo.fIcon,
sizeof(BOOL));
+ if(!NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ goto done;
+ }
- bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor);
- if(!bmp)
- goto done;
+ bmp = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmColor);
+ if(!bmp)
+ goto done;
- SafeSize.cx = bmp->SurfObj.sizlBitmap.cx;
- SafeSize.cy = bmp->SurfObj.sizlBitmap.cy;
- Status = MmCopyToCaller(Size, &SafeSize, sizeof(SIZE));
- if(NT_SUCCESS(Status))
- Ret = TRUE;
- else
- SetLastNtError(Status);
+ SafeSize.cx = bmp->SurfObj.sizlBitmap.cx;
+ SafeSize.cy = bmp->SurfObj.sizlBitmap.cy;
+ Status = MmCopyToCaller(Size, &SafeSize, sizeof(SIZE));
+ if(NT_SUCCESS(Status))
+ Ret = TRUE;
+ else
+ SetLastNtError(Status);
- BITMAPOBJ_UnlockBitmap(bmp);
+ BITMAPOBJ_UnlockBitmap(bmp);
done:
- IntReleaseCurIconObject(CurIconObject);
- ObDereferenceObject(WinStaObject);
- RETURN( Ret);
- }
+ ObDereferenceObject(WinSta);
+ RETURN( Ret);
- SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
- ObDereferenceObject(WinStaObject);
- RETURN( FALSE);
-
CLEANUP:
DPRINT("Leave NtUserGetCursorIconSize, ret=%i\n",_ret_);
UserLeave();
@@ -817,9 +811,9 @@
{
CURSORINFO SafeCi;
PSYSTEM_CURSORINFO CurInfo;
- PWINSTATION_OBJECT WinStaObject;
+ PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
- PCURICON_OBJECT CursorObject;
+ PCURICON_OBJECT CurIcon;
DECLARE_RETURN(BOOL);
DPRINT("Enter NtUserGetCursorInfo\n");
@@ -849,29 +843,29 @@
RETURN( FALSE);
}
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
{
RETURN( FALSE);
}
- CurInfo = IntGetSysCursorInfo(WinStaObject);
- CursorObject = (PCURICON_OBJECT)CurInfo->CurrentCursorObject;
+ CurInfo = IntGetSysCursorInfo(WinSta);
+ CurIcon = (PCURICON_OBJECT)CurInfo->CurrentCursorObject;
- SafeCi.flags = ((CurInfo->ShowingCursor && CursorObject) ?
CURSOR_SHOWING : 0);
- SafeCi.hCursor = (CursorObject ? (HCURSOR)CursorObject->Self :
(HCURSOR)0);
+ SafeCi.flags = ((CurInfo->ShowingCursor && CurIcon) ? CURSOR_SHOWING
: 0);
+ SafeCi.hCursor = (CurIcon ? (HCURSOR)CurIcon->Self : (HCURSOR)0);
- IntGetCursorLocation(WinStaObject, &SafeCi.ptScreenPos);
+ IntGetCursorLocation(WinSta, &SafeCi.ptScreenPos);
Status = MmCopyToCaller(pci, &SafeCi, sizeof(CURSORINFO));
if(!NT_SUCCESS(Status))
{
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
SetLastNtError(Status);
RETURN( FALSE);
}
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
RETURN( TRUE);
CLEANUP:
@@ -891,7 +885,7 @@
{
/* FIXME - check if process has WINSTA_WRITEATTRIBUTES */
- PWINSTATION_OBJECT WinStaObject;
+ PWINSTATION_OBJECT WinSta;
PSYSTEM_CURSORINFO CurInfo;
RECT Rect;
PWINDOW_OBJECT DesktopWindow = NULL;
@@ -901,24 +895,24 @@
DPRINT("Enter NtUserClipCursor\n");
UserEnterExclusive();
- WinStaObject = IntGetWinStaObj();
- if (WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if (WinSta == NULL)
{
RETURN( FALSE);
}
if (NULL != UnsafeRect && ! NT_SUCCESS(MmCopyFromCaller(&Rect,
UnsafeRect, sizeof(RECT))))
{
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
RETURN( FALSE);
}
- CurInfo = IntGetSysCursorInfo(WinStaObject);
- IntGetCursorLocation(WinStaObject, &MousePos);
+ CurInfo = IntGetSysCursorInfo(WinSta);
+ IntGetCursorLocation(WinSta, &MousePos);
- if(WinStaObject->ActiveDesktop)
- DesktopWindow =
IntGetWindowObject(WinStaObject->ActiveDesktop->DesktopWindow);
+ if(WinSta->ActiveDesktop)
+ DesktopWindow =
UserGetWindowObject(WinSta->ActiveDesktop->DesktopWindow);
if((Rect.right > Rect.left) && (Rect.bottom > Rect.top)
&& DesktopWindow && UnsafeRect != NULL)
@@ -930,7 +924,6 @@
CurInfo->CursorClipInfo.Top = max(Rect.top,
DesktopWindow->WindowRect.top);
CurInfo->CursorClipInfo.Right = min(Rect.right - 1,
DesktopWindow->WindowRect.right - 1);
CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1,
DesktopWindow->WindowRect.bottom - 1);
- IntReleaseWindowObject(DesktopWindow);
mi.dx = MousePos.x;
mi.dy = MousePos.y;
@@ -944,7 +937,7 @@
}
CurInfo->CursorClipInfo.IsClipped = FALSE;
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
RETURN( TRUE);
@@ -961,46 +954,33 @@
BOOL
STDCALL
NtUserDestroyCursorIcon(
- HANDLE Handle,
+ HANDLE hCurIcon,
DWORD Unknown)
{
- PWINSTATION_OBJECT WinStaObject;
- PCURICON_OBJECT Object;
+ PWINSTATION_OBJECT WinSta;
+ PCURICON_OBJECT CurIcon;
+ BOOL ret;
DECLARE_RETURN(BOOL);
DPRINT("Enter NtUserDestroyCursorIcon\n");
UserEnterExclusive();
- WinStaObject = IntGetWinStaObj();
- if(WinStaObject == NULL)
+ WinSta = IntGetWinStaObj();
+ if(WinSta == NULL)
{
RETURN( FALSE);
}
- if (!(Object = IntGetCurIconObject(Handle)))
+ if (!(CurIcon = UserGetCurIconObject(hCurIcon)))
{
- ObDereferenceObject(WinStaObject);
+ ObDereferenceObject(WinSta);
RETURN(FALSE);
}
- // Status = ObmReferenceObjectByHandle(gHandleTable, Handle,
otCursorIcon, (PVOID*)&Object);
- // if(!NT_SUCCESS(Status))
- // {
- // ObDereferenceObject(WinStaObject);
- // SetLastNtError(Status);
- // RETURN( FALSE);
- // }
[truncated at 1000 lines; 1001 more skipped]