3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * PROJECT: ReactOS user32.dll
22 * FILE: lib/user32/windows/cursor.c
24 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
26 * 09-05-2001 CSH Created
29 /* INCLUDES ******************************************************************/
36 /* INTERNAL ******************************************************************/
38 /* This callback routine is called directly after switching to gui mode */
40 User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
42 LRESULT Result = TRUE;
43 /* FIXME load system cursor scheme */
45 return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
48 /* FUNCTIONS *****************************************************************/
55 CopyCursor(HCURSOR pcur)
66 CreateCursor(HINSTANCE hInst,
71 CONST VOID *pvANDPlane,
72 CONST VOID *pvXORPlane)
84 DestroyCursor(HCURSOR hCursor)
95 GetClipCursor(LPRECT lpRect)
102 SetLastError(ERROR_NOACCESS);
106 RtlCopyMemory(&rc, lpRect, sizeof(RECT));
107 res = NtUserGetClipCursor(&rc);
108 RtlCopyMemory(lpRect, &rc, sizeof(RECT));
129 GetCursorInfo(PCURSORINFO pci)
140 GetCursorPos(LPPOINT lpPoint)
144 /* Windows doesn't check if lpPoint == NULL, we do */
147 SetLastError(ERROR_INVALID_PARAMETER);
151 res = (WINBOOL)NtUserCallTwoParam((DWORD)&pos, (DWORD)FALSE,
152 TWOPARAM_ROUTINE_CURSORPOSITION);
166 LoadCursorA(HINSTANCE hInstance,
169 return(LoadImageA(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0,
178 LoadCursorFromFileA(LPCSTR lpFileName)
180 UNICODE_STRING FileName;
182 RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
183 Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0,
184 LR_LOADFROMFILE | LR_DEFAULTSIZE);
185 RtlFreeUnicodeString(&FileName);
194 LoadCursorFromFileW(LPCWSTR lpFileName)
196 return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0,
197 LR_LOADFROMFILE | LR_DEFAULTSIZE));
205 LoadCursorW(HINSTANCE hInstance,
206 LPCWSTR lpCursorName)
208 return(LoadImageW(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0,
224 RtlCopyMemory(&rc, lpRect, sizeof(RECT));
225 return NtUserClipCursor(&rc);
228 return NtUserClipCursor(NULL);
236 SetCursor(HCURSOR hCursor)
253 return (WINBOOL)NtUserCallTwoParam((DWORD)&pos, (DWORD)TRUE,
254 TWOPARAM_ROUTINE_CURSORPOSITION);
262 SetSystemCursor(HCURSOR hcur,
274 ShowCursor(WINBOOL bShow)
281 CursorIconToCursor(HICON hIcon, BOOL SemiTransparent)