/* INCLUDES ******************************************************************/
-#include "user32.h"
-#include <string.h>
-#include <stdlib.h>
+#include <user32.h>
+#define NDEBUG
#include <debug.h>
+
/* FUNCTIONS *****************************************************************/
HICON
DIB_RGB_COLORS);
/* Make ImageData point to the start of the AND image data. */
- ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
- IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
+ ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth *
+ IconImage->icHeader.biBitCount + 31) & ~31) >> 3) *
(IconImage->icHeader.biHeight );
/* Create a BITMAPINFO header for the monocrome part of the icon. */
/* Load the AND bitmap. */
IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
ImageData, bwBIH, DIB_RGB_COLORS);
-
+
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
ImageData, bwBIH, DIB_RGB_COLORS);
-
+
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
IconInfo.fIcon = FALSE;
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
-
+
/* Create a BITMAPINFO header for the monocrome part of the icon */
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
XORImageData, bwBIH, DIB_RGB_COLORS);
if (IconInfo.hbmMask)
{
- SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
+ SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS);
}
-
+
IconInfo.hbmColor = (HBITMAP)0;
-
+
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
HICON hIcon)
{
ICONINFO IconInfo;
-
+
if(NtUserGetCursorIconInfo((HANDLE)hIcon, &IconInfo))
{
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
DeleteObject(IconInfo.hbmMask);
return (HICON)0;
}
-
+
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
}
HDC hScreenDc;
WORD wXHotspot;
WORD wYHotspot;
-
+
/*
FIXME - does win support LR_SHARED? According to msdn it does but we don't
have useful information to identify the icon
/* get an safe copy of the icon data */
SafeIconImage = RtlAllocateHeap(GetProcessHeap(), 0, cbIconBits);
+ if (SafeIconImage == NULL)
+ {
+ return NULL;
+ }
memcpy(SafeIconImage, pbIconBits, cbIconBits);
-
+
/* take into acount the origonal height was for both the AND and XOR images */
if(fIcon)
SafeIconImage->icHeader.biHeight /= 2;
-
+
if (SafeIconImage->icHeader.biSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER* Core = (BITMAPCOREHEADER*)SafeIconImage;
}
else
{
- ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ?
+ ColourCount = (SafeIconImage->icHeader.biBitCount <= 8) ?
(1 << SafeIconImage->icHeader.biBitCount) : 0;
HeaderSize = sizeof(BITMAPINFOHEADER) + ColourCount * sizeof(RGBQUAD);
}
{
return (HICON)0;
}
-
+
/* FIXME - i doubt this is right (monochrome cursors */
/*if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
ColorBitmap.bmHeight != MaskBitmap.bmWidth)
SetLastError(ERROR_INVALID_PARAMETER);
return (HICON)0;
}*/
-
+
return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE);
}
HBRUSH hbrFlickerFreeDraw,
UINT diFlags)
{
- return (BOOL)NtUserDrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth,
- istepIfAniCur, hbrFlickerFreeDraw, diFlags,
+ return (BOOL)NtUserDrawIconEx(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth,
+ istepIfAniCur, hbrFlickerFreeDraw, diFlags,
0, 0);
}
DPRINT("Empty directory!\n");
return NULL;
}
- if (dir->idCount == 1)
+ if (dir->idCount == 1)
return &dir->idEntries[0]; /* No choice... */
/* Find Best Fit */
HDC hdc;
int ColorBits;
- hdc = GetDC(0);
+ hdc = CreateICW(NULL, NULL, NULL, NULL);
if (Flags & LR_MONOCHROME)
{
ColorBits = 1;
if (ColorBits > 8)
ColorBits = 8;
}
- ReleaseDC(0, hdc);
+ DeleteDC(hdc);
entry = CURSORICON_FindBestIcon( dir, cxDesired, cyDesired, ColorBits );