Commit 78222062 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move GetMenuInfo implementation from user32.

parent 9015ae59
......@@ -5124,40 +5124,11 @@ BOOL WINAPI SetMenuInfo (HMENU hMenu, LPCMENUINFO lpmi)
}
/**********************************************************************
* GetMenuInfo (USER32.@)
*
* NOTES
* win98/NT5.0
*
* GetMenuInfo (USER32.@)
*/
BOOL WINAPI GetMenuInfo (HMENU hMenu, LPMENUINFO lpmi)
BOOL WINAPI GetMenuInfo( HMENU menu, MENUINFO *info )
{
POPUPMENU *menu;
TRACE("(%p %p)\n", hMenu, lpmi);
if (lpmi && (lpmi->cbSize == sizeof(MENUINFO)) && (menu = grab_menu_ptr(hMenu)))
{
if (lpmi->fMask & MIM_BACKGROUND)
lpmi->hbrBack = menu->hbrBack;
if (lpmi->fMask & MIM_HELPID)
lpmi->dwContextHelpID = menu->dwContextHelpID;
if (lpmi->fMask & MIM_MAXHEIGHT)
lpmi->cyMax = menu->cyMax;
if (lpmi->fMask & MIM_MENUDATA)
lpmi->dwMenuData = menu->dwMenuData;
if (lpmi->fMask & MIM_STYLE)
lpmi->dwStyle = menu->dwStyle;
release_menu_ptr(menu);
return TRUE;
}
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
return NtUserGetMenuInfo( menu, info );
}
......
......@@ -451,6 +451,29 @@ BOOL WINAPI NtUserGetMenuItemRect( HWND hwnd, HMENU handle, UINT item, RECT *rec
return TRUE;
}
/* see GetMenuInfo */
BOOL get_menu_info( HMENU handle, MENUINFO *info )
{
POPUPMENU *menu;
TRACE( "(%p %p)\n", handle, info );
if (!info || info->cbSize != sizeof(MENUINFO) || !(menu = grab_menu_ptr( handle )))
{
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
}
if (info->fMask & MIM_BACKGROUND) info->hbrBack = menu->hbrBack;
if (info->fMask & MIM_HELPID) info->dwContextHelpID = menu->dwContextHelpID;
if (info->fMask & MIM_MAXHEIGHT) info->cyMax = menu->cyMax;
if (info->fMask & MIM_MENUDATA) info->dwMenuData = menu->dwMenuData;
if (info->fMask & MIM_STYLE) info->dwStyle = menu->dwStyle;
release_menu_ptr(menu);
return TRUE;
}
/**********************************************************************
* NtUserSetMenuContextHelpId (win32u.@)
*/
......
......@@ -4762,6 +4762,9 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
{
switch(code)
{
case NtUserCallTwoParam_GetMenuInfo:
return get_menu_info( UlongToHandle(arg1), (MENUINFO *)arg2 );
case NtUserCallTwoParam_GetMonitorInfo:
return get_monitor_info( UlongToHandle(arg1), (MONITORINFO *)arg2 );
......
......@@ -359,6 +359,7 @@ extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN;
extern HMENU create_menu( BOOL is_popup ) DECLSPEC_HIDDEN;
extern BOOL draw_menu_bar( HWND hwnd ) DECLSPEC_HIDDEN;
extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN;
extern BOOL set_window_menu( HWND hwnd, HMENU handle ) DECLSPEC_HIDDEN;
/* message.c */
......
......@@ -745,6 +745,7 @@ static inline UINT NtUserRealizePalette( HDC hdc )
/* NtUserCallTwoParam codes, not compatible with Windows */
enum
{
NtUserCallTwoParam_GetMenuInfo,
NtUserCallTwoParam_GetMonitorInfo,
NtUserCallTwoParam_GetSystemMetricsForDpi,
NtUserCallTwoParam_MonitorFromRect,
......@@ -756,6 +757,12 @@ enum
NtUserGetHandlePtr,
};
static inline BOOL NtUserGetMenuInfo( HMENU menu, MENUINFO *info )
{
return NtUserCallTwoParam( HandleToUlong(menu), (ULONG_PTR)info,
NtUserCallTwoParam_GetMenuInfo );
}
static inline BOOL NtUserGetMonitorInfo( HMONITOR monitor, MONITORINFO *info )
{
return NtUserCallTwoParam( HandleToUlong(monitor), (ULONG_PTR)info,
......
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