From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/menu.c | 12 ++---------- dlls/win32u/menu.c | 14 ++++++++++++++ dlls/win32u/sysparams.c | 3 +++ dlls/win32u/win32u_private.h | 1 + include/ntuser.h | 6 ++++++ 5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index e81fc086918..9f51fa555f8 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -3696,17 +3696,9 @@ UINT WINAPI GetMenuState( HMENU menu, UINT item, UINT flags ) /********************************************************************** * GetMenuItemCount (USER32.@) */ -INT WINAPI GetMenuItemCount( HMENU hMenu ) +INT WINAPI GetMenuItemCount( HMENU menu ) { - POPUPMENU *menu = grab_menu_ptr(hMenu); - INT count; - - if (!menu) return -1; - count = menu->nItems; - release_menu_ptr(menu); - - TRACE("(%p) returning %d\n", hMenu, count); - return count; + return NtUserGetMenuItemCount( menu ); }
diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 0f918a4762d..8544cca47b4 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -864,6 +864,20 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT return ret; }
+/* see GetMenuItemCount */ +INT get_menu_item_count( HMENU handle ) +{ + POPUPMENU *menu; + INT count; + + if (!(menu = grab_menu_ptr( handle ))) return -1; + count = menu->nItems; + release_menu_ptr(menu); + + TRACE( "(%p) returning %d\n", handle, count ); + return count; +} + /********************************************************************** * NtUserRemoveMenu (win32u.@) */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 3cf03d68399..114016954aa 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4718,6 +4718,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_GetIconParam: return get_icon_param( UlongToHandle(arg) );
+ case NtUserCallOneParam_GetMenuItemCount: + return get_menu_item_count( UlongToHandle(arg) ); + case NtUserCallOneParam_GetSysColor: return get_sys_color( arg );
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index caf77590559..537eec38a34 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -377,6 +377,7 @@ 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 INT get_menu_item_count( HMENU handle ) 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 75c16e412c0..1876b32c84b 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -704,6 +704,7 @@ enum NtUserCallOneParam_GetClipCursor, NtUserCallOneParam_GetCursorPos, NtUserCallOneParam_GetIconParam, + NtUserCallOneParam_GetMenuItemCount, NtUserCallOneParam_GetPrimaryMonitorRect, NtUserCallOneParam_GetSysColor, NtUserCallOneParam_GetSysColorBrush, @@ -773,6 +774,11 @@ static inline UINT_PTR NtUserGetIconParam( HICON icon ) return NtUserCallOneParam( HandleToUlong(icon), NtUserCallOneParam_GetIconParam ); }
+static inline UINT_PTR NtUserGetMenuItemCount( HMENU menu ) +{ + return NtUserCallOneParam( HandleToUlong(menu), NtUserCallOneParam_GetMenuItemCount ); +} + static inline RECT NtUserGetPrimaryMonitorRect(void) { RECT primary;