Commit 1d1f8e2a authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Move DestroyIcon32 implementation to user16.c.

parent ff04a5e8
...@@ -84,10 +84,6 @@ typedef struct ...@@ -84,10 +84,6 @@ typedef struct
#include "poppack.h" #include "poppack.h"
#define CID_RESOURCE 0x0001
#define CID_WIN32 0x0004
#define CID_NONSHARED 0x0008
static RECT CURSOR_ClipRect; /* Cursor clipping rect */ static RECT CURSOR_ClipRect; /* Cursor clipping rect */
static HDC screen_dc; static HDC screen_dc;
...@@ -1470,52 +1466,16 @@ HICON WINAPI CopyIcon( HICON hIcon ) ...@@ -1470,52 +1466,16 @@ HICON WINAPI CopyIcon( HICON hIcon )
} }
/**********************************************************************
* DestroyIcon32 (USER.610)
*
* This routine is actually exported from Win95 USER under the name
* DestroyIcon32 ... The behaviour implemented here should mimic
* the Win95 one exactly, especially the return values, which
* depend on the setting of various flags.
*/
WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags )
{
WORD retv;
TRACE_(icon)("(%04x, %04x)\n", handle, flags );
/* Check whether destroying active cursor */
if ( get_user_thread_info()->cursor == HICON_32(handle) )
{
WARN_(cursor)("Destroying active cursor!\n" );
return FALSE;
}
/* Try shared cursor/icon first */
if ( !(flags & CID_NONSHARED) )
{
INT count = CURSORICON_DelSharedIcon(HICON_32(handle));
if ( count != -1 )
return (flags & CID_WIN32)? TRUE : (count == 0);
/* FIXME: OEM cursors/icons should be recognized */
}
/* Now assume non-shared cursor/icon */
retv = GlobalFree16( handle );
return (flags & CID_RESOURCE)? retv : TRUE;
}
/*********************************************************************** /***********************************************************************
* DestroyIcon (USER32.@) * DestroyIcon (USER32.@)
*/ */
BOOL WINAPI DestroyIcon( HICON hIcon ) BOOL WINAPI DestroyIcon( HICON hIcon )
{ {
return DestroyIcon32(HICON_16(hIcon), CID_WIN32); TRACE_(icon)("%p\n", hIcon );
if (CURSORICON_DelSharedIcon( hIcon ) == -1)
GlobalFree16( HICON_16(hIcon) );
return TRUE;
} }
...@@ -1524,7 +1484,12 @@ BOOL WINAPI DestroyIcon( HICON hIcon ) ...@@ -1524,7 +1484,12 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
*/ */
BOOL WINAPI DestroyCursor( HCURSOR hCursor ) BOOL WINAPI DestroyCursor( HCURSOR hCursor )
{ {
return DestroyIcon32(HCURSOR_16(hCursor), CID_WIN32); if (get_user_thread_info()->cursor == hCursor)
{
WARN_(cursor)("Destroying active cursor!\n" );
return FALSE;
}
return DestroyIcon( hCursor );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -55,7 +55,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(user); ...@@ -55,7 +55,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(user);
#define USUD_LOCALHEAP 0x0004 #define USUD_LOCALHEAP 0x0004
#define USUD_FIRSTCLASS 0x0005 #define USUD_FIRSTCLASS 0x0005
WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16); #define CID_RESOURCE 0x0001
#define CID_WIN32 0x0004
#define CID_NONSHARED 0x0008
WORD USER_HeapSel = 0; /* USER heap selector */ WORD USER_HeapSel = 0; /* USER heap selector */
...@@ -2854,6 +2856,42 @@ DWORD WINAPI FormatMessage16( ...@@ -2854,6 +2856,42 @@ DWORD WINAPI FormatMessage16(
#undef ADD_TO_T #undef ADD_TO_T
/**********************************************************************
* DestroyIcon32 (USER.610)
*
* This routine is actually exported from Win95 USER under the name
* DestroyIcon32 ... The behaviour implemented here should mimic
* the Win95 one exactly, especially the return values, which
* depend on the setting of various flags.
*/
WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags )
{
WORD retv;
/* Check whether destroying active cursor */
if (GetCursor16() == handle)
{
WARN("Destroying active cursor!\n" );
return FALSE;
}
/* Try shared cursor/icon first */
if (!(flags & CID_NONSHARED))
{
INT count = release_shared_icon( handle );
if (count != -1)
return (flags & CID_WIN32) ? TRUE : (count == 0);
}
/* Now assume non-shared cursor/icon */
retv = GlobalFree16( handle );
return (flags & CID_RESOURCE)? retv : TRUE;
}
/*********************************************************************** /***********************************************************************
* ChangeDisplaySettings (USER.620) * ChangeDisplaySettings (USER.620)
*/ */
......
...@@ -772,11 +772,6 @@ ...@@ -772,11 +772,6 @@
@ stdcall wvsprintfW(ptr wstr ptr) @ stdcall wvsprintfW(ptr wstr ptr)
################################################################ ################################################################
# Wine extensions: Win16 functions that are needed by other dlls
#
@ stdcall DestroyIcon32(long long)
################################################################
# Wine dll separation hacks, these will go away, don't use them # Wine dll separation hacks, these will go away, don't use them
# #
@ cdecl HOOK_CallHooks(long long long long long) @ cdecl HOOK_CallHooks(long long long long long)
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