ReactOS 0.4.15-dev-5669-g09dde2c
cursoricon.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CURICON_OBJECT
 
struct  tagACON
 
struct  _CURSORACCELERATION_INFO
 
struct  _SYSTEM_CURSORINFO
 
struct  SYSTEMCURICO
 

Macros

#define MAXCURICONHANDLES   4096
 
#define CURSORF_USER_MASK    (CURSORF_FROMRESOURCE | CURSORF_LRSHARED | CURSORF_ACON)
 
#define ROIC_SAMPLE   0
 
#define ROIC_HAND   1
 
#define ROIC_QUES   2
 
#define ROIC_BANG   3
 
#define ROIC_NOTE   4
 
#define ROIC_WINLOGO   5
 
#define ROCR_ARROW   0
 
#define ROCR_IBEAM   1
 
#define ROCR_WAIT   2
 
#define ROCR_CROSS   3
 
#define ROCR_UP   4
 
#define ROCR_SIZE   5
 
#define ROCR_ICON   6
 
#define ROCR_SIZENWSE   7
 
#define ROCR_SIZENESW   8
 
#define ROCR_SIZEWE   9
 
#define ROCR_SIZENS   10
 
#define ROCR_SIZEALL   11
 
#define ROCR_NO   12
 
#define ROCR_HAND   13
 
#define ROCR_APPSTARTING   14
 
#define ROCR_HELP   15
 
#define SYSTEMCUR(func)   (gasyscur[ROCR_ ## func].handle)
 
#define SYSTEMICO(func)   (gasysico[ROIC_ ## func].handle)
 

Typedefs

typedef struct _CURICON_OBJECT CURICON_OBJECT
 
typedef struct _CURICON_OBJECTPCURICON_OBJECT
 
typedef struct tagACON ACON
 
typedef struct tagACONPACON
 
typedef struct _CURSORACCELERATION_INFO CURSORACCELERATION_INFO
 
typedef struct _CURSORACCELERATION_INFOPCURSORACCELERATION_INFO
 
typedef struct _SYSTEM_CURSORINFO SYSTEM_CURSORINFO
 
typedef struct _SYSTEM_CURSORINFOPSYSTEM_CURSORINFO
 

Functions

 C_ASSERT (FIELD_OFFSET(ACON, cpcur)==FIELD_OFFSET(CURICON_OBJECT, xHotspot))
 
BOOLEAN IntDestroyCurIconObject (_In_ PVOID Object)
 
VOID FASTCALL IntCleanupCurIconCache (PPROCESSINFO Win32Process)
 
VOID FreeCurIconObject (_In_ PVOID Object)
 
VOID IntLoadSystenIcons (HICON, DWORD)
 
BOOL InitCursorImpl (VOID)
 
HANDLE IntCreateCurIconHandle (BOOLEAN Anim)
 
