ReactOS 0.4.15-dev-7906-g1b85a5f
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 334 of file cursoricon.c.

336{
337 PCURICON_OBJECT CurIcon = Object;
338
339 if (!(CurIcon->CURSORF_flags & CURSORF_ACON))
340 {
341 HBITMAP bmpMask = CurIcon->hbmMask;
342 HBITMAP bmpColor = CurIcon->hbmColor;
343 HBITMAP bmpAlpha = CurIcon->hbmAlpha;
344
345 /* Delete bitmaps */
346 if (bmpMask)
347 {
349 NT_VERIFY(GreDeleteObject(bmpMask) == TRUE);
350 CurIcon->hbmMask = NULL;
351 }
352 if (bmpColor)
353 {
355 NT_VERIFY(GreDeleteObject(bmpColor) == TRUE);
356 CurIcon->hbmColor = NULL;
357 }
358 if (bmpAlpha)
359 {
361 NT_VERIFY(GreDeleteObject(bmpAlpha) == TRUE);
362 CurIcon->hbmAlpha = NULL;
363 }
364 }
365 else
366 {
367 PACON AniCurIcon = (PACON)CurIcon;
368 UINT i;
369
370 for (i = 0; i < AniCurIcon->cpcur; i++)
371 {
372 UserDereferenceObject(AniCurIcon->aspcur[i]);
374 }
376 }
377
378 if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
379 {
380 if (!IS_INTRESOURCE(CurIcon->strName.Buffer))
382 if (CurIcon->atomModName)
384 CurIcon->strName.Buffer = NULL;
385 CurIcon->atomModName = 0;
386 }
387
388 /* Finally free the thing */
389 FreeProcMarkObject(CurIcon);
390}
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:1201
#define CURSORF_ACON
Definition: ntuser.h:1202
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
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:315
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 393 of file cursoricon.c.

394{
395 PCURICON_OBJECT CurIcon;
396
397 /* Run through the list of icon objects */
398 while (Win32Process->pCursorCache)
399 {
400 CurIcon = Win32Process->pCursorCache;
401 Win32Process->pCursorCache = CurIcon->pcurNext;
402 UserDereferenceObject(CurIcon);
403 }
404}
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 283 of file cursoricon.c.

284{
285 PCURICON_OBJECT CurIcon;
286 HANDLE hCurIcon;
287
288 CurIcon = UserCreateObject(
290 NULL,
292 &hCurIcon,
294 Animated ? sizeof(ACON) : sizeof(CURICON_OBJECT));
295
296 if (!CurIcon)
297 {
299 return FALSE;
300 }
301
302 if (Animated)
303 {
304 /* We MUST set this flag, to track whether this is an ACON! */
305 CurIcon->CURSORF_flags |= CURSORF_ACON;
306 }
307
308 NT_ASSERT(CurIcon->pcurNext == NULL);
309 UserDereferenceObject(CurIcon);
310
311 return hCurIcon;
312}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
@ 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:22
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by IntSetAconData(), and NtUserCallOneParam().

◆ IntDestroyCurIconObject()

BOOLEAN IntDestroyCurIconObject ( _In_ PVOID  Object)

Definition at line 315 of file cursoricon.c.

317{
318 PCURICON_OBJECT CurIcon = Object;
319
320 /* Check if the cursor is in a list */
321 if (CurIcon->CURSORF_flags & CURSORF_LINKED)
322 {
323 /* Remove the cursor from it's list */
325 }
326
327 /* We just mark the handle as being destroyed.
328 * Deleting all the stuff will be deferred to the actual struct free. */
330 return TRUE;
331}
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define CURSORF_LINKED
Definition: ntuser.h:1206
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:1200
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
PCURICON_OBJECT handle
Definition: cursoricon.h:99
PROCMARKHEAD head
Definition: cursoricon.h:11
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

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 698 of file cursoricon.c.

