user32: Replace release_icon_ptr with release_user_handle_ptr.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
This commit is contained in:
Alex Henrie 2015-10-01 21:58:05 -06:00 committed by Alexandre Julliard
parent 6f97e1a30c
commit 50403fec1e

View File

@ -158,11 +158,6 @@ static struct cursoricon_object *get_icon_ptr( HICON handle )
return obj; return obj;
} }
static void release_icon_ptr( HICON handle, struct cursoricon_object *ptr )
{
release_user_handle_ptr( ptr );
}
static struct cursoricon_frame *get_icon_frame( struct cursoricon_object *obj, int istep ) static struct cursoricon_frame *get_icon_frame( struct cursoricon_object *obj, int istep )
{ {
struct static_cursoricon_object *req_frame; struct static_cursoricon_object *req_frame;
@ -192,7 +187,7 @@ static void release_icon_frame( struct cursoricon_object *obj, int istep, struct
ani_icon_data = (struct animated_cursoricon_object *) obj; ani_icon_data = (struct animated_cursoricon_object *) obj;
frameobj = (struct cursoricon_object *) (((char *)frame) - FIELD_OFFSET(struct static_cursoricon_object, frame)); frameobj = (struct cursoricon_object *) (((char *)frame) - FIELD_OFFSET(struct static_cursoricon_object, frame));
release_icon_ptr( ani_icon_data->frames[istep], frameobj ); release_user_handle_ptr( frameobj );
} }
} }
@ -484,7 +479,7 @@ BOOL get_icon_size( HICON handle, SIZE *size )
size->cx = frame->width; size->cx = frame->width;
size->cy = frame->height; size->cy = frame->height;
release_icon_frame( info, 0, frame); release_icon_frame( info, 0, frame);
release_icon_ptr( handle, info ); release_user_handle_ptr( info );
return TRUE; return TRUE;
} }
@ -976,7 +971,7 @@ done:
info->rsrc = rsrc; info->rsrc = rsrc;
list_add_head( &icon_cache, &info->entry ); list_add_head( &icon_cache, &info->entry );
} }
release_icon_ptr( hObj, info ); release_user_handle_ptr( info );
} }
else else
{ {
@ -1229,7 +1224,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const BYTE *bits, DWORD bits_size,
{ {
FIXME_(cursor)("Completely failed to create animated cursor!\n"); FIXME_(cursor)("Completely failed to create animated cursor!\n");
ani_icon_data->num_frames = 0; ani_icon_data->num_frames = 0;
release_icon_ptr( cursor, info ); release_user_handle_ptr( info );
free_icon_handle( cursor ); free_icon_handle( cursor );
HeapFree( GetProcessHeap(), 0, frames ); HeapFree( GetProcessHeap(), 0, frames );
return 0; return 0;
@ -1275,7 +1270,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const BYTE *bits, DWORD bits_size,
} }
HeapFree( GetProcessHeap(), 0, frames ); HeapFree( GetProcessHeap(), 0, frames );
release_icon_ptr( cursor, info ); release_user_handle_ptr( info );
return cursor; return cursor;
} }
@ -1592,14 +1587,14 @@ HICON WINAPI CopyIcon( HICON hIcon )
ptrNew->hotspot = ptrOld->hotspot; ptrNew->hotspot = ptrOld->hotspot;
if (!(frameOld = get_icon_frame( ptrOld, 0 ))) if (!(frameOld = get_icon_frame( ptrOld, 0 )))
{ {
release_icon_ptr( hIcon, ptrOld ); release_user_handle_ptr( ptrOld );
SetLastError( ERROR_INVALID_CURSOR_HANDLE ); SetLastError( ERROR_INVALID_CURSOR_HANDLE );
return 0; return 0;
} }
if (!(frameNew = get_icon_frame( ptrNew, 0 ))) if (!(frameNew = get_icon_frame( ptrNew, 0 )))
{ {
release_icon_frame( ptrOld, 0, frameOld ); release_icon_frame( ptrOld, 0, frameOld );
release_icon_ptr( hIcon, ptrOld ); release_user_handle_ptr( ptrOld );
SetLastError( ERROR_INVALID_CURSOR_HANDLE ); SetLastError( ERROR_INVALID_CURSOR_HANDLE );
return 0; return 0;
} }
@ -1611,9 +1606,9 @@ HICON WINAPI CopyIcon( HICON hIcon )
frameNew->alpha = copy_bitmap( frameOld->alpha ); frameNew->alpha = copy_bitmap( frameOld->alpha );
release_icon_frame( ptrOld, 0, frameOld ); release_icon_frame( ptrOld, 0, frameOld );
release_icon_frame( ptrNew, 0, frameNew ); release_icon_frame( ptrNew, 0, frameNew );
release_icon_ptr( hNew, ptrNew ); release_user_handle_ptr( ptrNew );
} }
release_icon_ptr( hIcon, ptrOld ); release_user_handle_ptr( ptrOld );
return hNew; return hNew;
} }
@ -1631,7 +1626,7 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
if (obj) if (obj)
{ {
BOOL shared = (obj->rsrc != NULL); BOOL shared = (obj->rsrc != NULL);
release_icon_ptr( hIcon, obj ); release_user_handle_ptr( obj );
ret = (GetCursor() != hIcon); ret = (GetCursor() != hIcon);
if (!shared) free_icon_handle( hIcon ); if (!shared) free_icon_handle( hIcon );
} }
@ -1688,7 +1683,7 @@ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cu
USER_Driver->pSetCursor( show_count >= 0 ? hCursor : 0 ); USER_Driver->pSetCursor( show_count >= 0 ? hCursor : 0 );
if (!(obj = get_icon_ptr( hOldCursor ))) return 0; if (!(obj = get_icon_ptr( hOldCursor ))) return 0;
release_icon_ptr( hOldCursor, obj ); release_user_handle_ptr( obj );
return hOldCursor; return hOldCursor;
} }
@ -1986,7 +1981,7 @@ HCURSOR WINAPI GetCursorFrameInfo(HCURSOR hCursor, DWORD reserved, DWORD istep,
} }
} }
release_icon_ptr( hCursor, ptr ); release_user_handle_ptr( ptr );
return ret; return ret;
} }
@ -2057,7 +2052,7 @@ BOOL WINAPI GetIconInfoExW( HICON icon, ICONINFOEXW *info )
frame = get_icon_frame( ptr, 0 ); frame = get_icon_frame( ptr, 0 );
if (!frame) if (!frame)
{ {
release_icon_ptr( icon, ptr ); release_user_handle_ptr( ptr );
SetLastError( ERROR_INVALID_CURSOR_HANDLE ); SetLastError( ERROR_INVALID_CURSOR_HANDLE );
return FALSE; return FALSE;
} }
@ -2085,7 +2080,7 @@ BOOL WINAPI GetIconInfoExW( HICON icon, ICONINFOEXW *info )
} }
module = ptr->module; module = ptr->module;
release_icon_frame( ptr, 0, frame ); release_icon_frame( ptr, 0, frame );
release_icon_ptr( icon, ptr ); release_user_handle_ptr( ptr );
if (ret && module) GetModuleFileNameW( module, info->szModName, MAX_PATH ); if (ret && module) GetModuleFileNameW( module, info->szModName, MAX_PATH );
return ret; return ret;
} }
@ -2215,7 +2210,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
info->hotspot.y = iconinfo->yHotspot; info->hotspot.y = iconinfo->yHotspot;
} }
release_icon_ptr( hObj, info ); release_user_handle_ptr( info );
} }
return hObj; return hObj;
} }
@ -2260,19 +2255,19 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
if (istep >= get_icon_steps( ptr )) if (istep >= get_icon_steps( ptr ))
{ {
TRACE_(icon)("Stepped past end of animated frames=%d\n", istep); TRACE_(icon)("Stepped past end of animated frames=%d\n", istep);
release_icon_ptr( hIcon, ptr ); release_user_handle_ptr( ptr );
return FALSE; return FALSE;
} }
if (!(frame = get_icon_frame( ptr, istep ))) if (!(frame = get_icon_frame( ptr, istep )))
{ {
FIXME_(icon)("Error retrieving icon frame %d\n", istep); FIXME_(icon)("Error retrieving icon frame %d\n", istep);
release_icon_ptr( hIcon, ptr ); release_user_handle_ptr( ptr );
return FALSE; return FALSE;
} }
if (!(hMemDC = CreateCompatibleDC( hdc ))) if (!(hMemDC = CreateCompatibleDC( hdc )))
{ {
release_icon_frame( ptr, istep, frame ); release_icon_frame( ptr, istep, frame );
release_icon_ptr( hIcon, ptr ); release_user_handle_ptr( ptr );
return FALSE; return FALSE;
} }
@ -2386,7 +2381,7 @@ done:
failed: failed:
DeleteDC( hMemDC ); DeleteDC( hMemDC );
release_icon_frame( ptr, istep, frame ); release_icon_frame( ptr, istep, frame );
release_icon_ptr( hIcon, ptr ); release_user_handle_ptr( ptr );
return result; return result;
} }
@ -2908,7 +2903,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
!icon->is_icon, flags ); !icon->is_icon, flags );
else else
res = CopyIcon( hnd ); /* FIXME: change size if necessary */ res = CopyIcon( hnd ); /* FIXME: change size if necessary */
release_icon_ptr( hnd, icon ); release_user_handle_ptr( icon );
if (res && (flags & LR_COPYDELETEORG)) DeleteObject( hnd ); if (res && (flags & LR_COPYDELETEORG)) DeleteObject( hnd );
return res; return res;