BOOL UserDrawIconEx (HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
 
PCURICON_OBJECT FASTCALL UserGetCurIconObject (HCURSOR hCurIcon)
 
BOOL UserSetCursorPos (INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
 
BOOL APIENTRY UserClipCursor (RECTL *prcl)
 
PSYSTEM_CURSORINFO IntGetSysCursorInfo (VOID)
 
PCURICON_OBJECT IntSystemSetCursor (PCURICON_OBJECT)
 

Variables

SYSTEMCURICO gasysico []
 
SYSTEMCURICO gasyscur []
 

Macro Definition Documentation

◆ CURSORF_USER_MASK

#define CURSORF_USER_MASK    (CURSORF_FROMRESOURCE | CURSORF_LRSHARED | CURSORF_ACON)

Definition at line 6 of file cursoricon.h.

◆ MAXCURICONHANDLES

#define MAXCURICONHANDLES   4096

Definition at line 3 of file cursoricon.h.

◆ ROCR_APPSTARTING

#define ROCR_APPSTARTING   14

Definition at line 126 of file cursoricon.h.

◆ ROCR_ARROW

#define ROCR_ARROW   0

Definition at line 112 of file cursoricon.h.

◆ ROCR_CROSS

#define ROCR_CROSS   3

Definition at line 115 of file cursoricon.h.

◆ ROCR_HAND

#define ROCR_HAND   13

Definition at line 125 of file cursoricon.h.

◆ ROCR_HELP

#define ROCR_HELP   15

Definition at line 127 of file cursoricon.h.

◆ ROCR_IBEAM

#define ROCR_IBEAM   1

Definition at line 113 of file cursoricon.h.

◆ ROCR_ICON

#define ROCR_ICON   6

Definition at line 118 of file cursoricon.h.

◆ ROCR_NO

#define ROCR_NO   12

Definition at line 124 of file cursoricon.h.

◆ ROCR_SIZE

#define ROCR_SIZE   5

Definition at line 117 of file cursoricon.h.

◆ ROCR_SIZEALL

#define ROCR_SIZEALL   11

Definition at line 123 of file cursoricon.h.

◆ ROCR_SIZENESW

#define ROCR_SIZENESW   8

Definition at line 120 of file cursoricon.h.

◆ ROCR_SIZENS

#define ROCR_SIZENS   10

Definition at line 122 of file cursoricon.h.

◆ ROCR_SIZENWSE

#define ROCR_SIZENWSE   7

Definition at line 119 of file cursoricon.h.

◆ ROCR_SIZEWE

#define ROCR_SIZEWE   9

Definition at line 121 of file cursoricon.h.

◆ ROCR_UP

#define ROCR_UP   4

Definition at line 116 of file cursoricon.h.

◆ ROCR_WAIT

#define ROCR_WAIT   2

Definition at line 114 of file cursoricon.h.

◆ ROIC_BANG

#define ROIC_BANG   3

Definition at line 108 of file cursoricon.h.

◆ ROIC_HAND

#define ROIC_HAND   1

Definition at line 106 of file cursoricon.h.

◆ ROIC_NOTE

#define ROIC_NOTE   4

Definition at line 109 of file cursoricon.h.

◆ ROIC_QUES

#define ROIC_QUES   2

Definition at line 107 of file cursoricon.h.

◆ ROIC_SAMPLE

#define ROIC_SAMPLE   0

Definition at line 105 of file cursoricon.h.

◆ ROIC_WINLOGO

#define ROIC_WINLOGO   5

Definition at line 110 of file cursoricon.h.

◆ SYSTEMCUR

#define SYSTEMCUR (   func)    (gasyscur[ROCR_ ## func].handle)

Definition at line 129 of file cursoricon.h.

◆ SYSTEMICO

#define SYSTEMICO (   func)    (gasysico[ROIC_ ## func].handle)

Definition at line 130 of file cursoricon.h.

Typedef Documentation

◆ ACON

typedef struct tagACON ACON

◆ CURICON_OBJECT

◆ CURSORACCELERATION_INFO

◆ PACON

typedef struct tagACON * PACON

◆ PCURICON_OBJECT

◆ PCURSORACCELERATION_INFO

◆ PSYSTEM_CURSORINFO

◆ SYSTEM_CURSORINFO

Function Documentation

◆ C_ASSERT()

C_ASSERT ( FIELD_OFFSET(ACON, cpcur)  = =FIELD_OFFSET(CURICON_OBJECT, xHotspot))

◆ FreeCurIconObject()

VOID FreeCurIconObject ( _In_ PVOID  Object)

Definition at line 332 of file cursoricon.c.

334{
335 PCURICON_OBJECT CurIcon = Object;
336
337 if (!(CurIcon->CURSORF_flags & CURSORF_ACON))
338 {
339 HBITMAP bmpMask = CurIcon->hbmMask;
340 HBITMAP bmpColor = CurIcon->hbmColor;
341 HBITMAP bmpAlpha = CurIcon->hbmAlpha;
342
343 /* Delete bitmaps */
344 if (bmpMask)
345 {
347 NT_VERIFY(GreDeleteObject(bmpMask) == TRUE);
348 CurIcon->hbmMask = NULL;
349 }
350 if (bmpColor)
351 {
353 NT_VERIFY(GreDeleteObject(bmpColor) == TRUE);
354 CurIcon->hbmColor = NULL;
355 }
356 if (bmpAlpha)
357 {
359 NT_VERIFY(GreDeleteObject(bmpAlpha) == TRUE);
360 CurIcon->hbmAlpha = NULL;
361 }
362 }
363 else
364 {
365 PACON AniCurIcon = (PACON)CurIcon;
366 UINT i;
367
368 for (i = 0; i < AniCurIcon->cpcur; i++)
369 {
370 UserDereferenceObject(AniCurIcon->aspcur[i]);
372 }
374 }
375
376 if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
377 {
378 if (!IS_INTRESOURCE(CurIcon->strName.Buffer))
380 if (CurIcon->atomModName)
382 CurIcon->strName.Buffer = NULL;
383 CurIcon->atomModName = 0;
384 }
385
386 /* Finally free the thing */
387 FreeProcMarkObject(CurIcon);
388}
struct tagACON * PACON
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CURSORF_LRSHARED
Definition: ntuser.h:1196
#define CURSORF_ACON
Definition: ntuser.h:1197
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
static HBITMAP
Definition: button.c:44
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI RtlDeleteAtomFromAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom)
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define TAG_STRING
Definition: oslist.h:22
HBITMAP hbmColor
Definition: cursoricon.h:20
HBITMAP hbmMask
Definition: cursoricon.h:19
UNICODE_STRING strName
Definition: cursoricon.h:13
USHORT atomModName
Definition: cursoricon.h:14
ULONG CURSORF_flags
Definition: cursoricon.h:16
HBITMAP hbmAlpha
Definition: cursoricon.h:21
UINT cpcur
Definition: cursoricon.h:37
PCURICON_OBJECT * aspcur
Definition: cursoricon.h:39
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1255
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
BOOLEAN IntDestroyCurIconObject(_In_ PVOID Object)
Definition: cursoricon.c:313
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
void FreeProcMarkObject(_In_ PVOID Object)
Definition: object.c:175
PRTL_ATOM_TABLE gAtomTable
Definition: session.c:13
#define USERTAG_CURSOR
Definition: tags.h:209
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3287

◆ InitCursorImpl()

BOOL InitCursorImpl ( VOID  )

Definition at line 64 of file cursoricon.c.

Referenced by IntCreateWindowStation().

◆ IntCleanupCurIconCache()

VOID FASTCALL IntCleanupCurIconCache ( PPROCESSINFO  Win32Process)

Definition at line 391 of file cursoricon.c.

392{
393 PCURICON_OBJECT CurIcon;
394
395 /* Run through the list of icon objects */
396 while (Win32Process->pCursorCache)
397 {
398 CurIcon = Win32Process->pCursorCache;
399 Win32Process->pCursorCache = CurIcon->pcurNext;
400 UserDereferenceObject(CurIcon);
401 }
402}
struct _CURICON_OBJECT * pcurNext
Definition: cursoricon.h:12
struct _CURICON_OBJECT * pCursorCache
Definition: win32.h:272

Referenced by UserProcessDestroy().

◆ IntCreateCurIconHandle()

HANDLE IntCreateCurIconHandle ( BOOLEAN  Anim)

Definition at line 281 of file cursoricon.c.

282{
283 PCURICON_OBJECT CurIcon;
284 HANDLE hCurIcon;
285
286 CurIcon = UserCreateObject(
288 NULL,
290 &hCurIcon,
292 Animated ? sizeof(ACON) : sizeof(CURICON_OBJECT));
293
294 if (!CurIcon)
295 {
297 return FALSE;
298 }
299
300 if (Animated)
301 {
302 /* We MUST set this flag, to track whether this is an ACON! */
303 CurIcon->CURSORF_flags |= CURSORF_ACON;
304 }
305
306 NT_ASSERT(CurIcon->pcurNext == NULL);
307 UserDereferenceObject(CurIcon);
308
309 return hCurIcon;
310}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:801
@ TYPE_CURSOR
Definition: ntuser.h:43
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by IntSetAconData(), and NtUserCallOneParam().

◆ IntDestroyCurIconObject()

BOOLEAN IntDestroyCurIconObject ( _In_ PVOID  Object)

Definition at line 313 of file cursoricon.c.

315{
316 PCURICON_OBJECT CurIcon = Object;
317
318 /* Check if the cursor is in a list */
319 if (CurIcon->CURSORF_flags & CURSORF_LINKED)
320 {
321 /* Remove the cursor from it's list */
323 }
324
325 /* We just mark the handle as being destroyed.
326 * Deleting all the stuff will be deferred to the actual struct free. */
327 UserDeleteObject(CurIcon->head.h, TYPE_CURSOR);
328 return TRUE;
329}
#define CURSORF_LINKED
Definition: ntuser.h:1201
PROCMARKHEAD head
Definition: cursoricon.h:11
static VOID IntRemoveCursorFromList(_Inout_ PCURICON_OBJECT pcur)
Definition: cursoricon.c:101
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717

Referenced by FreeCurIconObject(), IntDestroyClass(), IntSetAconData(), NtUserDestroyCursor(), and UserSetClassLongPtr().

◆ IntGetSysCursorInfo()

◆ IntLoadSystenIcons()

VOID IntLoadSystenIcons ( HICON  hcur,
DWORD  id 
)

Definition at line 137 of file cursoricon.c.

138{
139 PCURICON_OBJECT pcur;
140 int i;
141 PPROCESSINFO ppi;
142
143 if (hcur)
144 {
145 pcur = UserGetCurIconObject(hcur);
146 if (!pcur)
147 {
149 return;
150 }
151
153
154 if (!(ppi->W32PF_flags & W32PF_CREATEDWINORDC))
155 return;
156
157 // Set Small Window Icon and do not link.
158 if ( id == OIC_WINLOGO+1 )
159 {
162 pcur->head.ppi = NULL;
163 return;
164 }
165
166 for (i = 0 ; i < 6; i++)
167 {
168 if (gasysico[i].type == id)
169 {
170 gasysico[i].handle = pcur;
172
173 //
174 // The active switch between LR shared and Global public.
175 // This is hacked around to support this while at the initial system start up.
176 //
177 pcur->head.ppi = NULL;
178
180 return;
181 }
182 }
183 }
184}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CURSORF_GLOBAL
Definition: ntuser.h:1195
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
PCURICON_OBJECT handle
Definition: cursoricon.h:99
struct _PROCESSINFO * ppi
Definition: ntuser.h:227
#define W32PF_CREATEDWINORDC
Definition: win32.h:34
static VOID IntInsertCursorIntoList(_Inout_ PCURICON_OBJECT pcur)
Definition: cursoricon.c:80
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
SYSTEMCURICO gasysico[]
Definition: cursoricon.c:54
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
#define ERROR_INVALID_CURSOR_HANDLE
Definition: winerror.h:883
#define OIC_WINLOGO
Definition: winuser.h:1157

Referenced by co_IntSetWndIcons().

◆ IntSystemSetCursor()

PCURICON_OBJECT IntSystemSetCursor ( PCURICON_OBJECT  pcurNew)

Definition at line 230 of file cursoricon.c.

231{
232 PCURICON_OBJECT pcurOld = UserSetCursor(pcurNew, FALSE);
233 if (pcurNew) UserReferenceObject(pcurNew);
234 if (pcurOld) UserDereferenceObject(pcurOld);
235 return pcurOld;
236}
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93

Referenced by co_IntProcessMouseMessage(), and DefWndHandleSetCursor().

◆ UserClipCursor()

BOOL APIENTRY UserClipCursor ( RECTL prcl)

Definition at line 700 of file cursoricon.c.

702{
703 PSYSTEM_CURSORINFO CurInfo;
705
707 {
708 return FALSE;
709 }
710
711 CurInfo = IntGetSysCursorInfo();
712
714
715 if (prcl != NULL && DesktopWindow != NULL)
716 {
717 if (prcl->right < prcl->left || prcl->bottom < prcl->top)
718 {
720 return FALSE;
721 }
722
723 CurInfo->bClipped = TRUE;
724
725 /* Set nw cliping region. Note: we can't use RECTL_bIntersectRect because
726 it sets rect to 0 0 0 0 when it's empty. For more info see monitor winetest */
727 CurInfo->rcClip.left = max(prcl->left, DesktopWindow->rcWindow.left);
728 CurInfo->rcClip.right = min(prcl->right, DesktopWindow->rcWindow.right);
729 if (CurInfo->rcClip.right < CurInfo->rcClip.left)
730 CurInfo->rcClip.right = CurInfo->rcClip.left;
731
732 CurInfo->rcClip.top = max(prcl->top, DesktopWindow->rcWindow.top);
733 CurInfo->rcClip.bottom = min(prcl->bottom, DesktopWindow->rcWindow.bottom);
734 if (CurInfo->rcClip.bottom < CurInfo->rcClip.top)
735 CurInfo->rcClip.bottom = CurInfo->rcClip.top;
736
737 /* Make sure cursor is in clipping region */
738 UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, 0, 0, FALSE);
739 }
740 else
741 {
742 CurInfo->bClipped = FALSE;
743 }
744
745 return TRUE;
746}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
PSERVERINFO gpsi
Definition: imm.c:18
#define min(a, b)
Definition: monoChain.cc:55
BOOL FASTCALL CheckWinstaAttributeAccess(ACCESS_MASK DesiredAccess)
Definition: winsta.c:377
Implementation of the Explorer desktop window.
Definition: desktop.h:52
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: ntuser.h:689
#define max(a, b)
Definition: svc.c:63
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
PSYSTEM_CURSORINFO IntGetSysCursorInfo(VOID)
Definition: cursoricon.c:187
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531
#define WINSTA_WRITEATTRIBUTES
Definition: winuser.h:416

