Alexandre Julliard : user32: Allocate user handles for cursors/ icons when we don't have 16-bit support.
Module: wine Branch: master Commit: cecb3a993c156b7aef91f719beec4901597095cd URL: http://source.winehq.org/git/wine.git/?a=commit;h=cecb3a993c156b7aef91f719be... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Dec 22 17:16:50 2009 +0100 user32: Allocate user handles for cursors/icons when we don't have 16-bit support. --- dlls/user32/user_private.h | 1 + dlls/user32/winproc.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 41379f0..c383b48 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -129,6 +129,7 @@ enum user_obj_type USER_WINDOW = 1, /* window */ USER_MENU, /* menu */ USER_ACCEL, /* accelerator */ + USER_ICON, /* icon or cursor */ USER_DWP /* DeferWindowPos structure */ }; diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index bcb6853..354efe0 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -1123,24 +1123,32 @@ static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM static HICON alloc_icon_handle( unsigned int size ) { - HGLOBAL16 handle = GlobalAlloc16( GMEM_MOVEABLE, size ); - FarSetOwner16( handle, 0 ); - return HICON_32( handle ); + struct user_object *obj = HeapAlloc( GetProcessHeap(), 0, sizeof(*obj) + size ); + if (!obj) return 0; + return alloc_user_handle( obj, USER_ICON ); } static struct tagCURSORICONINFO *get_icon_ptr( HICON handle ) { - return GlobalLock16( HICON_16(handle) ); + struct user_object *obj = get_user_handle_ptr( handle, USER_ICON ); + if (obj == OBJ_OTHER_PROCESS) + { + WARN( "cursor handle %p from other process\n", handle ); + obj = NULL; + } + return obj ? (struct tagCURSORICONINFO *)(obj + 1) : NULL; } static void release_icon_ptr( HICON handle, struct tagCURSORICONINFO *ptr ) { - GlobalUnlock16( HICON_16(handle) ); + release_user_handle_ptr( (struct user_object *)ptr - 1 ); } static int free_icon_handle( HICON handle ) { - return GlobalFree16( HICON_16(handle) ); + struct user_object *obj = free_user_handle( handle, USER_ICON ); + HeapFree( GetProcessHeap(), 0, obj ); + return !obj; }
participants (1)
-
Alexandre Julliard