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/input.c
24 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
26 * 09-05-2001 CSH Created
29 /* INCLUDES ******************************************************************/
33 #include <wine/debug.h>
34 WINE_DEFAULT_DEBUG_CHANNEL(user32
);
47 } CURSORICONFILEDIRENTRY
;
54 CURSORICONFILEDIRENTRY idEntries
[1];
59 /*forward declerations... actualy in user32\windows\icon.c but usful here****/
60 HICON
ICON_CreateCursorFromData(HDC hDC
, PVOID ImageData
, ICONIMAGE
* IconImage
, int cxDesired
, int cyDesired
, int xHotspot
, int yHotspot
);
61 HICON
ICON_CreateIconFromData(HDC hDC
, PVOID ImageData
, ICONIMAGE
* IconImage
, int cxDesired
, int cyDesired
, int xHotspot
, int yHotspot
);
62 CURSORICONDIRENTRY
*CURSORICON_FindBestIcon( CURSORICONDIR
*dir
, int width
, int height
, int colors
);
63 CURSORICONDIRENTRY
*CURSORICON_FindBestCursor( CURSORICONDIR
*dir
, int width
, int height
, int colors
);
65 /* FUNCTIONS *****************************************************************/
71 LoadImageA(HINSTANCE hinst
,
80 UNICODE_STRING NameString
;
84 RtlCreateUnicodeStringFromAsciiz(&NameString
, (LPSTR
)lpszName
);
85 lpszWName
= NameString
.Buffer
;
86 Handle
= LoadImageW(hinst
, lpszWName
, uType
, cxDesired
,
88 RtlFreeUnicodeString(&NameString
);
92 Handle
= LoadImageW(hinst
, (LPCWSTR
)lpszName
, uType
, cxDesired
,
101 * The following macro functions account for the irregularities of
102 * accessing cursor and icon resources in files and resource entries.
104 typedef BOOL (*fnGetCIEntry
)( LPVOID dir
, int n
,
105 int *width
, int *height
, int *bits
);
107 /**********************************************************************
108 * CURSORICON_FindBestCursor2
110 * Find the cursor closest to the requested size.
111 * FIXME: parameter 'color' ignored and entries with more than 1 bpp
114 static int CURSORICON_FindBestCursor2( LPVOID dir
, fnGetCIEntry get_entry
,
115 int width
, int height
, int color
)
117 int i
, maxwidth
, maxheight
, cx
, cy
, bits
, bestEntry
= -1;
119 /* Double height to account for AND and XOR masks */
123 /* First find the largest one smaller than or equal to the requested size*/
125 maxwidth
= maxheight
= 0;
126 for ( i
= 0; get_entry( dir
, i
, &cx
, &cy
, &bits
); i
++ )
128 if ((cx
<= width
) && (cy
<= height
) &&
129 (cx
> maxwidth
) && (cy
> maxheight
) &&
137 if (bestEntry
!= -1) return bestEntry
;
139 /* Now find the smallest one larger than the requested size */
141 maxwidth
= maxheight
= 255;
142 for ( i
= 0; get_entry( dir
, i
, &cx
, &cy
, &bits
); i
++ )
144 if (((cx
< maxwidth
) && (cy
< maxheight
) && (bits
== 1)) ||
156 static BOOL
CURSORICON_GetFileEntry( LPVOID dir
, int n
,
157 int *width
, int *height
, int *bits
)
159 CURSORICONFILEDIR
*filedir
= dir
;
160 CURSORICONFILEDIRENTRY
*entry
;
162 if ( filedir
->idCount
<= n
)
164 entry
= &filedir
->idEntries
[n
];
165 *width
= entry
->bWidth
;
166 *height
= entry
->bHeight
;
167 *bits
= entry
->bColorCount
;
171 static CURSORICONFILEDIRENTRY
*CURSORICON_FindBestCursorFile( CURSORICONFILEDIR
*dir
,
172 int width
, int height
, int color
)
174 int n
= CURSORICON_FindBestCursor2( dir
, CURSORICON_GetFileEntry
,
175 width
, height
, color
);
178 return &dir
->idEntries
[n
];
194 CURSORICONFILEDIR
*IconDIR
;
201 CURSORICONFILEDIRENTRY
* dirEntry
;
202 ICONIMAGE
* SafeIconImage
= NULL
;
203 GRPCURSORICONDIR
* IconResDir
;
206 BOOL Icon
= (uType
== IMAGE_ICON
);
209 if (!(fuLoad
& LR_LOADFROMFILE
))
212 hinst
= User32Instance
;
214 hResInfo
= FindResourceW(hinst
, lpszName
,
215 Icon
? RT_GROUP_ICON
: RT_GROUP_CURSOR
);
216 if (hResInfo
== NULL
)
219 hResource
= LoadResource(hinst
, hResInfo
);
220 if (hResource
== NULL
)
223 IconResDir
= LockResource(hResource
);
224 if (IconResDir
== NULL
)
229 /* Find the best fitting in the IconResDir for this resolution */
230 id
= LookupIconIdFromDirectoryEx((PBYTE
)IconResDir
, Icon
, width
, height
,
231 fuLoad
& (LR_DEFAULTCOLOR
| LR_MONOCHROME
));
233 hResInfo
= FindResourceW(hinst
, MAKEINTRESOURCEW(id
),
234 Icon
? (LPCWSTR
) RT_ICON
:
235 (LPCWSTR
) RT_CURSOR
);
236 if (hResInfo
== NULL
)
241 /* Now we have found the icon we want to load.
242 * Let's see if we already loaded it */
243 if (fuLoad
& LR_SHARED
)
245 hIcon
= NtUserFindExistingCursorIcon(hinst
, hResInfo
, 0, 0);
251 TRACE("Didn't find the shared icon!!\n");
254 hResource
= LoadResource(hinst
, hResInfo
);
255 if (hResource
== NULL
)
260 ResIcon
= LockResource(hResource
);
266 hIcon
= CreateIconFromResourceEx((PBYTE
)ResIcon
,
267 SizeofResource(hinst
, hResInfo
),
268 Icon
, 0x00030000, width
, height
,
269 fuLoad
& (LR_DEFAULTCOLOR
| LR_MONOCHROME
));
271 if (hIcon
&& 0 != (fuLoad
& LR_SHARED
))
274 NtUserSetCursorIconData((HICON
)hIcon
, NULL
, NULL
, hinst
, hResInfo
,
279 if(NtUserGetIconInfo(ResIcon
, &iconInfo
, NULL
, NULL
, NULL
, FALSE
))
280 NtUserSetCursorIconData((HICON
)hIcon
, hinst
, NULL
, &iconInfo
);
287 if (fuLoad
& LR_SHARED
)
289 DbgPrint("FIXME: need LR_SHARED support for loading icon images from files\n");
292 hFile
= CreateFileW(lpszName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
293 OPEN_EXISTING
, 0, NULL
);
294 if (hFile
== INVALID_HANDLE_VALUE
)
297 hSection
= CreateFileMappingW(hFile
, NULL
, PAGE_READONLY
, 0, 0, NULL
);
298 filesize
= GetFileSize( hFile
, NULL
);
300 if (hSection
== NULL
)
303 IconDIR
= MapViewOfFile(hSection
, FILE_MAP_READ
, 0, 0, 0);
304 CloseHandle(hSection
);
308 if (0 != IconDIR
->idReserved
||
309 (IMAGE_ICON
!= IconDIR
->idType
&& IMAGE_CURSOR
!= IconDIR
->idType
))
311 UnmapViewOfFile(IconDIR
);
315 /* Get a handle to the screen dc, the icon we create is going to be
316 * compatable with this. */
317 hScreenDc
= CreateDCW(NULL
, NULL
, NULL
, NULL
);
318 if (hScreenDc
== NULL
)
320 UnmapViewOfFile(IconDIR
);
321 RtlFreeHeap(GetProcessHeap(), 0, SafeIconImage
);
325 if (fuLoad
& LR_MONOCHROME
)
331 ColorBits
= GetDeviceCaps(hScreenDc
, BITSPIXEL
);
334 * Remove this after proper support for alpha icons will be finished.
340 /* Pick the best size. */
341 dirEntry
= CURSORICON_FindBestCursorFile( IconDIR
, width
, height
, ColorBits
);
345 UnmapViewOfFile(IconDIR
);
349 if ( dirEntry
->dwDIBOffset
> filesize
)
352 UnmapViewOfFile(IconDIR
);
356 if ( dirEntry
->dwDIBOffset
+ dirEntry
->dwDIBSize
> filesize
){
358 UnmapViewOfFile(IconDIR
);
362 SafeIconImage
= RtlAllocateHeap(GetProcessHeap(), 0, dirEntry
->dwDIBSize
);
363 if (SafeIconImage
== NULL
)
366 UnmapViewOfFile(IconDIR
);
370 memcpy(SafeIconImage
, ((PBYTE
)IconDIR
) + dirEntry
->dwDIBOffset
, dirEntry
->dwDIBSize
);
371 UnmapViewOfFile(IconDIR
);
373 /* At this point we have a copy of the icon image to play with. */
375 SafeIconImage
->icHeader
.biHeight
= SafeIconImage
->icHeader
.biHeight
/2;
377 if (SafeIconImage
->icHeader
.biSize
== sizeof(BITMAPCOREHEADER
))
379 BITMAPCOREHEADER
* Core
= (BITMAPCOREHEADER
*)SafeIconImage
;
380 ColorCount
= (Core
->bcBitCount
<= 8) ? (1 << Core
->bcBitCount
) : 0;
381 HeaderSize
= sizeof(BITMAPCOREHEADER
) + ColorCount
* sizeof(RGBTRIPLE
);
385 ColorCount
= SafeIconImage
->icHeader
.biClrUsed
;
386 if (ColorCount
== 0 && SafeIconImage
->icHeader
.biBitCount
<= 8)
387 ColorCount
= 1 << SafeIconImage
->icHeader
.biBitCount
;
388 HeaderSize
= sizeof(BITMAPINFOHEADER
) + ColorCount
* sizeof(RGBQUAD
);
391 /* Make data point to the start of the XOR image data. */
392 Data
= (PBYTE
)SafeIconImage
+ HeaderSize
;
394 hIcon
= ICON_CreateIconFromData(hScreenDc
, Data
, SafeIconImage
, width
, height
, width
/2, height
/2);
395 RtlFreeHeap(GetProcessHeap(), 0, SafeIconImage
);
403 LoadBitmapImage(HINSTANCE hInstance
, LPCWSTR lpszName
, UINT fuLoad
)
408 LPBITMAPINFO BitmapInfo
;
409 LPBITMAPINFO PrivateInfo
;
416 if (!(fuLoad
& LR_LOADFROMFILE
))
418 if (hInstance
== NULL
)
419 hInstance
= User32Instance
;
421 hResource
= FindResourceW(hInstance
, lpszName
, RT_BITMAP
);
422 if (hResource
== NULL
)
424 hResource
= LoadResource(hInstance
, hResource
);
425 if (hResource
== NULL
)
427 BitmapInfo
= LockResource(hResource
);
428 if (BitmapInfo
== NULL
)
433 hFile
= CreateFileW(lpszName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
434 OPEN_EXISTING
, 0, NULL
);
435 if (hFile
== INVALID_HANDLE_VALUE
)
438 hSection
= CreateFileMappingW(hFile
, NULL
, PAGE_READONLY
, 0, 0, NULL
);
440 if (hSection
== NULL
)
443 BitmapInfo
= MapViewOfFile(hSection
, FILE_MAP_READ
, 0, 0, 0);
444 CloseHandle(hSection
);
445 if (BitmapInfo
== NULL
)
448 BitmapInfo
= (LPBITMAPINFO
)((ULONG_PTR
)BitmapInfo
+ sizeof(BITMAPFILEHEADER
));
451 if (BitmapInfo
->bmiHeader
.biSize
== sizeof(BITMAPCOREHEADER
))
453 BITMAPCOREHEADER
* Core
= (BITMAPCOREHEADER
*)BitmapInfo
;
454 ColorCount
= (Core
->bcBitCount
<= 8) ? (1 << Core
->bcBitCount
) : 0;
455 HeaderSize
= sizeof(BITMAPCOREHEADER
) + ColorCount
* sizeof(RGBTRIPLE
);
459 ColorCount
= BitmapInfo
->bmiHeader
.biClrUsed
;
460 if (ColorCount
== 0 && BitmapInfo
->bmiHeader
.biBitCount
<= 8)
461 ColorCount
= 1 << BitmapInfo
->bmiHeader
.biBitCount
;
462 HeaderSize
= sizeof(BITMAPINFOHEADER
) + ColorCount
* sizeof(RGBQUAD
);
464 Data
= (PVOID
)((ULONG_PTR
)BitmapInfo
+ HeaderSize
);
466 PrivateInfo
= RtlAllocateHeap(GetProcessHeap(), 0, HeaderSize
);
467 if (PrivateInfo
== NULL
)
469 if (fuLoad
& LR_LOADFROMFILE
)
470 UnmapViewOfFile(BitmapInfo
);
473 memcpy(PrivateInfo
, BitmapInfo
, HeaderSize
);
475 /* FIXME: Handle color conversion and transparency. */
477 hScreenDc
= CreateCompatibleDC(NULL
);
478 if (hScreenDc
== NULL
)
480 RtlFreeHeap(GetProcessHeap(), 0, PrivateInfo
);
481 if (fuLoad
& LR_LOADFROMFILE
)
482 UnmapViewOfFile(BitmapInfo
);
486 if (fuLoad
& LR_CREATEDIBSECTION
)
490 hBitmap
= CreateDIBSection(hScreenDc
, PrivateInfo
, DIB_RGB_COLORS
, NULL
,
492 GetObjectA(hBitmap
, sizeof(DIBSECTION
), &Dib
);
493 SetDIBits(hScreenDc
, hBitmap
, 0, Dib
.dsBm
.bmHeight
, Data
, BitmapInfo
,
498 hBitmap
= CreateDIBitmap(hScreenDc
, &PrivateInfo
->bmiHeader
, CBM_INIT
,
499 Data
, PrivateInfo
, DIB_RGB_COLORS
);
502 RtlFreeHeap(GetProcessHeap(), 0, PrivateInfo
);
504 if (fuLoad
& LR_LOADFROMFILE
)
505 UnmapViewOfFile(BitmapInfo
);
519 if (fuLoad
& LR_DEFAULTSIZE
)
521 if (uType
== IMAGE_ICON
)
524 cxDesired
= GetSystemMetrics(SM_CXICON
);
526 cyDesired
= GetSystemMetrics(SM_CYICON
);
528 else if (uType
== IMAGE_CURSOR
)
531 cxDesired
= GetSystemMetrics(SM_CXCURSOR
);
533 cyDesired
= GetSystemMetrics(SM_CYCURSOR
);
540 return LoadBitmapImage(hinst
, lpszName
, fuLoad
);
543 return LoadCursorIconImage(hinst
, lpszName
, cxDesired
, cyDesired
,
557 LoadBitmapA(HINSTANCE hInstance
, LPCSTR lpBitmapName
)
559 return LoadImageA(hInstance
, lpBitmapName
, IMAGE_BITMAP
, 0, 0, 0);
567 LoadBitmapW(HINSTANCE hInstance
, LPCWSTR lpBitmapName
)
569 return LoadImageW(hInstance
, lpBitmapName
, IMAGE_BITMAP
, 0, 0, 0);
585 objSize
= GetObjectW( hnd
, sizeof(ds
), &ds
);
586 if (!objSize
) return 0;
587 if ((desiredx
< 0) || (desiredy
< 0)) return 0;
589 if (flags
& LR_COPYFROMRESOURCE
)
591 FIXME("FIXME: The flag LR_COPYFROMRESOURCE is not implemented for bitmaps\n");
594 if (desiredx
== 0) desiredx
= ds
.dsBm
.bmWidth
;
595 if (desiredy
== 0) desiredy
= ds
.dsBm
.bmHeight
;
597 /* Allocate memory for a BITMAPINFOHEADER structure and a
598 color table. The maximum number of colors in a color table
599 is 256 which corresponds to a bitmap with depth 8.
600 Bitmaps with higher depths don't have color tables. */
601 bi
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
604 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
605 bi
->bmiHeader
.biPlanes
= ds
.dsBm
.bmPlanes
;
606 bi
->bmiHeader
.biBitCount
= ds
.dsBm
.bmBitsPixel
;
607 bi
->bmiHeader
.biCompression
= BI_RGB
;
609 if (flags
& LR_CREATEDIBSECTION
)
611 /* Create a DIB section. LR_MONOCHROME is ignored */
613 HDC dc
= CreateCompatibleDC(NULL
);
615 if (objSize
== sizeof(DIBSECTION
))
617 /* The source bitmap is a DIB.
618 Get its attributes to create an exact copy */
619 memcpy(bi
, &ds
.dsBmih
, sizeof(BITMAPINFOHEADER
));
622 /* Get the color table or the color masks */
623 GetDIBits(dc
, hnd
, 0, ds
.dsBm
.bmHeight
, NULL
, bi
, DIB_RGB_COLORS
);
625 bi
->bmiHeader
.biWidth
= desiredx
;
626 bi
->bmiHeader
.biHeight
= desiredy
;
627 bi
->bmiHeader
.biSizeImage
= 0;
629 res
= CreateDIBSection(dc
, bi
, DIB_RGB_COLORS
, &bits
, NULL
, 0);
634 /* Create a device-dependent bitmap */
636 BOOL monochrome
= (flags
& LR_MONOCHROME
);
638 if (objSize
== sizeof(DIBSECTION
))
640 /* The source bitmap is a DIB section.
641 Get its attributes */
642 HDC dc
= CreateCompatibleDC(NULL
);
643 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
644 bi
->bmiHeader
.biBitCount
= ds
.dsBm
.bmBitsPixel
;
645 GetDIBits(dc
, hnd
, 0, ds
.dsBm
.bmHeight
, NULL
, bi
, DIB_RGB_COLORS
);
648 if (!monochrome
&& ds
.dsBm
.bmBitsPixel
== 1)
650 /* Look if the colors of the DIB are black and white */
653 (bi
->bmiColors
[0].rgbRed
== 0xff
654 && bi
->bmiColors
[0].rgbGreen
== 0xff
655 && bi
->bmiColors
[0].rgbBlue
== 0xff
656 && bi
->bmiColors
[0].rgbReserved
== 0
657 && bi
->bmiColors
[1].rgbRed
== 0
658 && bi
->bmiColors
[1].rgbGreen
== 0
659 && bi
->bmiColors
[1].rgbBlue
== 0
660 && bi
->bmiColors
[1].rgbReserved
== 0)
662 (bi
->bmiColors
[0].rgbRed
== 0
663 && bi
->bmiColors
[0].rgbGreen
== 0
664 && bi
->bmiColors
[0].rgbBlue
== 0
665 && bi
->bmiColors
[0].rgbReserved
== 0
666 && bi
->bmiColors
[1].rgbRed
== 0xff
667 && bi
->bmiColors
[1].rgbGreen
== 0xff
668 && bi
->bmiColors
[1].rgbBlue
== 0xff
669 && bi
->bmiColors
[1].rgbReserved
== 0);
672 else if (!monochrome
)
674 monochrome
= ds
.dsBm
.bmBitsPixel
== 1;
679 res
= CreateBitmap(desiredx
, desiredy
, 1, 1, NULL
);
683 HDC screenDC
= GetDC(NULL
);
684 res
= CreateCompatibleBitmap(screenDC
, desiredx
, desiredy
);
685 ReleaseDC(NULL
, screenDC
);
691 /* Only copy the bitmap if it's a DIB section or if it's
692 compatible to the screen */
695 if (objSize
== sizeof(DIBSECTION
))
701 HDC screenDC
= GetDC(NULL
);
702 int screen_depth
= GetDeviceCaps(screenDC
, BITSPIXEL
);
703 ReleaseDC(NULL
, screenDC
);
705 copyContents
= (ds
.dsBm
.bmBitsPixel
== 1 || ds
.dsBm
.bmBitsPixel
== screen_depth
);
710 /* The source bitmap may already be selected in a device context,
711 use GetDIBits/StretchDIBits and not StretchBlt */
716 dc
= CreateCompatibleDC(NULL
);
718 bi
->bmiHeader
.biWidth
= ds
.dsBm
.bmWidth
;
719 bi
->bmiHeader
.biHeight
= ds
.dsBm
.bmHeight
;
720 bi
->bmiHeader
.biSizeImage
= 0;
721 bi
->bmiHeader
.biClrUsed
= 0;
722 bi
->bmiHeader
.biClrImportant
= 0;
724 /* Fill in biSizeImage */
725 GetDIBits(dc
, hnd
, 0, ds
.dsBm
.bmHeight
, NULL
, bi
, DIB_RGB_COLORS
);
726 bits
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, bi
->bmiHeader
.biSizeImage
);
732 /* Get the image bits of the source bitmap */
733 GetDIBits(dc
, hnd
, 0, ds
.dsBm
.bmHeight
, bits
, bi
, DIB_RGB_COLORS
);
735 /* Copy it to the destination bitmap */
736 oldBmp
= SelectObject(dc
, res
);
737 StretchDIBits(dc
, 0, 0, desiredx
, desiredy
,
738 0, 0, ds
.dsBm
.bmWidth
, ds
.dsBm
.bmHeight
,
739 bits
, bi
, DIB_RGB_COLORS
, SRCCOPY
);
740 SelectObject(dc
, oldBmp
);
742 HeapFree(GetProcessHeap(), 0, bits
);
748 if (flags
& LR_COPYDELETEORG
)
753 HeapFree(GetProcessHeap(), 0, bi
);
759 GetIconCurBpp(PICONINFO pIconInfo
)
763 pbi
= (PBITMAPINFO
)pIconInfo
->hbmColor
;
764 return pbi
->bmiHeader
.biBitCount
;
778 if (!Handle
|| !pIconInfo
)
781 RtlInitUnicodeString(&Res
, lpResName
);
783 return NtUserSetCursorIconData(Handle
, hMod
, &Res
, pIconInfo
);
788 /* bare bones icon copy implementation */
790 CopyIcoCur(HANDLE hIconCur
,
796 HANDLE hNewIcon
= NULL
;
797 ICONINFO origIconInfo
, newIconInfo
;
804 if (flags
& LR_COPYFROMRESOURCE
)
806 TRACE("FIXME: LR_COPYFROMRESOURCE is yet not implemented for icons\n");
809 if (NtUserGetIconSize(hIconCur
, 0, &origSize
.cx
, &origSize
.cy
))
811 if (desiredx
== 0) desiredx
= origSize
.cx
;
812 if (desiredx
== 0) desiredy
= origSize
.cy
;
814 if (NtUserGetIconInfo(hIconCur
, &origIconInfo
, NULL
, NULL
, &origBpp
, TRUE
))
816 hNewIcon
= (HANDLE
)NtUserCallOneParam(0, ONEPARAM_ROUTINE_CREATECURICONHANDLE
);
820 /* the bitmaps returned from the NtUserGetIconInfo are copies of the original,
821 * so we can use these directly to build up our icon/cursor copy */
822 RtlCopyMemory(&newIconInfo
, &origIconInfo
, sizeof(ICONINFO
));
824 if (!SetCursorIconData(hNewIcon
, NULL
, NULL
, &newIconInfo
))
826 if (newIconInfo
.fIcon
)
827 DestroyIcon(hNewIcon
);
829 DestroyCursor(hNewIcon
);
835 DeleteObject(origIconInfo
.hbmMask
);
836 DeleteObject(origIconInfo
.hbmColor
);
840 if (hNewIcon
&& (flags
& LR_COPYDELETEORG
))
842 DestroyCursor((HCURSOR
)hIconCur
);
862 * Only Windows NT 4.0 supports the LR_COPYRETURNORG flag for bitmaps,
863 * all other versions (95/2000/XP have been tested) ignore it.
866 * If LR_CREATEDIBSECTION is absent, the copy will be monochrome for
867 * a monochrome source bitmap or if LR_MONOCHROME is present, otherwise
868 * the copy will have the same depth as the screen.
869 * The content of the image will only be copied if the bit depth of the
870 * original image is compatible with the bit depth of the screen, or
871 * if the source is a DIB section.
872 * The LR_MONOCHROME flag is ignored if LR_CREATEDIBSECTION is present.
877 return CopyBmp(hnd
, type
, desiredx
, desiredy
, flags
);
880 //return CopyIcoCur(hnd, type, desiredx, desiredy, flags);
881 return CopyIcon(hnd
);
885 static BOOL IconMsgDisplayed
= FALSE
;
886 /* FIXME: support loading the image as shared from an instance */
887 if (!IconMsgDisplayed
)
889 FIXME("FIXME: CopyImage doesn't support IMAGE_CURSOR correctly!\n");
890 IconMsgDisplayed
= TRUE
;
892 /* Should call CURSORICON_ExtCopy but more testing
893 * needs to be done before we change this
895 if (flags
) FIXME("FIXME: Flags are ignored\n");
896 return CopyCursor(hnd
);