Referenced by DefWndDoSizeMove(), NtUserClipCursor(), and UserChangeDisplaySettings().

◆ UserDrawIconEx()

BOOL UserDrawIconEx ( HDC  hDc,
INT  xLeft,
INT  yTop,
PCURICON_OBJECT  pIcon,
INT  cxWidth,
INT  cyHeight,
UINT  istepIfAniCur,
HBRUSH  hbrFlickerFreeDraw,
UINT  diFlags 
)

Definition at line 1688 of file cursoricon.c.

1698{
1699 PSURFACE psurfDest, psurfMask, psurfColor; //, psurfOffScreen = NULL;
1700 PDC pdc = NULL;
1701 BOOL Ret = FALSE;
1702 HBITMAP hbmMask, hbmColor, hbmAlpha;
1703 BOOL bOffScreen;
1704 RECTL rcDest, rcSrc;
1705 CLIPOBJ* pdcClipObj = NULL;
1706 EXLATEOBJ exlo;
1707
1708 /* Stupid case */
1709 if ((diFlags & DI_NORMAL) == 0)
1710 {
1711 ERR("DrawIconEx called without mask or color bitmap to draw.\n");
1712 return FALSE;
1713 }
1714
1715 if (pIcon->CURSORF_flags & CURSORF_ACON)
1716 {
1717 ACON* pAcon = (ACON*)pIcon;
1718 if (istepIfAniCur >= pAcon->cicur)
1719 {
1720 ERR("NtUserDrawIconEx: istepIfAniCur too big!\n");
1721 return FALSE;
1722 }
1723 pIcon = pAcon->aspcur[pAcon->aicur[istepIfAniCur]];
1724 }
1725
1726 hbmMask = pIcon->hbmMask;
1727 hbmColor = pIcon->hbmColor;
1728 hbmAlpha = pIcon->hbmAlpha;
1729
1730 /*
1731 * Get our objects.
1732 * Shared locks are enough, we are only reading those bitmaps
1733 */
1734 psurfMask = SURFACE_ShareLockSurface(hbmMask);
1735 if (psurfMask == NULL)
1736 {
1737 ERR("Unable to lock the mask surface.\n");
1738 return FALSE;
1739 }
1740
1741 /* Color bitmap is not mandatory */
1742 if (hbmColor == NULL)
1743 {
1744 /* But then the mask bitmap must have the information in it's bottom half */
1745 ASSERT(psurfMask->SurfObj.sizlBitmap.cy == 2*pIcon->cy);
1746 psurfColor = NULL;
1747 }
1748 else if ((psurfColor = SURFACE_ShareLockSurface(hbmColor)) == NULL)
1749 {
1750 ERR("Unable to lock the color bitmap.\n");
1751 SURFACE_ShareUnlockSurface(psurfMask);
1752 return FALSE;
1753 }
1754
1755 pdc = DC_LockDc(hDc);
1756 if (!pdc)
1757 {
1758 ERR("Could not lock the destination DC.\n");
1759 SURFACE_ShareUnlockSurface(psurfMask);
1760 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
1761 return FALSE;
1762 }
1763
1764 /* Fix width parameter, if needed */
1765 if (!cxWidth)
1766 {
1767 if (diFlags & DI_DEFAULTSIZE)
1768 cxWidth = is_icon(pIcon) ?
1770 else
1771 cxWidth = pIcon->cx;
1772 }
1773
1774 /* Fix height parameter, if needed */
1775 if (!cyHeight)
1776 {
1777 if (diFlags & DI_DEFAULTSIZE)
1778 cyHeight = is_icon(pIcon) ?
1780 else
1781 cyHeight = pIcon->cy;
1782 }
1783
1784 /* Calculate destination rectangle */
1785 RECTL_vSetRect(&rcDest, xLeft, yTop, xLeft + cxWidth, yTop + cyHeight);
1786 IntLPtoDP(pdc, (LPPOINT)&rcDest, 2);
1787 RECTL_vOffsetRect(&rcDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y);
1788
1789 /* Prepare the underlying surface */
1790 DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
1791
1792 /* We now have our destination surface and rectangle */
1793 psurfDest = pdc->dclevel.pSurface;
1794
1795 if (psurfDest == NULL)
1796 {
1797 /* Empty DC */
1798 DC_vFinishBlit(pdc, NULL);
1799 DC_UnlockDc(pdc);
1800 SURFACE_ShareUnlockSurface(psurfMask);
1801 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
1802 return FALSE;
1803 }
1804
1805 /* Set source rect */
1806 RECTL_vSetRect(&rcSrc, 0, 0, pIcon->cx, pIcon->cy);
1807
1808 /* Should we render off-screen? */
1809 bOffScreen = hbrFlickerFreeDraw &&
1810 (GDI_HANDLE_GET_TYPE(hbrFlickerFreeDraw) == GDI_OBJECT_TYPE_BRUSH);
1811
1812 if (bOffScreen)
1813 {
1814 /* Yes: Allocate and paint the offscreen surface */
1815 EBRUSHOBJ eboFill;
1816 PBRUSH pbrush = BRUSH_ShareLockBrush(hbrFlickerFreeDraw);
1817
1818 TRACE("Performing off-screen rendering.\n");
1819
1820 if (!pbrush)
1821 {
1822 ERR("Failed to get brush object.\n");
1823 goto Cleanup;
1824 }
1825
1826#if 0 //We lock the hdc surface during the whole function it makes no sense to use an offscreen surface for "flicker free" drawing
1827 psurfOffScreen = SURFACE_AllocSurface(STYPE_BITMAP,
1828 cxWidth, cyHeight, psurfDest->SurfObj.iBitmapFormat,
1829 0, 0, NULL);
1830 if (!psurfOffScreen)
1831 {
1832 ERR("Failed to allocate the off-screen surface.\n");
1833 BRUSH_ShareUnlockBrush(pbrush);
1834 goto Cleanup;
1835 }
1836
1837 /* Paint the brush */
1838 EBRUSHOBJ_vInit(&eboFill, pbrush, psurfOffScreen, 0x00FFFFFF, 0, NULL);
1839 RECTL_vSetRect(&rcDest, 0, 0, cxWidth, cyHeight);
1840
1841 Ret = IntEngBitBlt(&psurfOffScreen->SurfObj,
1842 NULL,
1843 NULL,
1844 NULL,
1845 NULL,
1846 &rcDest,
1847 NULL,
1848 NULL,
1849 &eboFill.BrushObject,
1850 &pbrush->ptOrigin,
1851 ROP4_PATCOPY);
1852
1853 /* Clean up everything */
1854 EBRUSHOBJ_vCleanup(&eboFill);
1855 BRUSH_ShareUnlockBrush(pbrush);
1856
1857 if (!Ret)
1858 {
1859 ERR("Failed to paint the off-screen surface.\n");
1860 goto Cleanup;
1861 }
1862
1863 /* We now have our destination surface */
1864 psurfDest = psurfOffScreen;
1865#else
1866 pdcClipObj = (CLIPOBJ *)&pdc->co;
1867 /* Paint the brush */
1868 EBRUSHOBJ_vInit(&eboFill, pbrush, psurfDest, 0x00FFFFFF, 0, NULL);
1869
1870 Ret = IntEngBitBlt(&psurfDest->SurfObj,
1871 NULL,
1872 NULL,
1873 pdcClipObj,
1874 NULL,
1875 &rcDest,
1876 NULL,
1877 NULL,
1878 &eboFill.BrushObject,
1879 &pbrush->ptOrigin,
1880 ROP4_PATCOPY);
1881
1882 /* Clean up everything */
1883 EBRUSHOBJ_vCleanup(&eboFill);
1884 BRUSH_ShareUnlockBrush(pbrush);
1885
1886 if (!Ret)
1887 {
1888 ERR("Failed to paint the off-screen surface.\n");
1889 goto Cleanup;
1890 }
1891#endif
1892 }
1893 else
1894 {
1895 /* We directly draw to the DC */
1896 TRACE("Performing on screen rendering.\n");
1897 pdcClipObj = (CLIPOBJ *)&pdc->co;
1898 // psurfOffScreen = NULL;
1899 }
1900
1901 /* Now do the rendering */
1902 if (hbmAlpha && ((diFlags & DI_NORMAL) == DI_NORMAL))
1903 {
1904 BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } };
1905 PSURFACE psurf = NULL;
1906
1907 psurf = SURFACE_ShareLockSurface(hbmAlpha);
1908 if (!psurf)
1909 {
1910 ERR("SURFACE_LockSurface failed!\n");
1911 goto NoAlpha;
1912 }
1913
1914 /* Initialize color translation object */
1915 EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0xFFFFFFFF, 0xFFFFFFFF, 0);
1916
1917 /* Now do it */
1918 Ret = IntEngAlphaBlend(&psurfDest->SurfObj,
1919 &psurf->SurfObj,
1920 pdcClipObj,
1921 &exlo.xlo,
1922 &rcDest,
1923 &rcSrc,
1924 &blendobj);
1925
1926 EXLATEOBJ_vCleanup(&exlo);
1928 if (Ret) goto done;
1929 ERR("NtGdiAlphaBlend failed!\n");
1930 }
1931NoAlpha:
1932 if (diFlags & DI_MASK)
1933 {
1934 DWORD rop4 = (diFlags & DI_IMAGE) ? ROP4_SRCAND : ROP4_SRCCOPY;
1935
1936 EXLATEOBJ_vInitSrcMonoXlate(&exlo, psurfDest->ppal, 0x00FFFFFF, 0);
1937
1938 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1939 &psurfMask->SurfObj,
1940 NULL,
1941 pdcClipObj,
1942 &exlo.xlo,
1943 NULL,
1944 &rcDest,
1945 &rcSrc,
1946 NULL,
1947 NULL,
1948 NULL,
1949 rop4);
1950
1951 EXLATEOBJ_vCleanup(&exlo);
1952
1953 if (!Ret)
1954 {
1955 ERR("Failed to mask the bitmap data.\n");
1956 goto Cleanup;
1957 }
1958 }
1959
1960 if (diFlags & DI_IMAGE)
1961 {
1962 if (psurfColor)
1963 {
1964 DWORD rop4 = (diFlags & DI_MASK) ? ROP4_SRCINVERT : ROP4_SRCCOPY ;
1965
1966 EXLATEOBJ_vInitialize(&exlo, psurfColor->ppal, psurfDest->ppal, 0x00FFFFFF, 0x00FFFFFF, 0);
1967
1968 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1969 &psurfColor->SurfObj,
1970 NULL,
1971 pdcClipObj,
1972 &exlo.xlo,
1973 NULL,
1974 &rcDest,
1975 &rcSrc,
1976 NULL,
1977 NULL,
1978 NULL,
1979 rop4);
1980
1981 EXLATEOBJ_vCleanup(&exlo);
1982
1983 if (!Ret)
1984 {
1985 ERR("Failed to render the icon bitmap.\n");
1986 goto Cleanup;
1987 }
1988 }
1989 else
1990 {
1991 /* Mask bitmap holds the information in its bottom half */
1992 DWORD rop4 = (diFlags & DI_MASK) ? ROP4_SRCINVERT : ROP4_SRCCOPY;
1993 RECTL_vOffsetRect(&rcSrc, 0, pIcon->cy);
1994
1995 EXLATEOBJ_vInitSrcMonoXlate(&exlo, psurfDest->ppal, 0x00FFFFFF, 0);
1996
1997 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1998 &psurfMask->SurfObj,
1999 NULL,
2000 pdcClipObj,
2001 &exlo.xlo,
2002 NULL,
2003 &rcDest,
2004 &rcSrc,
2005 NULL,
2006 NULL,
2007 NULL,
2008 rop4);
2009
2010 EXLATEOBJ_vCleanup(&exlo);
2011
2012 if (!Ret)
2013 {
2014 ERR("Failed to render the icon bitmap.\n");
2015 goto Cleanup;
2016 }
2017 }
2018 }
2019
2020done:
2021#if 0
2022 /* We're done. Was it a double buffered draw ? */
2023 if (bOffScreen)
2024 {
2025 /* Yes. Draw it back to our DC */
2026 POINTL ptSrc = {0, 0};
2027
2028 /* Calculate destination rectangle */
2029 RECTL_vSetRect(&rcDest, xLeft, yTop, xLeft + cxWidth, yTop + cyHeight);
2030 IntLPtoDP(pdc, (LPPOINT)&rcDest, 2);
2031 RECTL_vOffsetRect(&rcDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y);
2032
2033 /* Get the clip object */
2034 pdcClipObj = pdc->rosdc.CombinedClip;
2035
2036 /* We now have our destination surface and rectangle */
2037 psurfDest = pdc->dclevel.pSurface;
2038
2039 /* Color translation */
2040 EXLATEOBJ_vInitialize(&exlo, psurfOffScreen->ppal, psurfDest->ppal, 0x00FFFFFF, 0x00FFFFFF, 0);
2041
2042 /* Blt it! */
2043 Ret = IntEngBitBlt(&psurfDest->SurfObj,
2044 &psurfOffScreen->SurfObj,
2045 NULL,
2046 pdcClipObj,
2047 &exlo.xlo,
2048 &rcDest,
2049 &ptSrc,
2050 NULL,
2051 NULL,
2052 NULL,
2053 ROP4_SRCCOPY);
2054
2055 EXLATEOBJ_vCleanup(&exlo);
2056 }
2057#endif
2058Cleanup:
2059 if (pdc)
2060 {
2061 DC_vFinishBlit(pdc, NULL);
2062 DC_UnlockDc(pdc);
2063 }
2064
2065#if 0
2066 /* Delete off screen rendering surface */
2067 if (psurfOffScreen)
2068 GDIOBJ_vDeleteObject(&psurfOffScreen->BaseObject);
2069#endif
2070
2071 /* Unlock other surfaces */
2072 SURFACE_ShareUnlockSurface(psurfMask);
2073 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
2074
2075 return Ret;
2076}
#define ERR(fmt,...)
Definition: debug.h:110
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
static const WCHAR Cleanup[]
Definition: register.c:80
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
VOID NTAPI EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PSURFACE psurf, COLORREF crBackgroundClr, COLORREF crForegroundClr, PPALETTE ppalDC)
Definition: engbrush.c:52
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:117
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:118
#define GDI_OBJECT_TYPE_BRUSH
Definition: gdi.h:52
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
BOOL APIENTRY IntEngStretchBlt(SURFOBJ *DestObj, SURFOBJ *SourceObj, SURFOBJ *Mask, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, COLORADJUSTMENT *pca, RECTL *DestRect, RECTL *SourceRect, POINTL *pMaskOrigin, BRUSHOBJ *Brush, POINTL *BrushOrigin, ULONG Mode)
#define ASSERT(a)
Definition: mode.c:44
#define AC_SRC_ALPHA
Definition: alphablend.c:9
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:41
CLIPOBJ CombinedClip
Definition: polytest.cpp:42
Definition: types.h:101
BRUSHOBJ BrushObject
Definition: brush.h:71
XLATEOBJ xlo
Definition: xlateobj.h:21
SURFOBJ SurfObj
Definition: surface.h:8
struct _PALETTE *const ppal
Definition: surface.h:11
SIZEL sizlBitmap
Definition: winddi.h:1209
ULONG iBitmapFormat
Definition: winddi.h:1215
UINT cicur
Definition: cursoricon.h:38
DWORD * aicur
Definition: cursoricon.h:40
LONG cy
Definition: windef.h:335
#define ROP4_SRCCOPY
Definition: dib.h:13
#define ROP4_PATCOPY
Definition: dib.h:15
#define ROP4_SRCINVERT
Definition: dib.h:9
#define ROP4_SRCAND
Definition: dib.h:10
BOOL APIENTRY IntEngAlphaBlend(_Inout_ SURFOBJ *psoDest, _In_ SURFOBJ *psoSource, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclDest, _In_ RECTL *prclSrc, _In_ BLENDOBJ *pBlendObj)
Definition: alphablend.c:197
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:656
PSURFACE NTAPI SURFACE_AllocSurface(_In_ USHORT iType, _In_ ULONG cx, _In_ ULONG cy, _In_ ULONG iFormat, _In_ ULONG fjBitmap, _In_opt_ ULONG cjWidth, _In_opt_ ULONG cjBufSize, _In_opt_ PVOID pvBits)
Definition: surface.c:116
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
FORCEINLINE BOOL is_icon(PCURICON_OBJECT object)
Definition: cursoricon.c:194
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define STYPE_BITMAP
Definition: winddi.h:1175
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ _In_opt_ POINTL _In_ ROP4 rop4
Definition: winddi.h:3442
#define AC_SRC_OVER
Definition: wingdi.h:1369
#define DI_NORMAL
Definition: wingdi.h:72
#define DI_IMAGE
Definition: wingdi.h:70
#define DI_MASK
Definition: wingdi.h:71
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
#define SM_CYICON
Definition: winuser.h:967
#define SM_CYCURSOR
Definition: winuser.h:969
#define SM_CXICON
Definition: winuser.h:966
#define SM_CXCURSOR
Definition: winuser.h:968
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
VOID NTAPI EXLATEOBJ_vInitSrcMonoXlate(PEXLATEOBJ pexlo, PPALETTE ppalDst, COLORREF crBackgroundClr, COLORREF crForegroundClr)
Definition: xlateobj.c:632

