Alexandre Julliard : user32: Implemented GetIconInfoExA/W.

Alexandre Julliard julliard at winehq.org
Fri Oct 8 12:38:08 CDT 2010


Module: wine
Branch: master
Commit: d3de0c265b00c7b7d7fc63b69b3a04a5e855d1ea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d3de0c265b00c7b7d7fc63b69b3a04a5e855d1ea

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Oct  8 13:23:48 2010 +0200

user32: Implemented GetIconInfoExA/W.

---

 dlls/user32/cursoricon.c |   71 ++++++++++++++++++++++++++++++++++++++++------
 dlls/user32/user32.spec  |    2 +
 include/winuser.h        |   31 ++++++++++++++++++++
 3 files changed, 95 insertions(+), 9 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index ce25a9d..cea5552 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1866,19 +1866,72 @@ HICON WINAPI LoadIconA(HINSTANCE hInstance, LPCSTR name)
  */
 BOOL WINAPI GetIconInfo(HICON hIcon, PICONINFO iconinfo)
 {
-    struct cursoricon_object *ptr;
+    ICONINFOEXW infoW;
+
+    infoW.cbSize = sizeof(infoW);
+    if (!GetIconInfoExW( hIcon, &infoW )) return FALSE;
+    iconinfo->fIcon    = infoW.fIcon;
+    iconinfo->xHotspot = infoW.xHotspot;
+    iconinfo->yHotspot = infoW.yHotspot;
+    iconinfo->hbmColor = infoW.hbmColor;
+    iconinfo->hbmMask  = infoW.hbmMask;
+    return TRUE;
+}
 
-    if (!(ptr = get_icon_ptr( hIcon ))) return FALSE;
+/**********************************************************************
+ *              GetIconInfoExA (USER32.@)
+ */
+BOOL WINAPI GetIconInfoExA( HICON icon, ICONINFOEXA *info )
+{
+    ICONINFOEXW infoW;
 
-    TRACE("%p => %dx%d\n", hIcon, ptr->width, ptr->height);
+    if (info->cbSize != sizeof(*info))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+    infoW.cbSize = sizeof(infoW);
+    if (!GetIconInfoExW( icon, &infoW )) return FALSE;
+    info->fIcon    = infoW.fIcon;
+    info->xHotspot = infoW.xHotspot;
+    info->yHotspot = infoW.yHotspot;
+    info->hbmColor = infoW.hbmColor;
+    info->hbmMask  = infoW.hbmMask;
+    info->wResID   = infoW.wResID;
+    WideCharToMultiByte( CP_ACP, 0, infoW.szModName, -1, info->szModName, MAX_PATH, NULL, NULL );
+    WideCharToMultiByte( CP_ACP, 0, infoW.szResName, -1, info->szResName, MAX_PATH, NULL, NULL );
+    return TRUE;
+}
 
-    iconinfo->fIcon    = ptr->is_icon;
-    iconinfo->xHotspot = ptr->hotspot.x;
-    iconinfo->yHotspot = ptr->hotspot.y;
-    iconinfo->hbmColor = copy_bitmap( ptr->frames[0].color );
-    iconinfo->hbmMask  = copy_bitmap( ptr->frames[0].mask );
-    release_icon_ptr( hIcon, ptr );
+/**********************************************************************
+ *              GetIconInfoExW (USER32.@)
+ */
+BOOL WINAPI GetIconInfoExW( HICON icon, ICONINFOEXW *info )
+{
+    struct cursoricon_object *ptr;
+
+    if (info->cbSize != sizeof(*info))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+    if (!(ptr = get_icon_ptr( icon )))
+    {
+        SetLastError( ERROR_INVALID_CURSOR_HANDLE );
+        return FALSE;
+    }
+
+    TRACE("%p => %dx%d\n", icon, ptr->width, ptr->height);
 
+    info->fIcon        = ptr->is_icon;
+    info->xHotspot     = ptr->hotspot.x;
+    info->yHotspot     = ptr->hotspot.y;
+    info->hbmColor     = copy_bitmap( ptr->frames[0].color );
+    info->hbmMask      = copy_bitmap( ptr->frames[0].mask );
+    info->wResID       = 0;  /* FIXME */
+    info->szModName[0] = 0;  /* FIXME */
+    info->szResName[0] = 0;  /* FIXME */
+    release_icon_ptr( icon, ptr );
     return TRUE;
 }
 
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index b5f6d87..072fed4 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -290,6 +290,8 @@
 @ stdcall GetGUIThreadInfo(long ptr)
 @ stdcall GetGuiResources(long long)
 @ stdcall GetIconInfo(long ptr)
+@ stdcall GetIconInfoExA(long ptr)
+@ stdcall GetIconInfoExW(long ptr)
 @ stub GetInputDesktop
 @ stdcall GetInputState()
 @ stdcall GetInternalWindowPos(long ptr ptr)
diff --git a/include/winuser.h b/include/winuser.h
index 82d0e2e..9d07ef6 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -2107,6 +2107,34 @@ typedef struct _ICONINFO {
 	HBITMAP	hbmColor;
 } ICONINFO, *PICONINFO;
 
+typedef struct _ICONINFOEXA
+{
+    DWORD     cbSize;
+    BOOL      fIcon;
+    DWORD     xHotspot;
+    DWORD     yHotspot;
+    HBITMAP   hbmMask;
+    HBITMAP   hbmColor;
+    WORD      wResID;
+    CHAR      szModName[MAX_PATH];
+    CHAR      szResName[MAX_PATH];
+} ICONINFOEXA, *PICONINFOEXA;
+
+typedef struct _ICONINFOEXW
+{
+    DWORD     cbSize;
+    BOOL      fIcon;
+    DWORD     xHotspot;
+    DWORD     yHotspot;
+    HBITMAP   hbmMask;
+    HBITMAP   hbmColor;
+    WORD      wResID;
+    WCHAR     szModName[MAX_PATH];
+    WCHAR     szResName[MAX_PATH];
+} ICONINFOEXW, *PICONINFOEXW;
+
+DECL_WINELIB_TYPE_AW(ICONINFOEX);
+DECL_WINELIB_TYPE_AW(PICONINFOEX);
 
 typedef struct tagCURSORINFO
 {
@@ -4633,6 +4661,9 @@ WINUSERAPI HWND        WINAPI GetFocus(void);
 WINUSERAPI HWND        WINAPI GetForegroundWindow(void);
 WINUSERAPI BOOL        WINAPI GetGUIThreadInfo(DWORD,GUITHREADINFO*);
 WINUSERAPI BOOL        WINAPI GetIconInfo(HICON,PICONINFO);
+WINUSERAPI BOOL        WINAPI GetIconInfoExA(HICON,ICONINFOEXA*);
+WINUSERAPI BOOL        WINAPI GetIconInfoExW(HICON,ICONINFOEXW*);
+#define                       GetIconInfoEx WINELIB_NAME_AW(GetIconInfoEx)
 WINUSERAPI BOOL        WINAPI GetInputState(void);
 WINUSERAPI UINT        WINAPI GetInternalWindowPos(HWND,LPRECT,LPPOINT);
 WINUSERAPI UINT        WINAPI GetKBCodePage(void);




More information about the wine-cvs mailing list