700{
701 PSYSTEM_CURSORINFO CurInfo;
703
705 {
706 return FALSE;
707 }
708
709 CurInfo = IntGetSysCursorInfo();
710
712
713 if (prcl != NULL && DesktopWindow != NULL)
714 {
715 if (prcl->right < prcl->left || prcl->bottom < prcl->top)
716 {
718 return FALSE;
719 }
720
721 CurInfo->bClipped = TRUE;
722
723 /* Set nw cliping region. Note: we can't use RECTL_bIntersectRect because
724 it sets rect to 0 0 0 0 when it's empty. For more info see monitor winetest */
725 CurInfo->rcClip.left = max(prcl->left, DesktopWindow->rcWindow.left);
726 CurInfo->rcClip.right = min(prcl->right, DesktopWindow->rcWindow.right);
727 if (CurInfo->rcClip.right < CurInfo->rcClip.left)
728 CurInfo->rcClip.right = CurInfo->rcClip.left;
729
730 CurInfo->rcClip.top = max(prcl->top, DesktopWindow->rcWindow.top);
731 CurInfo->rcClip.bottom = min(prcl->bottom, DesktopWindow->rcWindow.bottom);
732 if (CurInfo->rcClip.bottom < CurInfo->rcClip.top)
733 CurInfo->rcClip.bottom = CurInfo->rcClip.top;
734
735 /* Make sure cursor is in clipping region */
736 UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, 0, 0, FALSE);
737 }
738 else
739 {
740 CurInfo->bClipped = FALSE;
741 }
742
743 return TRUE;
744}
#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:694
#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 1687 of file cursoricon.c.

