- Fix formatting. No code change

svn path=/trunk/; revision=36348
This commit is contained in:
Dmitry Chapyshev 2008-09-20 13:45:10 +00:00
parent de2b706b27
commit 47b0133272
5 changed files with 604 additions and 497 deletions

View file

@ -33,95 +33,120 @@
#include <wine/debug.h>
/* FUNCTIONS *****************************************************************/
void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo)
void
DrawCaret(HWND hWnd,
PTHRDCARETINFO CaretInfo)
{
HDC hDC, hComp;
HDC hDC, hComp;
hDC = GetDC(hWnd);
if(hDC)
{
if(CaretInfo->Bitmap && GetBitmapDimensionEx(CaretInfo->Bitmap, &CaretInfo->Size))
hDC = GetDC(hWnd);
if(hDC)
{
hComp = CreateCompatibleDC(hDC);
if(hComp)
{
SelectObject(hComp, CaretInfo->Bitmap);
BitBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, hComp, 0, 0, SRCINVERT);
DeleteDC(hComp);
}
else
PatBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, DSTINVERT);
if(CaretInfo->Bitmap && GetBitmapDimensionEx(CaretInfo->Bitmap, &CaretInfo->Size))
{
hComp = CreateCompatibleDC(hDC);
if(hComp)
{
SelectObject(hComp, CaretInfo->Bitmap);
BitBlt(hDC,
CaretInfo->Pos.x,
CaretInfo->Pos.y,
CaretInfo->Size.cx,
CaretInfo->Size.cy,
hComp,
0,
0,
SRCINVERT);
DeleteDC(hComp);
}
else
PatBlt(hDC,
CaretInfo->Pos.x,
CaretInfo->Pos.y,
CaretInfo->Size.cx,
CaretInfo->Size.cy,
DSTINVERT);
}
else
{
PatBlt(hDC,
CaretInfo->Pos.x,
CaretInfo->Pos.y,
CaretInfo->Size.cx,
CaretInfo->Size.cy,
DSTINVERT);
}
ReleaseDC(hWnd, hDC);
}
else
{
PatBlt(hDC, CaretInfo->Pos.x, CaretInfo->Pos.y, CaretInfo->Size.cx, CaretInfo->Size.cy, DSTINVERT);
}
ReleaseDC(hWnd, hDC);
}
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
CreateCaret(HWND hWnd,
HBITMAP hBitmap,
int nWidth,
int nHeight)
HBITMAP hBitmap,
int nWidth,
int nHeight)
{
return (BOOL)NtUserCreateCaret(hWnd, hBitmap, nWidth, nHeight);
return (BOOL)NtUserCreateCaret(hWnd, hBitmap, nWidth, nHeight);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
DestroyCaret(VOID)
{
return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_DESTROY_CARET);
return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_DESTROY_CARET);
}
/*
* @implemented
*/
UINT STDCALL
UINT
STDCALL
GetCaretBlinkTime(VOID)
{
return NtUserGetCaretBlinkTime();
return NtUserGetCaretBlinkTime();
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
GetCaretPos(LPPOINT lpPoint)
{
return (BOOL)NtUserGetCaretPos(lpPoint);
return (BOOL)NtUserGetCaretPos(lpPoint);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
SetCaretBlinkTime(UINT uMSeconds)
{
return NtUserSetCaretBlinkTime(uMSeconds);
return NtUserSetCaretBlinkTime(uMSeconds);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
SetCaretPos(int X,
int Y)
int Y)
{
return NtUserSetCaretPos(X, Y);
return NtUserSetCaretPos(X, Y);
}
/* EOF */

View file

@ -26,17 +26,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32);
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
OpenClipboard(HWND hWndNewOwner)
{
BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0);
BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0);
return ret;
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
CloseClipboard(VOID)
{
BOOL ret;
@ -47,7 +49,8 @@ CloseClipboard(VOID)
/*
* @implemented
*/
INT STDCALL
INT
STDCALL
CountClipboardFormats(VOID)
{
INT ret = NtUserCountClipboardFormats();
@ -57,7 +60,8 @@ CountClipboardFormats(VOID)
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
EmptyClipboard(VOID)
{
return NtUserEmptyClipboard();
@ -66,7 +70,8 @@ EmptyClipboard(VOID)
/*
* @implemented
*/
UINT STDCALL
UINT
STDCALL
EnumClipboardFormats(UINT format)
{
UINT ret = NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS);
@ -76,7 +81,8 @@ EnumClipboardFormats(UINT format)
/*
* @implemented
*/
HANDLE STDCALL
HANDLE
STDCALL
GetClipboardData(UINT uFormat)
{
HGLOBAL hGlobal = NULL;
@ -109,8 +115,11 @@ GetClipboardData(UINT uFormat)
/*
* @implemented
*/
INT STDCALL
GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
INT
STDCALL
GetClipboardFormatNameA(UINT format,
LPSTR lpszFormatName,
int cchMaxCount)
{
LPWSTR lpBuffer;
UNICODE_STRING FormatName;
@ -123,32 +132,35 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
return 0;
}
FormatName.Length = 0;
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
FormatName.Buffer = lpBuffer;
FormatName.Length = 0;
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
FormatName.Buffer = lpBuffer;
/* we need a UNICODE string */
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
if (Length != 0)
{
if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount, NULL, NULL))
{
/* clear result string */
Length = 0;
}
lpszFormatName[Length] = '\0';
}
if (Length != 0)
{
if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount, NULL, NULL))
{
/* clear result string */
Length = 0;
}
lpszFormatName[Length] = '\0';
}
RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
return Length;
RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
return Length;
}
/*
* @implemented
*/
INT STDCALL
GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
INT
STDCALL
GetClipboardFormatNameW(UINT format,
LPWSTR lpszFormatName,
INT cchMaxCount)
{
UNICODE_STRING FormatName;
ULONG Ret;
@ -164,43 +176,48 @@ GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
/*
* @implemented
*/
HWND STDCALL
HWND
STDCALL
GetClipboardOwner(VOID)
{
return NtUserGetClipboardOwner();
return NtUserGetClipboardOwner();
}
/*
* @implemented
*/
DWORD STDCALL
DWORD
STDCALL
GetClipboardSequenceNumber(VOID)
{
return NtUserGetClipboardSequenceNumber();
return NtUserGetClipboardSequenceNumber();
}
/*
* @implemented
*/
HWND STDCALL
HWND
STDCALL
GetClipboardViewer(VOID)
{
return NtUserGetClipboardViewer();
return NtUserGetClipboardViewer();
}
/*
* @implemented
*/
HWND STDCALL
HWND
STDCALL
GetOpenClipboardWindow(VOID)
{
return NtUserGetOpenClipboardWindow();
return NtUserGetOpenClipboardWindow();
}
/*
* @implemented
*/
INT STDCALL
INT
STDCALL
GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
{
INT ret = NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats);
@ -210,7 +227,8 @@ GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
IsClipboardFormatAvailable(UINT format)
{
BOOL ret = NtUserIsClipboardFormatAvailable(format);
@ -221,7 +239,8 @@ IsClipboardFormatAvailable(UINT format)
* @implemented
*/
UINT STDCALL
UINT
STDCALL
RegisterClipboardFormatA(LPCSTR lpszFormat)
{
UINT ret = 0;
@ -253,7 +272,8 @@ RegisterClipboardFormatA(LPCSTR lpszFormat)
/*
* @implemented
*/
UINT STDCALL
UINT
STDCALL
RegisterClipboardFormatW(LPCWSTR lpszFormat)
{
UINT ret = 0;
@ -278,71 +298,73 @@ RegisterClipboardFormatW(LPCWSTR lpszFormat)
return ret;
}
HGLOBAL renderLocale (DWORD Locale)
HGLOBAL
renderLocale(DWORD Locale)
{
DWORD* pLocale;
HGLOBAL hGlobal;
DWORD* pLocale;
HGLOBAL hGlobal;
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD));
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD));
if(!hGlobal)
{
return hGlobal;
}
if(!hGlobal)
{
return hGlobal;
}
pLocale = (DWORD*)GlobalLock(hGlobal);
*pLocale = Locale;
*pLocale = Locale;
GlobalUnlock(hGlobal);
GlobalUnlock(hGlobal);
return hGlobal;
return hGlobal;
}
/*
* @implemented
*/
HANDLE STDCALL
HANDLE
STDCALL
SetClipboardData(UINT uFormat, HANDLE hMem)
{
DWORD size;
LPVOID pMem;
HANDLE ret = NULL;
DWORD size;
LPVOID pMem;
HANDLE ret = NULL;
if (hMem == NULL)
{
return NtUserSetClipboardData(uFormat, 0, 0);
if (hMem == NULL)
{
return NtUserSetClipboardData(uFormat, 0, 0);
}
if (uFormat == CF_BITMAP)
{
/* GlobalLock should return 0 for GDI handles
pMem = GlobalLock(hMem);
if (pMem)
{
// not a GDI handle
GlobalUnlock(hMem);
return ret;
}
else
{
*/
/* check if this GDI handle is a HBITMAP */
/* GetObject for HBITMAP not implemented in ReactOS */
//if (GetObject(hMem, 0, NULL) == sifeof(BITMAP))
//{
return NtUserSetClipboardData(CF_BITMAP, hMem, 0);
//}
/*}*/
}
if (uFormat == CF_BITMAP)
{
/* GlobalLock should return 0 for GDI handles
pMem = GlobalLock(hMem);
if (pMem)
{
// not a GDI handle
GlobalUnlock(hMem);
return ret;
}
else
{
*/
/* check if this GDI handle is a HBITMAP */
/* GetObject for HBITMAP not implemented in ReactOS */
//if (GetObject(hMem, 0, NULL) == sifeof(BITMAP))
//{
return NtUserSetClipboardData(CF_BITMAP, hMem, 0);
//}
/*}*/
}
size = GlobalSize(hMem);
pMem = GlobalLock(hMem);
if ((pMem) && (size))
{
size = GlobalSize(hMem);
ret = NtUserSetClipboardData(uFormat, pMem, size);
if ((pMem) && (size))
{
size = GlobalSize(hMem);
ret = NtUserSetClipboardData(uFormat, pMem, size);
//should i unlock hMem?
GlobalUnlock(hMem);
}
@ -358,25 +380,29 @@ SetClipboardData(UINT uFormat, HANDLE hMem)
/*
* @implemented
*/
HWND STDCALL
HWND
STDCALL
SetClipboardViewer(HWND hWndNewViewer)
{
return NtUserSetClipboardViewer(hWndNewViewer);
return NtUserSetClipboardViewer(hWndNewViewer);
}
/*
* @implemented
*/
BOOL STDCALL
ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext)
BOOL
STDCALL
ChangeClipboardChain(HWND hWndRemove,
HWND hWndNewNext)
{
return NtUserChangeClipboardChain(hWndRemove, hWndNewNext);
return NtUserChangeClipboardChain(hWndRemove, hWndNewNext);
}
/*
* @unimplemented
*/
BOOL STDCALL
BOOL
STDCALL
AddClipboardFormatListener(HWND hwnd)
{
UNIMPLEMENTED;
@ -385,7 +411,8 @@ AddClipboardFormatListener(HWND hwnd)
/*
* @unimplemented
*/
BOOL STDCALL
BOOL
STDCALL
RemoveClipboardFormatListener(HWND hwnd)
{
UNIMPLEMENTED;
@ -395,11 +422,11 @@ RemoveClipboardFormatListener(HWND hwnd)
/*
* @unimplemented
*/
BOOL STDCALL
GetUpdatedClipboardFormats(
PUINT lpuiFormats,
UINT cFormats,
PUINT pcFormatsOut)
BOOL
STDCALL
GetUpdatedClipboardFormats(PUINT lpuiFormats,
UINT cFormats,
PUINT pcFormatsOut)
{
UNIMPLEMENTED;
return FALSE;

View file

@ -42,25 +42,27 @@ CopyBitmap(HBITMAP bmp);
/* INTERNAL ******************************************************************/
/* This callback routine is called directly after switching to gui mode */
NTSTATUS STDCALL
User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
NTSTATUS
STDCALL
User32SetupDefaultCursors(PVOID Arguments,
ULONG ArgumentLength)
{
BOOL *DefaultCursor = (BOOL*)Arguments;
LRESULT Result = TRUE;
BOOL *DefaultCursor = (BOOL*)Arguments;
LRESULT Result = TRUE;
if(*DefaultCursor)
{
/* set default cursor */
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
}
else
{
/* FIXME load system cursor scheme */
SetCursor(0);
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
}
if(*DefaultCursor)
{
/* set default cursor */
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
}
else
{
/* FIXME load system cursor scheme */
SetCursor(0);
SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW));
}
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
/* FUNCTIONS *****************************************************************/
@ -69,199 +71,85 @@ User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
/*
* @implemented
*/
HCURSOR STDCALL
HCURSOR
STDCALL
CopyCursor(HCURSOR pcur)
{
ICONINFO IconInfo;
ICONINFO IconInfo;
if(GetIconInfo((HANDLE)pcur, &IconInfo))
{
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
return (HCURSOR)0;
}
/*
* @implemented
*/
HCURSOR STDCALL
CreateCursor(HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
CONST VOID *pvANDPlane,
CONST VOID *pvXORPlane)
{
ICONINFO IconInfo;
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
HDC hScreenDc;
hScreenDc = CreateCompatibleDC(NULL);
if (hScreenDc == NULL)
return NULL;
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = nWidth;
bwBIH->bmiHeader.biHeight = -nHeight * 2;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = 0;
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0,
NULL, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask)
{
SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight,
pvXORPlane, bwBIH, DIB_RGB_COLORS);
SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight,
pvANDPlane, bwBIH, DIB_RGB_COLORS);
}
else
{
return NULL;
}
DeleteDC(hScreenDc);
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotSpot;
IconInfo.yHotspot = yHotSpot;
IconInfo.hbmColor = 0;
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
/*
* @implemented
*/
BOOL STDCALL
DestroyCursor(HCURSOR hCursor)
{
return (BOOL)NtUserDestroyCursor((HANDLE)hCursor, 0);
}
/*
* @implemented
*/
BOOL STDCALL
GetClipCursor(LPRECT lpRect)
{
return NtUserGetClipCursor(lpRect);
}
/*
* @implemented
*/
HCURSOR STDCALL
GetCursor(VOID)
{
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if(NtUserGetCursorInfo(&ci))
return ci.hCursor;
else
if(GetIconInfo((HANDLE)pcur, &IconInfo))
{
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
return (HCURSOR)0;
}
/*
* @implemented
*/
BOOL STDCALL
GetCursorInfo(PCURSORINFO pci)
HCURSOR
STDCALL
CreateCursor(HINSTANCE hInst,
int xHotSpot,
int yHotSpot,
int nWidth,
int nHeight,
CONST VOID *pvANDPlane,
CONST VOID *pvXORPlane)
{
return (BOOL)NtUserGetCursorInfo(pci);
}
ICONINFO IconInfo;
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
HDC hScreenDc;
hScreenDc = CreateCompatibleDC(NULL);
if (hScreenDc == NULL)
return NULL;
/*
* @implemented
*/
BOOL STDCALL
GetCursorPos(LPPOINT lpPoint)
{
BOOL res;
/* Windows doesn't check if lpPoint == NULL, we do */
if(!lpPoint)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = nWidth;
bwBIH->bmiHeader.biHeight = -nHeight * 2;
bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bwBIH->bmiHeader.biPlanes = 1;
bwBIH->bmiHeader.biSizeImage = 0;
bwBIH->bmiHeader.biCompression = BI_RGB;
bwBIH->bmiHeader.biClrImportant = 0;
bwBIH->bmiHeader.biClrUsed = 0;
bwBIH->bmiHeader.biXPelsPerMeter = 0;
bwBIH->bmiHeader.biYPelsPerMeter = 0;
res = NtUserGetCursorPos(lpPoint);
bwBIH->bmiColors[0].rgbBlue = 0;
bwBIH->bmiColors[0].rgbGreen = 0;
bwBIH->bmiColors[0].rgbRed = 0;
bwBIH->bmiColors[0].rgbReserved = 0;
return res;
}
bwBIH->bmiColors[1].rgbBlue = 0xff;
bwBIH->bmiColors[1].rgbGreen = 0xff;
bwBIH->bmiColors[1].rgbRed = 0xff;
bwBIH->bmiColors[1].rgbReserved = 0;
IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0,
NULL, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask)
{
SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight,
pvXORPlane, bwBIH, DIB_RGB_COLORS);
SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight,
pvANDPlane, bwBIH, DIB_RGB_COLORS);
}
else
{
return NULL;
}
/*
* @implemented
*/
HCURSOR STDCALL
LoadCursorA(HINSTANCE hInstance,
LPCSTR lpCursorName)
{
return(LoadImageA(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE));
}
DeleteDC(hScreenDc);
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotSpot;
IconInfo.yHotspot = yHotSpot;
IconInfo.hbmColor = 0;
/*
* @implemented
*/
HCURSOR STDCALL
LoadCursorFromFileA(LPCSTR lpFileName)
{
UNICODE_STRING FileName;
HCURSOR Result;
RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
Result = LoadImageW(0, FileName.Buffer, IMAGE_CURSOR, 0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE);
RtlFreeUnicodeString(&FileName);
return(Result);
}
/*
* @implemented
*/
HCURSOR STDCALL
LoadCursorFromFileW(LPCWSTR lpFileName)
{
return(LoadImageW(0, lpFileName, IMAGE_CURSOR, 0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE));
}
/*
* @implemented
*/
HCURSOR STDCALL
LoadCursorW(HINSTANCE hInstance,
LPCWSTR lpCursorName)
{
return(LoadImageW(hInstance, lpCursorName, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE));
return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
@ -270,69 +158,214 @@ LoadCursorW(HINSTANCE hInstance,
*/
BOOL
STDCALL
ClipCursor(
CONST RECT *lpRect)
DestroyCursor(HCURSOR hCursor)
{
return NtUserClipCursor((RECT *)lpRect);
return (BOOL)NtUserDestroyCursor((HANDLE)hCursor, 0);
}
/*
* @implemented
*/
HCURSOR STDCALL
BOOL
STDCALL
GetClipCursor(LPRECT lpRect)
{
return NtUserGetClipCursor(lpRect);
}
/*
* @implemented
*/
HCURSOR
STDCALL
GetCursor(VOID)
{
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if(NtUserGetCursorInfo(&ci))
return ci.hCursor;
else
return (HCURSOR)0;
}
/*
* @implemented
*/
BOOL
STDCALL
GetCursorInfo(PCURSORINFO pci)
{
return (BOOL)NtUserGetCursorInfo(pci);
}
/*
* @implemented
*/
BOOL
STDCALL
GetCursorPos(LPPOINT lpPoint)
{
BOOL res;
/* Windows doesn't check if lpPoint == NULL, we do */
if(!lpPoint)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
res = NtUserGetCursorPos(lpPoint);
return res;
}
/*
* @implemented
*/
HCURSOR
STDCALL
LoadCursorA(HINSTANCE hInstance,
LPCSTR lpCursorName)
{
return(LoadImageA(hInstance,
lpCursorName,
IMAGE_CURSOR,
0,
0,
LR_SHARED | LR_DEFAULTSIZE));
}
/*
* @implemented
*/
HCURSOR
STDCALL
LoadCursorFromFileA(LPCSTR lpFileName)
{
UNICODE_STRING FileName;
HCURSOR Result;
RtlCreateUnicodeStringFromAsciiz(&FileName, (LPSTR)lpFileName);
Result = LoadImageW(0,
FileName.Buffer,
IMAGE_CURSOR,
0,
0,
LR_LOADFROMFILE | LR_DEFAULTSIZE);
RtlFreeUnicodeString(&FileName);
return(Result);
}
/*
* @implemented
*/
HCURSOR
STDCALL
LoadCursorFromFileW(LPCWSTR lpFileName)
{
return(LoadImageW(0,
lpFileName,
IMAGE_CURSOR,
0,
0,
LR_LOADFROMFILE | LR_DEFAULTSIZE));
}
/*
* @implemented
*/
HCURSOR
STDCALL
LoadCursorW(HINSTANCE hInstance,
LPCWSTR lpCursorName)
{
return(LoadImageW(hInstance,
lpCursorName,
IMAGE_CURSOR,
0,
0,
LR_SHARED | LR_DEFAULTSIZE));
}
/*
* @implemented
*/
BOOL
STDCALL
ClipCursor(CONST RECT *lpRect)
{
return NtUserClipCursor((RECT *)lpRect);
}
/*
* @implemented
*/
HCURSOR
STDCALL
SetCursor(HCURSOR hCursor)
{
return NtUserSetCursor(hCursor);
return NtUserSetCursor(hCursor);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
SetCursorPos(int X,
int Y)
int Y)
{
INPUT Input;
INPUT Input;
Input.type = INPUT_MOUSE;
Input.mi.dx = (LONG)X;
Input.mi.dy = (LONG)Y;
Input.mi.mouseData = 0;
Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
Input.mi.time = 0;
Input.mi.dwExtraInfo = 0;
Input.type = INPUT_MOUSE;
Input.mi.dx = (LONG)X;
Input.mi.dy = (LONG)Y;
Input.mi.mouseData = 0;
Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
Input.mi.time = 0;
Input.mi.dwExtraInfo = 0;
NtUserSendInput(1, &Input, sizeof(INPUT));
return TRUE;
NtUserSendInput(1, &Input, sizeof(INPUT));
return TRUE;
}
/*
* @unimplemented
*/
BOOL STDCALL
BOOL
STDCALL
SetSystemCursor(HCURSOR hcur,
DWORD id)
DWORD id)
{
UNIMPLEMENTED;
return FALSE;
UNIMPLEMENTED;
return FALSE;
}
/*
* @implemented
*/
int STDCALL
int
STDCALL
ShowCursor(BOOL bShow)
{
return NtUserShowCursor(bShow);
return NtUserShowCursor(bShow);
}
HCURSOR
CursorIconToCursor(HICON hIcon, BOOL SemiTransparent)
CursorIconToCursor(HICON hIcon,
BOOL SemiTransparent)
{
UNIMPLEMENTED;
return 0;
UNIMPLEMENTED;
return 0;
}

View file

@ -39,10 +39,9 @@
*/
HDC
STDCALL
GetDC(
HWND hWnd)
GetDC(HWND hWnd)
{
return NtUserGetDC(hWnd);
return NtUserGetDC(hWnd);
}
@ -51,12 +50,11 @@ GetDC(
*/
HDC
STDCALL
GetDCEx(
HWND hWnd,
HRGN hrgnClip,
DWORD flags)
GetDCEx(HWND hWnd,
HRGN hrgnClip,
DWORD flags)
{
return NtUserGetDCEx(hWnd, hrgnClip, flags);
return NtUserGetDCEx(hWnd, hrgnClip, flags);
}
@ -65,32 +63,32 @@ GetDCEx(
*/
HDC
STDCALL
GetWindowDC(
HWND hWnd)
GetWindowDC(HWND hWnd)
{
return (HDC)NtUserGetWindowDC(hWnd);
return (HDC)NtUserGetWindowDC(hWnd);
}
BOOL STDCALL GdiReleaseDC(HDC hdc);
BOOL
STDCALL
GdiReleaseDC(HDC hdc);
/*
* @implemented
*/
int
STDCALL
ReleaseDC(
HWND hWnd,
HDC hDC)
ReleaseDC(HWND hWnd,
HDC hDC)
{
// From msdn: if the DC was not released return zero.
// if the DC was released return one.
// From msdn: if the DC was not released return zero.
// if the DC was released return one.
if (!hDC) return FALSE; // Null hDC return zero.
if (!hDC) return FALSE; // Null hDC return zero.
GdiReleaseDC ( hDC ); // Release locals.
// Win 3.1 throw back, hWnd is ignored and not used.
return NtUserCallOneParam( (DWORD) hDC, ONEPARAM_ROUTINE_RELEASEDC);
GdiReleaseDC ( hDC ); // Release locals.
// Win 3.1 throw back, hWnd is ignored and not used.
return NtUserCallOneParam((DWORD) hDC, ONEPARAM_ROUTINE_RELEASEDC);
}
@ -99,8 +97,7 @@ ReleaseDC(
*/
HWND
STDCALL
WindowFromDC(
HDC hDC)
WindowFromDC(HDC hDC)
{
return NtUserWindowFromDC(hDC);
return NtUserWindowFromDC(hDC);
}

View file

@ -37,202 +37,227 @@
/*
* @implemented
*/
BOOL STDCALL
CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc)
BOOL
STDCALL
CopyRect(LPRECT lprcDst,
CONST RECT *lprcSrc)
{
if(lprcDst == NULL || lprcSrc == NULL)
return(FALSE);
if(lprcDst == NULL || lprcSrc == NULL)
return(FALSE);
*lprcDst = *lprcSrc;
return(TRUE);
*lprcDst = *lprcSrc;
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
EqualRect(
CONST RECT *lprc1,
CONST RECT *lprc2)
BOOL
STDCALL
EqualRect(CONST RECT *lprc1,
CONST RECT *lprc2)
{
if (lprc1 == NULL || lprc2 == NULL)
return FALSE;
if (lprc1 == NULL || lprc2 == NULL)
return FALSE;
return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) &&
(lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom);
return (lprc1->left == lprc2->left) && (lprc1->top == lprc2->top) &&
(lprc1->right == lprc2->right) && (lprc1->bottom == lprc2->bottom);
}
/*
* @implemented
*/
BOOL STDCALL
InflateRect(LPRECT rect, int dx, int dy)
BOOL
STDCALL
InflateRect(LPRECT rect,
int dx,
int dy)
{
rect->left -= dx;
rect->top -= dy;
rect->right += dx;
rect->bottom += dy;
return(TRUE);
rect->left -= dx;
rect->top -= dy;
rect->right += dx;
rect->bottom += dy;
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
IntersectRect(LPRECT lprcDst,
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
{
if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) ||
lprcSrc1->left >= lprcSrc2->right ||
lprcSrc2->left >= lprcSrc1->right ||
lprcSrc1->top >= lprcSrc2->bottom ||
lprcSrc2->top >= lprcSrc1->bottom)
if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) ||
lprcSrc1->left >= lprcSrc2->right ||
lprcSrc2->left >= lprcSrc1->right ||
lprcSrc1->top >= lprcSrc2->bottom ||
lprcSrc2->top >= lprcSrc1->bottom)
{
SetRectEmpty(lprcDst);
return(FALSE);
SetRectEmpty(lprcDst);
return(FALSE);
}
lprcDst->left = max(lprcSrc1->left, lprcSrc2->left);
lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
return(TRUE);
lprcDst->left = max(lprcSrc1->left, lprcSrc2->left);
lprcDst->right = min(lprcSrc1->right, lprcSrc2->right);
lprcDst->top = max(lprcSrc1->top, lprcSrc2->top);
lprcDst->bottom = min(lprcSrc1->bottom, lprcSrc2->bottom);
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
IsRectEmpty(CONST RECT *lprc)
{
return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom));
return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom));
}
/*
* @implemented
*/
BOOL STDCALL
OffsetRect(LPRECT rect, int dx, int dy)
BOOL
STDCALL
OffsetRect(LPRECT rect,
int dx,
int dy)
{
if(rect == NULL)
return(FALSE);
if(rect == NULL)
return(FALSE);
rect->left += dx;
rect->top += dy;
rect->right += dx;
rect->bottom += dy;
return(TRUE);
rect->left += dx;
rect->top += dy;
rect->right += dx;
rect->bottom += dy;
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
PtInRect(CONST RECT *lprc, POINT pt)
BOOL
STDCALL
PtInRect(CONST RECT *lprc,
POINT pt)
{
return((pt.x >= lprc->left) && (pt.x < lprc->right) &&
(pt.y >= lprc->top) && (pt.y < lprc->bottom));
return((pt.x >= lprc->left) && (pt.x < lprc->right) &&
(pt.y >= lprc->top) && (pt.y < lprc->bottom));
}
BOOL STDCALL
SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
BOOL
STDCALL
SetRect(LPRECT lprc,
int xLeft,
int yTop,
int xRight,
int yBottom)
{
lprc->left = xLeft;
lprc->top = yTop;
lprc->right = xRight;
lprc->bottom = yBottom;
return(TRUE);
lprc->left = xLeft;
lprc->top = yTop;
lprc->right = xRight;
lprc->bottom = yBottom;
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
BOOL
STDCALL
SetRectEmpty(LPRECT lprc)
{
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
{
RECT tempRect;
if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL)
return(FALSE);
CopyRect(lprcDst, lprcSrc1);
if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2))
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
return(TRUE);
if (EqualRect(&tempRect, lprcDst))
{
SetRectEmpty(lprcDst);
return FALSE;
}
if(lprcDst->top == tempRect.top && lprcDst->bottom == tempRect.bottom)
{
if(lprcDst->left == tempRect.left)
lprcDst->left = tempRect.right;
else if(lprcDst->right == tempRect.right)
lprcDst->right = tempRect.left;
}
else if(lprcDst->left == tempRect.left && lprcDst->right == tempRect.right)
{
if(lprcDst->top == tempRect.top)
lprcDst->top = tempRect.bottom;
else if(lprcDst->right == tempRect.right)
lprcDst->right = tempRect.left;
}
return(TRUE);
}
/*
* @implemented
*/
BOOL STDCALL
UnionRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
BOOL
STDCALL
SubtractRect(LPRECT lprcDst,
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
{
if (IsRectEmpty(lprcSrc1))
RECT tempRect;
if(lprcDst == NULL || lprcSrc1 == NULL || lprcSrc2 == NULL)
return(FALSE);
CopyRect(lprcDst, lprcSrc1);
if(!IntersectRect(&tempRect, lprcSrc1, lprcSrc2))
return(TRUE);
if (EqualRect(&tempRect, lprcDst))
{
if (IsRectEmpty(lprcSrc2))
{
SetRectEmpty(lprcDst);
return(FALSE);
}
else
{
*lprcDst = *lprcSrc2;
}
SetRectEmpty(lprcDst);
return FALSE;
}
else
if(lprcDst->top == tempRect.top && lprcDst->bottom == tempRect.bottom)
{
if (IsRectEmpty(lprcSrc2))
{
*lprcDst = *lprcSrc1;
}
else
{
lprcDst->left = min(lprcSrc1->left, lprcSrc2->left);
lprcDst->top = min(lprcSrc1->top, lprcSrc2->top);
lprcDst->right = max(lprcSrc1->right, lprcSrc2->right);
lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom);
}
if(lprcDst->left == tempRect.left)
lprcDst->left = tempRect.right;
else if(lprcDst->right == tempRect.right)
lprcDst->right = tempRect.left;
}
return(TRUE);
else if(lprcDst->left == tempRect.left && lprcDst->right == tempRect.right)
{
if(lprcDst->top == tempRect.top)
lprcDst->top = tempRect.bottom;
else if(lprcDst->right == tempRect.right)
lprcDst->right = tempRect.left;
}
return(TRUE);
}
/*
* @implemented
*/
BOOL
STDCALL
UnionRect(LPRECT lprcDst,
CONST RECT *lprcSrc1,
CONST RECT *lprcSrc2)
{
if (IsRectEmpty(lprcSrc1))
{
if (IsRectEmpty(lprcSrc2))
{
SetRectEmpty(lprcDst);
return(FALSE);
}
else
{
*lprcDst = *lprcSrc2;
}
}
else
{
if (IsRectEmpty(lprcSrc2))
{
*lprcDst = *lprcSrc1;
}
else
{
lprcDst->left = min(lprcSrc1->left, lprcSrc2->left);
lprcDst->top = min(lprcSrc1->top, lprcSrc2->top);
lprcDst->right = max(lprcSrc1->right, lprcSrc2->right);
lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom);
}
}
return(TRUE);
}