ReactOS 0.4.15-dev-7953-g1f49173
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 336 of file cursoricon.c.

338{
339 PCURICON_OBJECT CurIcon = Object;
340
341 if (!(CurIcon->CURSORF_flags & CURSORF_ACON))
342 {
343 HBITMAP bmpMask = CurIcon->hbmMask;
344 HBITMAP bmpColor = CurIcon->hbmColor;
345 HBITMAP bmpAlpha = CurIcon->hbmAlpha;
346
347 /* Delete bitmaps */
348 if (bmpMask)
349 {
351 NT_VERIFY(GreDeleteObject(bmpMask) == TRUE);
352 CurIcon->hbmMask = NULL;
353 }
354 if (bmpColor)
355 {
357 NT_VERIFY(GreDeleteObject(bmpColor) == TRUE);
358 CurIcon->hbmColor = NULL;
359 }
360 if (bmpAlpha)
361 {
363 NT_VERIFY(GreDeleteObject(bmpAlpha) == TRUE);
364 CurIcon->hbmAlpha = NULL;
365 }
366 }
367 else
368 {
369 PACON AniCurIcon = (PACON)CurIcon;
370 UINT i;
371
372 for (i = 0; i < AniCurIcon->cpcur; i++)
373 {
374 UserDereferenceObject(AniCurIcon->aspcur[i]);
376 }
378 }
379
380 if (CurIcon->CURSORF_flags & CURSORF_LRSHARED)
381 {
382 if (!IS_INTRESOURCE(CurIcon->strName.Buffer))
384 if (CurIcon->atomModName)
386 CurIcon->strName.Buffer = NULL;
387 CurIcon->atomModName = 0;
388 }
389
390 /* Finally free the thing */
391 FreeProcMarkObject(CurIcon);
392}
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:317
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 395 of file cursoricon.c.

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

286{
287 PCURICON_OBJECT CurIcon;
288 HANDLE hCurIcon;
289
290 CurIcon = UserCreateObject(
292 NULL,
294 &hCurIcon,
296 Animated ? sizeof(ACON) : sizeof(CURICON_OBJECT));
297
298 if (!CurIcon)
299 {
301 return FALSE;
302 }
303
304 if (Animated)
305 {
306 /* We MUST set this flag, to track whether this is an ACON! */
307 CurIcon->CURSORF_flags |= CURSORF_ACON;
308 }
309
310 NT_ASSERT(CurIcon->pcurNext == NULL);
311 UserDereferenceObject(CurIcon);
312
313 return hCurIcon;
314}
#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 317 of file cursoricon.c.

319{
320 PCURICON_OBJECT CurIcon = Object;
321
322 /* Check if the cursor is in a list */
323 if (CurIcon->CURSORF_flags & CURSORF_LINKED)
324 {
325 /* Remove the cursor from it's list */
327 }
328
329 /* We just mark the handle as being destroyed.
330 * Deleting all the stuff will be deferred to the actual struct free. */
332 return TRUE;
333}
#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 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: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 1689 of file cursoricon.c.

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