Referenced by IntDefWindowProc(), MENU_DrawBitmapItem(), NtUserDrawIconEx(), UserDrawCaption(), and UserDrawSysMenuButton().

◆ UserGetCurIconObject()

PCURICON_OBJECT FASTCALL UserGetCurIconObject ( HCURSOR  hCurIcon)

Definition at line 200 of file cursoricon.c.

201{
202 PCURICON_OBJECT CurIcon;
203
204 if (!hCurIcon)
205 {
207 return NULL;
208 }
209
210 if (UserObjectInDestroy(hCurIcon))
211 {
212 WARN("Requesting invalid/destroyed cursor.\n");
214 return NULL;
215 }
216
218 if (!CurIcon)
219 {
220 /* We never set ERROR_INVALID_ICON_HANDLE. lets hope noone ever checks for it */
222 return NULL;
223 }
224
225 ASSERT(CurIcon->head.cLockObj >= 1);
226 return CurIcon;
227}
#define WARN(fmt,...)
Definition: debug.h:112
struct _CURICON_OBJECT * PCURICON_OBJECT
PVOID FASTCALL UserReferenceObjectByHandle(HANDLE handle, HANDLE_TYPE type)
Definition: object.c:741
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
Definition: object.c:703

Referenced by _Success_(), DefWndDoSizeMove(), DesktopWindowProc(), IntCreateClass(), IntCreateWindow(), IntLoadSystenIcons(), IntSetAconData(), NtUserDestroyCursor(), NtUserDrawIconEx(), NtUserGetCursorFrameInfo(), NtUserGetIconSize(), NtUserSetCursor(), NtUserSetSystemCursor(), UserDrawCaption(), UserSetClassLongPtr(), and UserSetCursorIconData().

