Zebediah Figura : user32: Reimplement CopyIcon() on top of CopyImage().
Alexandre Julliard
julliard at winehq.org
Mon May 24 15:59:53 CDT 2021
Module: wine
Branch: master
Commit: 5df5972f9aac66c7306fecea9d094ec1634b31be
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5df5972f9aac66c7306fecea9d094ec1634b31be
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun May 23 23:47:19 2021 -0500
user32: Reimplement CopyIcon() on top of CopyImage().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/cursoricon.c | 45 ++++++---------------------------------------
1 file changed, 6 insertions(+), 39 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index fc95fa1c56f..a923f2f8315 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1667,48 +1667,15 @@ HICON WINAPI CreateIcon( HINSTANCE instance, int width, int height, BYTE planes,
/***********************************************************************
* CopyIcon (USER32.@)
*/
-HICON WINAPI CopyIcon( HICON hIcon )
+HICON WINAPI CopyIcon( HICON icon )
{
- struct cursoricon_object *ptrOld, *ptrNew;
- HICON hNew;
+ ICONINFOEXW info;
- if (!(ptrOld = get_icon_ptr( hIcon )))
- {
- SetLastError( ERROR_INVALID_CURSOR_HANDLE );
- return 0;
- }
- if ((hNew = alloc_icon_handle( FALSE, 0 )))
- {
- struct cursoricon_frame *frameOld, *frameNew;
+ info.cbSize = sizeof(info);
+ if (!GetIconInfoExW( icon, &info ))
+ return NULL;
- ptrNew = get_icon_ptr( hNew );
- ptrNew->is_icon = ptrOld->is_icon;
- ptrNew->hotspot = ptrOld->hotspot;
- if (!(frameOld = get_icon_frame( ptrOld, 0 )))
- {
- release_user_handle_ptr( ptrOld );
- SetLastError( ERROR_INVALID_CURSOR_HANDLE );
- return 0;
- }
- if (!(frameNew = get_icon_frame( ptrNew, 0 )))
- {
- release_icon_frame( ptrOld, frameOld );
- release_user_handle_ptr( ptrOld );
- SetLastError( ERROR_INVALID_CURSOR_HANDLE );
- return 0;
- }
- frameNew->delay = 0;
- frameNew->width = frameOld->width;
- frameNew->height = frameOld->height;
- frameNew->mask = copy_bitmap( frameOld->mask );
- frameNew->color = copy_bitmap( frameOld->color );
- frameNew->alpha = copy_bitmap( frameOld->alpha );
- release_icon_frame( ptrOld, frameOld );
- release_icon_frame( ptrNew, frameNew );
- release_user_handle_ptr( ptrNew );
- }
- release_user_handle_ptr( ptrOld );
- return hNew;
+ return CopyImage( icon, info.fIcon ? IMAGE_ICON : IMAGE_CURSOR, 0, 0, 0 );
}
More information about the wine-cvs
mailing list