Jacek Caban : win32u: Move GetMenuInfo implementation from user32.
Alexandre Julliard
julliard at winehq.org
Wed Apr 20 16:49:49 CDT 2022
Module: wine
Branch: master
Commit: 782220626fa7148d0d7421a5f7e632083a4b89f2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=782220626fa7148d0d7421a5f7e632083a4b89f2
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Apr 20 15:58:00 2022 +0200
win32u: Move GetMenuInfo implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/menu.c | 35 +++--------------------------------
dlls/win32u/menu.c | 23 +++++++++++++++++++++++
dlls/win32u/sysparams.c | 3 +++
dlls/win32u/win32u_private.h | 1 +
include/ntuser.h | 7 +++++++
5 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 2585f92f97d..b1f038938f6 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -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 );
}
diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c
index afe4c148775..fd4e1f74039 100644
--- a/dlls/win32u/menu.c
+++ b/dlls/win32u/menu.c
@@ -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.@)
*/
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 32da544c157..49f3f716b2d 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -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 );
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index f3a751f1836..2299330be0d 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -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 */
diff --git a/include/ntuser.h b/include/ntuser.h
index 8420784a5a0..bab4a0dc78c 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -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,
More information about the wine-cvs
mailing list