◆ UserSetCursorPos()

BOOL UserSetCursorPos ( INT  x,
INT  y,
DWORD  flags,
ULONG_PTR  dwExtraInfo,
BOOL  Hook 
)

Definition at line 238 of file cursoricon.c.

239{
241 PSYSTEM_CURSORINFO CurInfo;
242 MSG Msg;
243 RECTL rcClip;
244 POINT pt;
245
247 {
248 return FALSE;
249 }
250
251 CurInfo = IntGetSysCursorInfo();
252
253 /* Clip cursor position */
254 if (!CurInfo->bClipped)
255 rcClip = DesktopWindow->rcClient;
256 else
257 rcClip = CurInfo->rcClip;
258
259 if (x >= rcClip.right) x = rcClip.right - 1;
260 if (x < rcClip.left) x = rcClip.left;
261 if (y >= rcClip.bottom) y = rcClip.bottom - 1;
262 if (y < rcClip.top) y = rcClip.top;
263
264 pt.x = x;
265 pt.y = y;
266
267 /* 1. Generate a mouse move message, this sets the htEx and Track Window too. */
268 Msg.message = WM_MOUSEMOVE;
269 Msg.wParam = UserGetMouseButtonsState();
270 Msg.lParam = MAKELPARAM(x, y);
271 Msg.pt = pt;
272 co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook);
273
274 /* 2. Store the new cursor position */
275 gpsi->ptCursor = pt;
276
277 return TRUE;
278}
struct @1609 Msg[]
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLbitfield flags
Definition: glext.h:7161
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
#define WM_MOUSEMOVE
Definition: winuser.h:1765

Referenced by DefWndDoSizeMove(), DefWndStartSizeMove(), NtUserCallTwoParam(), UserClipCursor(), and UserSendMouseInput().

Variable Documentation

◆ gasyscur

SYSTEMCURICO gasyscur[]
extern

Definition at line 32 of file cursoricon.c.

Referenced by NtUserSetSystemCursor().

◆ gasysico

SYSTEMCURICO gasysico[]
extern

Definition at line 54 of file cursoricon.c.

Referenced by IntLoadSystenIcons().