diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index ce25a9d649b..cea55527ccd 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -1865,20 +1865,73 @@ HICON WINAPI LoadIconA(HINSTANCE hInstance, LPCSTR name) * GetIconInfo (USER32.@) */ BOOL WINAPI GetIconInfo(HICON hIcon, PICONINFO iconinfo) +{ + 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; +} + +/********************************************************************** + * GetIconInfoExA (USER32.@) + */ +BOOL WINAPI GetIconInfoExA( HICON icon, ICONINFOEXA *info ) +{ + ICONINFOEXW infoW; + + 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; +} + +/********************************************************************** + * GetIconInfoExW (USER32.@) + */ +BOOL WINAPI GetIconInfoExW( HICON icon, ICONINFOEXW *info ) { struct cursoricon_object *ptr; - if (!(ptr = get_icon_ptr( hIcon ))) return FALSE; + 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", hIcon, ptr->width, ptr->height); - - 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 ); + 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 b5f6d874767..072fed45593 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 82d0e2e3ffd..9d07ef66604 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);