1697{
1698 PSURFACE psurfDest, psurfMask, psurfColor; //, psurfOffScreen = NULL;
1699 PDC pdc = NULL;
1700 BOOL Ret = FALSE;
1701 HBITMAP hbmMask, hbmColor, hbmAlpha;
1702 BOOL bOffScreen;
1703 RECTL rcDest, rcSrc;
1704 CLIPOBJ* pdcClipObj = NULL;
1705 EXLATEOBJ exlo;
1706
1707 /* Stupid case */
1708 if ((diFlags & DI_NORMAL) == 0)
1709 {
1710 ERR("DrawIconEx called without mask or color bitmap to draw.\n");
1711 return FALSE;
1712 }
1713
1714 if (pIcon->CURSORF_flags & CURSORF_ACON)
1715 {
1716 ACON* pAcon = (ACON*)pIcon;
1717 if (istepIfAniCur >= pAcon->cicur)
1718 {
1719 ERR("NtUserDrawIconEx: istepIfAniCur too big!\n");
1720 return FALSE;
1721 }
1722 pIcon = pAcon->aspcur[pAcon->aicur[istepIfAniCur]];
1723 }
1724
1725 hbmMask = pIcon->hbmMask;
1726 hbmColor = pIcon->hbmColor;
1727 hbmAlpha = pIcon->hbmAlpha;
1728
1729 /*
1730 * Get our objects.
1731 * Shared locks are enough, we are only reading those bitmaps
1732 */
1733 psurfMask = SURFACE_ShareLockSurface(hbmMask);
1734 if (psurfMask == NULL)
1735 {
1736 ERR("Unable to lock the mask surface.\n");
1737 return FALSE;
1738 }
1739
1740 /* Color bitmap is not mandatory */
1741 if (hbmColor == NULL)
1742 {
1743 /* But then the mask bitmap must have the information in it's bottom half */
1744 ASSERT(psurfMask->SurfObj.sizlBitmap.cy == 2*pIcon->cy);
1745 psurfColor = NULL;
1746 }
1747 else if ((psurfColor = SURFACE_ShareLockSurface(hbmColor)) == NULL)
1748 {
1749 ERR("Unable to lock the color bitmap.\n");
1750 SURFACE_ShareUnlockSurface(psurfMask);
1751 return FALSE;
1752 }
1753
1754 pdc = DC_LockDc(hDc);
1755 if (!pdc)
1756 {
1757 ERR("Could not lock the destination DC.\n");
1758 SURFACE_ShareUnlockSurface(psurfMask);
1759 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
1760 return FALSE;
1761 }
1762
1763 /* Fix width parameter, if needed */
1764 if (!cxWidth)
1765 {
1766 if (diFlags & DI_DEFAULTSIZE)
1767 cxWidth = is_icon(pIcon) ?
1769 else
1770 cxWidth = pIcon->cx;
1771 }
1772
1773 /* Fix height parameter, if needed */
1774 if (!cyHeight)
1775 {
1776 if (diFlags & DI_DEFAULTSIZE)
1777 cyHeight = is_icon(pIcon) ?
1779 else
1780 cyHeight = pIcon->cy;
1781 }
1782
1783 /* Calculate destination rectangle */
1784 RECTL_vSetRect(&rcDest, xLeft, yTop, xLeft + cxWidth, yTop + cyHeight);
1785 IntLPtoDP(pdc, (LPPOINT)&rcDest, 2);
1786 RECTL_vOffsetRect(&rcDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y);
1787
1788 /* Prepare the underlying surface */
1789 DC_vPrepareDCsForBlit(pdc, &rcDest, NULL, NULL);
1790
1791 /* We now have our destination surface and rectangle */
1792 psurfDest = pdc->dclevel.pSurface;
1793
1794 if (psurfDest == NULL)
1795 {
1796 /* Empty DC */
1797 DC_vFinishBlit(pdc, NULL);
1798 DC_UnlockDc(pdc);
1799 SURFACE_ShareUnlockSurface(psurfMask);
1800 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
1801 return FALSE;
1802 }
1803
1804 /* Set source rect */
1805 RECTL_vSetRect(&rcSrc, 0, 0, pIcon->cx, pIcon->cy);
1806
1807 /* Should we render off-screen? */
1808 bOffScreen = hbrFlickerFreeDraw &&
1809 (GDI_HANDLE_GET_TYPE(hbrFlickerFreeDraw) == GDI_OBJECT_TYPE_BRUSH);
1810
1811 if (bOffScreen)
1812 {
1813 /* Yes: Allocate and paint the offscreen surface */
1814 EBRUSHOBJ eboFill;
1815 PBRUSH pbrush = BRUSH_ShareLockBrush(hbrFlickerFreeDraw);
1816
1817 TRACE("Performing off-screen rendering.\n");
1818
1819 if (!pbrush)
1820 {
1821 ERR("Failed to get brush object.\n");
1822 goto Cleanup;
1823 }
1824
1825#if 0 //We lock the hdc surface during the whole function it makes no sense to use an offscreen surface for "flicker free" drawing
1826 psurfOffScreen = SURFACE_AllocSurface(STYPE_BITMAP,
1827 cxWidth, cyHeight, psurfDest->SurfObj.iBitmapFormat,
1828 0, 0, NULL);
1829 if (!psurfOffScreen)
1830 {
1831 ERR("Failed to allocate the off-screen surface.\n");
1832 BRUSH_ShareUnlockBrush(pbrush);
1833 goto Cleanup;
1834 }
1835
1836 /* Paint the brush */
1837 EBRUSHOBJ_vInit(&eboFill, pbrush, psurfOffScreen, 0x00FFFFFF, 0, NULL);
1838 RECTL_vSetRect(&rcDest, 0, 0, cxWidth, cyHeight);
1839
1840 Ret = IntEngBitBlt(&psurfOffScreen->SurfObj,
1841 NULL,
1842 NULL,
1843 NULL,
1844 NULL,
1845 &rcDest,
1846 NULL,
1847 NULL,
1848 &eboFill.BrushObject,
1849 &pbrush->ptOrigin,
1850 ROP4_PATCOPY);
1851
1852 /* Clean up everything */
1853 EBRUSHOBJ_vCleanup(&eboFill);
1854 BRUSH_ShareUnlockBrush(pbrush);
1855
1856 if (!Ret)
1857 {
1858 ERR("Failed to paint the off-screen surface.\n");
1859 goto Cleanup;
1860 }
1861
1862 /* We now have our destination surface */
1863 psurfDest = psurfOffScreen;
1864#else
1865 pdcClipObj = (CLIPOBJ *)&pdc->co;
1866 /* Paint the brush */
1867 EBRUSHOBJ_vInit(&eboFill, pbrush, psurfDest, 0x00FFFFFF, 0, NULL);
1868
1869 Ret = IntEngBitBlt(&psurfDest->SurfObj,
1870 NULL,
1871 NULL,
1872 pdcClipObj,
1873 NULL,
1874 &rcDest,
1875 NULL,
1876 NULL,
1877 &eboFill.BrushObject,
1878 &pbrush->ptOrigin,
1879 ROP4_PATCOPY);
1880
1881 /* Clean up everything */
1882 EBRUSHOBJ_vCleanup(&eboFill);
1883 BRUSH_ShareUnlockBrush(pbrush);
1884
1885 if (!Ret)
1886 {
1887 ERR("Failed to paint the off-screen surface.\n");
1888 goto Cleanup;
1889 }
1890#endif
1891 }
1892 else
1893 {
1894 /* We directly draw to the DC */
1895 TRACE("Performing on screen rendering.\n");
1896 pdcClipObj = (CLIPOBJ *)&pdc->co;
1897 // psurfOffScreen = NULL;
1898 }
1899
1900 /* Now do the rendering */
1901 if (hbmAlpha && ((diFlags & DI_NORMAL) == DI_NORMAL))
1902 {
1903 BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } };
1904 PSURFACE psurf = NULL;
1905
1906 psurf = SURFACE_ShareLockSurface(hbmAlpha);
1907 if (!psurf)
1908 {
1909 ERR("SURFACE_LockSurface failed!\n");
1910 goto NoAlpha;
1911 }
1912
1913 /* Initialize color translation object */
1914 EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0xFFFFFFFF, 0xFFFFFFFF, 0);
1915
1916 /* Now do it */
1917 Ret = IntEngAlphaBlend(&psurfDest->SurfObj,
1918 &psurf->SurfObj,
1919 pdcClipObj,
1920 &exlo.xlo,
1921 &rcDest,
1922 &rcSrc,
1923 &blendobj);
1924
1925 EXLATEOBJ_vCleanup(&exlo);
1927 if (Ret) goto done;
1928 ERR("NtGdiAlphaBlend failed!\n");
1929 }
1930NoAlpha:
1931 if (diFlags & DI_MASK)
1932 {
1933 DWORD rop4 = (diFlags & DI_IMAGE) ? ROP4_SRCAND : ROP4_SRCCOPY;
1934
1935 EXLATEOBJ_vInitSrcMonoXlate(&exlo, psurfDest->ppal, 0x00FFFFFF, 0);
1936
1937 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1938 &psurfMask->SurfObj,
1939 NULL,
1940 pdcClipObj,
1941 &exlo.xlo,
1942 NULL,
1943 &rcDest,
1944 &rcSrc,
1945 NULL,
1946 NULL,
1947 NULL,
1948 rop4);
1949
1950 EXLATEOBJ_vCleanup(&exlo);
1951
1952 if (!Ret)
1953 {
1954 ERR("Failed to mask the bitmap data.\n");
1955 goto Cleanup;
1956 }
1957 }
1958
1959 if (diFlags & DI_IMAGE)
1960 {
1961 if (psurfColor)
1962 {
1963 DWORD rop4 = (diFlags & DI_MASK) ? ROP4_SRCINVERT : ROP4_SRCCOPY ;
1964
1965 EXLATEOBJ_vInitialize(&exlo, psurfColor->ppal, psurfDest->ppal, 0x00FFFFFF, 0x00FFFFFF, 0);
1966
1967 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1968 &psurfColor->SurfObj,
1969 NULL,
1970 pdcClipObj,
1971 &exlo.xlo,
1972 NULL,
1973 &rcDest,
1974 &rcSrc,
1975 NULL,
1976 NULL,
1977 NULL,
1978 rop4);
1979
1980 EXLATEOBJ_vCleanup(&exlo);
1981
1982 if (!Ret)
1983 {
1984 ERR("Failed to render the icon bitmap.\n");
1985 goto Cleanup;
1986 }
1987 }
1988 else
1989 {
1990 /* Mask bitmap holds the information in its bottom half */
1991 DWORD rop4 = (diFlags & DI_MASK) ? ROP4_SRCINVERT : ROP4_SRCCOPY;
1992 RECTL_vOffsetRect(&rcSrc, 0, pIcon->cy);
1993
1994 EXLATEOBJ_vInitSrcMonoXlate(&exlo, psurfDest->ppal, 0x00FFFFFF, 0);
1995
1996 Ret = IntEngStretchBlt(&psurfDest->SurfObj,
1997 &psurfMask->SurfObj,
1998 NULL,
1999 pdcClipObj,
2000 &exlo.xlo,
2001 NULL,
2002 &rcDest,
2003 &rcSrc,
2004 NULL,
2005 NULL,
2006 NULL,
2007 rop4);
2008
2009 EXLATEOBJ_vCleanup(&exlo);
2010
2011 if (!Ret)
2012 {
2013 ERR("Failed to render the icon bitmap.\n");
2014 goto Cleanup;
2015 }
2016 }
2017 }
2018
2019done:
2020#if 0
2021 /* We're done. Was it a double buffered draw ? */
2022 if (bOffScreen)
2023 {
2024 /* Yes. Draw it back to our DC */
2025 POINTL ptSrc = {0, 0};
2026
2027 /* Calculate destination rectangle */
2028 RECTL_vSetRect(&rcDest, xLeft, yTop, xLeft + cxWidth, yTop + cyHeight);
2029 IntLPtoDP(pdc, (LPPOINT)&rcDest, 2);
2030 RECTL_vOffsetRect(&rcDest, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y);
2031
2032 /* Get the clip object */
2033 pdcClipObj = pdc->rosdc.CombinedClip;
2034
2035 /* We now have our destination surface and rectangle */
2036 psurfDest = pdc->dclevel.pSurface;
2037
2038 /* Color translation */
2039 EXLATEOBJ_vInitialize(&exlo, psurfOffScreen->ppal, psurfDest->ppal, 0x00FFFFFF, 0x00FFFFFF, 0);
2040
2041 /* Blt it! */
2042 Ret = IntEngBitBlt(&psurfDest->SurfObj,
2043 &psurfOffScreen->SurfObj,
2044 NULL,
2045 pdcClipObj,
2046 &exlo.xlo,
2047 &rcDest,
2048 &ptSrc,
2049 NULL,
2050 NULL,
2051 NULL,
2052 ROP4_SRCCOPY);
2053
2054 EXLATEOBJ_vCleanup(&exlo);
2055 }
2056#endif
2057Cleanup:
2058 if (pdc)
2059 {
2060 DC_vFinishBlit(pdc, NULL);
2061 DC_UnlockDc(pdc);
2062 }
2063
2064#if 0
2065 /* Delete off screen rendering surface */
2066 if (psurfOffScreen)
2067 GDIOBJ_vDeleteObject(&psurfOffScreen->BaseObject);
2068#endif
2069
2070 /* Unlock other surfaces */
2071 SURFACE_ShareUnlockSurface(psurfMask);
2072 if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
2073
2074 return Ret;
2075}
#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
LONG cy
Definition: kdterminal.h:28
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
#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:213
#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:973
#define SM_CYCURSOR
Definition: winuser.h:975
#define SM_CXICON
Definition: winuser.h:972
#define SM_CXCURSOR
Definition: winuser.h:974
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 if ((gpsi->ptCursor.x != x) || (gpsi->ptCursor.y != y))
268 {
269 /* 1. Generate a mouse move message, this sets the htEx and Track Window too. */
270 Msg.message = WM_MOUSEMOVE;
271 Msg.wParam = UserGetMouseButtonsState();
272 Msg.lParam = MAKELPARAM(x, y);
273 Msg.pt = pt;
274 co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook);
275 }
276 /* 2. Store the new cursor position */
277 gpsi->ptCursor = pt;
278
279 return TRUE;
280}
struct @1632 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:4008
#define WM_MOUSEMOVE
Definition: winuser.h:1775

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().