Commit cecb3a99 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Allocate user handles for cursors/icons when we don't have 16-bit support.

parent 0f511f3c
...@@ -129,6 +129,7 @@ enum user_obj_type ...@@ -129,6 +129,7 @@ enum user_obj_type
USER_WINDOW = 1, /* window */ USER_WINDOW = 1, /* window */
USER_MENU, /* menu */ USER_MENU, /* menu */
USER_ACCEL, /* accelerator */ USER_ACCEL, /* accelerator */
USER_ICON, /* icon or cursor */
USER_DWP /* DeferWindowPos structure */ USER_DWP /* DeferWindowPos structure */
}; };
......
...@@ -1123,24 +1123,32 @@ static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...@@ -1123,24 +1123,32 @@ static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM
static HICON alloc_icon_handle( unsigned int size ) static HICON alloc_icon_handle( unsigned int size )
{ {
HGLOBAL16 handle = GlobalAlloc16( GMEM_MOVEABLE, size ); struct user_object *obj = HeapAlloc( GetProcessHeap(), 0, sizeof(*obj) + size );
FarSetOwner16( handle, 0 ); if (!obj) return 0;
return HICON_32( handle ); return alloc_user_handle( obj, USER_ICON );
} }
static struct tagCURSORICONINFO *get_icon_ptr( HICON handle ) 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 ) 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 ) 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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment