From 0f511f3c8e3105b00953648a8a072bfaada94ea3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 22 Dec 2009 17:13:49 +0100 Subject: [PATCH] user32: Don't assume global handles in CopyIcon. --- dlls/user32/cursoricon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 90f835616cb..2b2151a745d 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -1451,11 +1451,12 @@ HICON WINAPI CopyIcon( HICON hIcon ) { CURSORICONINFO *ptrOld, *ptrNew; int size; - HICON16 hOld = HICON_16(hIcon); HICON hNew; if (!(ptrOld = wow_handlers.get_icon_ptr( hIcon ))) return 0; - size = GlobalSize16( hOld ); + size = sizeof(CURSORICONINFO); + size += ptrOld->nHeight * get_bitmap_width_bytes( ptrOld->nWidth, 1 ); /* and bitmap */ + size += ptrOld->nHeight * ptrOld->nWidthBytes; /* xor bitmap */ hNew = wow_handlers.alloc_icon_handle( size ); ptrNew = wow_handlers.get_icon_ptr( hNew ); memcpy( ptrNew, ptrOld, size );