win32u: Move NtUserDeleteMenu implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-15 00:42:16 +02:00 committed by Alexandre Julliard
parent dc0d16f192
commit 189da79a18
9 changed files with 39 additions and 28 deletions

View File

@ -945,11 +945,11 @@ static BOOL MDI_RestoreFrameMenu( HWND frame, HWND hChild )
}
/* close */
DeleteMenu(menu, SC_CLOSE, MF_BYCOMMAND);
NtUserDeleteMenu( menu, SC_CLOSE, MF_BYCOMMAND );
/* restore */
DeleteMenu(menu, SC_RESTORE, MF_BYCOMMAND);
NtUserDeleteMenu( menu, SC_RESTORE, MF_BYCOMMAND );
/* minimize */
DeleteMenu(menu, SC_MINIMIZE, MF_BYCOMMAND);
NtUserDeleteMenu( menu, SC_MINIMIZE, MF_BYCOMMAND );
DrawMenuBar(frame);

View File

@ -410,7 +410,7 @@ static HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
if (hPopupMenu)
{
if (GetClassLongW(hWnd, GCL_STYLE) & CS_NOCLOSE)
DeleteMenu(hPopupMenu, SC_CLOSE, MF_BYCOMMAND);
NtUserDeleteMenu( hPopupMenu, SC_CLOSE, MF_BYCOMMAND );
InsertMenuW( hMenu, -1, MF_SYSMENU | MF_POPUP | MF_BYPOSITION,
(UINT_PTR)hPopupMenu, NULL );
@ -3540,7 +3540,7 @@ BOOL WINAPI ChangeMenuA( HMENU hMenu, UINT pos, LPCSTR data,
TRACE("menu=%p pos=%d data=%p id=%08x flags=%08x\n", hMenu, pos, data, id, flags );
if (flags & MF_APPEND) return AppendMenuA( hMenu, flags & ~MF_APPEND,
id, data );
if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
if (flags & MF_DELETE) return NtUserDeleteMenu( hMenu, pos, flags & ~MF_DELETE );
if (flags & MF_CHANGE) return ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE,
id, data );
if (flags & MF_REMOVE) return NtUserRemoveMenu( hMenu,
@ -3560,7 +3560,7 @@ BOOL WINAPI ChangeMenuW( HMENU hMenu, UINT pos, LPCWSTR data,
TRACE("menu=%p pos=%d data=%p id=%08x flags=%08x\n", hMenu, pos, data, id, flags );
if (flags & MF_APPEND) return AppendMenuW( hMenu, flags & ~MF_APPEND,
id, data );
if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
if (flags & MF_DELETE) return NtUserDeleteMenu( hMenu, pos, flags & ~MF_DELETE );
if (flags & MF_CHANGE) return ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE,
id, data );
if (flags & MF_REMOVE) return NtUserRemoveMenu( hMenu,
@ -3825,26 +3825,6 @@ BOOL WINAPI AppendMenuW( HMENU hMenu, UINT flags,
}
/**********************************************************************
* DeleteMenu (USER32.@)
*/
BOOL WINAPI DeleteMenu( HMENU hMenu, UINT id, UINT flags )
{
POPUPMENU *menu;
UINT pos;
if (!(menu = find_menu_item(hMenu, id, flags, &pos)))
return FALSE;
if (menu->items[pos].fType & MF_POPUP)
NtUserDestroyMenu( menu->items[pos].hSubMenu );
NtUserRemoveMenu( menu->obj.handle, pos, flags | MF_BYPOSITION );
release_menu_ptr(menu);
return TRUE;
}
/*******************************************************************
* ModifyMenuW (USER32.@)
*/

View File

@ -153,7 +153,7 @@
@ stdcall DefWindowProcA(long long long long)
@ stdcall DefWindowProcW(long long long long)
@ stdcall DeferWindowPos(long long long long long long long long)
@ stdcall DeleteMenu(long long long)
@ stdcall DeleteMenu(long long long) NtUserDeleteMenu
@ stdcall DeregisterShellHookWindow (long)
@ stdcall DestroyAcceleratorTable(long) NtUserDestroyAcceleratorTable
@ stdcall DestroyCaret()

View File

@ -976,6 +976,25 @@ BOOL WINAPI NtUserRemoveMenu( HMENU handle, UINT id, UINT flags )
return TRUE;
}
/**********************************************************************
* NtUserDeleteMenu (win32u.@)
*/
BOOL WINAPI NtUserDeleteMenu( HMENU handle, UINT id, UINT flags )
{
POPUPMENU *menu;
UINT pos;
if (!(menu = find_menu_item( handle, id, flags, &pos )))
return FALSE;
if (menu->items[pos].fType & MF_POPUP)
NtUserDestroyMenu( menu->items[pos].hSubMenu );
NtUserRemoveMenu( menu->obj.handle, pos, flags | MF_BYPOSITION );
release_menu_ptr( menu );
return TRUE;
}
/**********************************************************************
* NtUserSetMenuContextHelpId (win32u.@)
*/

View File

@ -114,6 +114,7 @@ static void * const syscalls[] =
NtUserCreateAcceleratorTable,
NtUserCreateDesktopEx,
NtUserCreateWindowStation,
NtUserDeleteMenu,
NtUserDestroyAcceleratorTable,
NtUserFindExistingCursorIcon,
NtUserFindWindowEx,

View File

@ -824,7 +824,7 @@
@ stdcall NtUserDeferWindowPosAndBand(long long long long long long long long long long)
@ stub NtUserDelegateCapturePointers
@ stub NtUserDelegateInput
@ stub NtUserDeleteMenu
@ stdcall -syscall NtUserDeleteMenu(long long long)
@ stub NtUserDeleteWindowGroup
@ stdcall -syscall NtUserDestroyAcceleratorTable(long)
@ stub NtUserDestroyActivationGroup

View File

@ -101,6 +101,7 @@
SYSCALL_ENTRY( NtUserCreateAcceleratorTable ) \
SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
SYSCALL_ENTRY( NtUserCreateWindowStation ) \
SYSCALL_ENTRY( NtUserDeleteMenu ) \
SYSCALL_ENTRY( NtUserDestroyAcceleratorTable ) \
SYSCALL_ENTRY( NtUserFindExistingCursorIcon ) \
SYSCALL_ENTRY( NtUserFindWindowEx ) \

View File

@ -669,6 +669,15 @@ NTSTATUS WINAPI wow64_NtUserCheckMenuItem( UINT *args )
return NtUserCheckMenuItem( handle, id, flags );
}
NTSTATUS WINAPI wow64_NtUserDeleteMenu( UINT *args )
{
HMENU menu = get_handle( &args );
UINT id = get_ulong( &args );
UINT flags = get_ulong( &args );
return NtUserDeleteMenu( menu, id, flags );
}
NTSTATUS WINAPI wow64_NtUserGetMenuItemRect( UINT *args )
{
HWND hwnd = get_handle( &args );

View File

@ -487,6 +487,7 @@ HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK m
ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
HDWP WINAPI NtUserDeferWindowPosAndBand( HDWP hdwp, HWND hwnd, HWND after, INT x, INT y,
INT cx, INT cy, UINT flags, UINT unk1, UINT unk2 );
BOOL WINAPI NtUserDeleteMenu( HMENU menu, UINT id, UINT flags );
BOOL WINAPI NtUserDestroyAcceleratorTable( HACCEL handle );
BOOL WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg );
BOOL WINAPI NtUserDestroyMenu( HMENU menu );