Commit 99b94fcc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserThunkedMenuInfo implementation from user32.

parent 4b865129
...@@ -5073,54 +5073,18 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu, UINT first, UINT last, ...@@ -5073,54 +5073,18 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu, UINT first, UINT last,
/********************************************************************** /**********************************************************************
* SetMenuInfo (USER32.@) * SetMenuInfo (USER32.@)
*
* FIXME
* actually use the items to draw the menu
* (recalculate and/or redraw)
*/ */
static BOOL menu_SetMenuInfo( HMENU hMenu, LPCMENUINFO lpmi) BOOL WINAPI SetMenuInfo( HMENU menu, const MENUINFO *info )
{ {
POPUPMENU *menu; TRACE( "(%p %p)\n", menu, info );
if( !(menu = MENU_GetMenu(hMenu))) return FALSE;
if (lpmi->fMask & MIM_BACKGROUND)
menu->hbrBack = lpmi->hbrBack;
if (lpmi->fMask & MIM_HELPID)
menu->dwContextHelpID = lpmi->dwContextHelpID;
if (lpmi->fMask & MIM_MAXHEIGHT)
menu->cyMax = lpmi->cyMax;
if (lpmi->fMask & MIM_MENUDATA) if (!info || info->cbSize != sizeof(*info))
menu->dwMenuData = lpmi->dwMenuData; {
SetLastError( ERROR_INVALID_PARAMETER);
if (lpmi->fMask & MIM_STYLE) return FALSE;
menu->dwStyle = lpmi->dwStyle;
if( lpmi->fMask & MIM_APPLYTOSUBMENUS) {
int i;
MENUITEM *item = menu->items;
for( i = menu->nItems; i; i--, item++)
if( item->fType & MF_POPUP)
menu_SetMenuInfo( item->hSubMenu, lpmi);
} }
return TRUE;
}
BOOL WINAPI SetMenuInfo (HMENU hMenu, LPCMENUINFO lpmi) return NtUserThunkedMenuInfo( menu, info );
{
TRACE("(%p %p)\n", hMenu, lpmi);
if( lpmi && (lpmi->cbSize == sizeof( MENUINFO)) && (menu_SetMenuInfo( hMenu, lpmi))) {
if( lpmi->fMask & MIM_STYLE) {
if (lpmi->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented\n");
if (lpmi->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented\n");
if (lpmi->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented\n");
}
return TRUE;
}
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
} }
/********************************************************************** /**********************************************************************
......
...@@ -451,6 +451,59 @@ BOOL WINAPI NtUserGetMenuItemRect( HWND hwnd, HMENU handle, UINT item, RECT *rec ...@@ -451,6 +451,59 @@ BOOL WINAPI NtUserGetMenuItemRect( HWND hwnd, HMENU handle, UINT item, RECT *rec
return TRUE; return TRUE;
} }
static BOOL set_menu_info( HMENU handle, const MENUINFO *info )
{
POPUPMENU *menu;
if (!(menu = grab_menu_ptr( handle ))) return FALSE;
if (info->fMask & MIM_BACKGROUND) menu->hbrBack = info->hbrBack;
if (info->fMask & MIM_HELPID) menu->dwContextHelpID = info->dwContextHelpID;
if (info->fMask & MIM_MAXHEIGHT) menu->cyMax = info->cyMax;
if (info->fMask & MIM_MENUDATA) menu->dwMenuData = info->dwMenuData;
if (info->fMask & MIM_STYLE) menu->dwStyle = info->dwStyle;
if (info->fMask & MIM_APPLYTOSUBMENUS)
{
int i;
MENUITEM *item = menu->items;
for (i = menu->nItems; i; i--, item++)
if (item->fType & MF_POPUP)
set_menu_info( item->hSubMenu, info);
}
release_menu_ptr( menu );
return TRUE;
}
/**********************************************************************
* NtUserThunkedMenuInfo (win32u.@)
*/
BOOL WINAPI NtUserThunkedMenuInfo( HMENU menu, const MENUINFO *info )
{
TRACE( "(%p %p)\n", menu, info );
if (!info)
{
SetLastError( ERROR_NOACCESS );
return FALSE;
}
if (!set_menu_info( menu, info ))
{
SetLastError( ERROR_INVALID_MENU_HANDLE );
return FALSE;
}
if (info->fMask & MIM_STYLE)
{
if (info->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented\n");
if (info->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented\n");
if (info->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented\n");
}
return TRUE;
}
/* see GetMenuInfo */ /* see GetMenuInfo */
BOOL get_menu_info( HMENU handle, MENUINFO *info ) BOOL get_menu_info( HMENU handle, MENUINFO *info )
{ {
......
...@@ -166,6 +166,7 @@ static void * const syscalls[] = ...@@ -166,6 +166,7 @@ static void * const syscalls[] =
NtUserSetTimer, NtUserSetTimer,
NtUserSetWinEventHook, NtUserSetWinEventHook,
NtUserSetWindowsHookEx, NtUserSetWindowsHookEx,
NtUserThunkedMenuInfo,
NtUserUnhookWinEvent, NtUserUnhookWinEvent,
NtUserUnhookWindowsHookEx, NtUserUnhookWindowsHookEx,
NtUserWindowFromDC, NtUserWindowFromDC,
......
...@@ -1274,7 +1274,7 @@ ...@@ -1274,7 +1274,7 @@
@ stdcall NtUserSystemParametersInfo(long long ptr long) @ stdcall NtUserSystemParametersInfo(long long ptr long)
@ stdcall NtUserSystemParametersInfoForDpi(long long ptr long long) @ stdcall NtUserSystemParametersInfoForDpi(long long ptr long long)
@ stub NtUserTestForInteractiveUser @ stub NtUserTestForInteractiveUser
@ stub NtUserThunkedMenuInfo @ stdcall -syscall NtUserThunkedMenuInfo(long ptr)
@ stub NtUserThunkedMenuItemInfo @ stub NtUserThunkedMenuItemInfo
@ stdcall NtUserToUnicodeEx(long long ptr ptr long long long) @ stdcall NtUserToUnicodeEx(long long ptr ptr long long long)
@ stub NtUserTrackMouseEvent @ stub NtUserTrackMouseEvent
......
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
SYSCALL_ENTRY( NtUserSetTimer ) \ SYSCALL_ENTRY( NtUserSetTimer ) \
SYSCALL_ENTRY( NtUserSetWinEventHook ) \ SYSCALL_ENTRY( NtUserSetWinEventHook ) \
SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \ SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \
SYSCALL_ENTRY( NtUserThunkedMenuInfo ) \
SYSCALL_ENTRY( NtUserUnhookWinEvent ) \ SYSCALL_ENTRY( NtUserUnhookWinEvent ) \
SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \ SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \
SYSCALL_ENTRY( NtUserWindowFromDC ) SYSCALL_ENTRY( NtUserWindowFromDC )
......
...@@ -658,3 +658,32 @@ NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args ) ...@@ -658,3 +658,32 @@ NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args )
return NtUserSetMenuContextHelpId( menu, id ); return NtUserSetMenuContextHelpId( menu, id );
} }
NTSTATUS WINAPI wow64_NtUserThunkedMenuInfo( UINT *args )
{
HMENU menu = get_handle( &args );
const struct
{
DWORD cbSize;
DWORD fMask;
DWORD dwStyle;
UINT cyMax;
ULONG hbrBack;
DWORD dwContextHelpID;
ULONG dwMenuData;
} *info32 = get_ptr( &args );
MENUINFO info;
if (info32)
{
info.cbSize = sizeof(info);
info.fMask = info32->fMask;
info.dwStyle = info32->dwStyle;
info.cyMax = info32->cyMax;
info.hbrBack = UlongToHandle( info32->hbrBack );
info.dwContextHelpID = info32->dwContextHelpID;
info.dwMenuData = info32->dwMenuData;
}
return NtUserThunkedMenuInfo( menu, info32 ? &info : NULL );
}
...@@ -580,6 +580,7 @@ BOOL WINAPI NtUserShowWindow( HWND hwnd, INT cmd ); ...@@ -580,6 +580,7 @@ BOOL WINAPI NtUserShowWindow( HWND hwnd, INT cmd );
BOOL WINAPI NtUserShowWindowAsync( HWND hwnd, INT cmd ); BOOL WINAPI NtUserShowWindowAsync( HWND hwnd, INT cmd );
BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT winini ); BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT winini );
BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi ); BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi );
BOOL WINAPI NtUserThunkedMenuInfo( HMENU menu, const MENUINFO *info );
INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state, INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
INT WINAPI NtUserTranslateAccelerator( HWND hwnd, HACCEL accel, MSG *msg ); INT WINAPI NtUserTranslateAccelerator( HWND hwnd, HACCEL accel, MSG *msg );
......
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