Author: jimtabor
Date: Tue Mar 18 21:54:59 2014
New Revision: 62533
URL:
http://svn.reactos.org/svn/reactos?rev=62533&view=rev
Log:
[NtUser|User32]
- Fix HiliteMenuItem tests, see CORE-7967.
Modified:
trunk/reactos/win32ss/user/ntuser/menu.c
trunk/reactos/win32ss/user/user32/user32.spec
trunk/reactos/win32ss/user/user32/windows/menu.c
Modified: trunk/reactos/win32ss/user/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Tue Mar 18 21:54:59 2014
@@ -485,8 +485,11 @@
int FASTCALL
-IntGetMenuItemByFlag(PMENU_OBJECT Menu, UINT uSearchBy, UINT fFlag,
- PMENU_OBJECT *SubMenu, PMENU_ITEM *MenuItem,
+IntGetMenuItemByFlag(PMENU_OBJECT Menu,
+ UINT uSearchBy,
+ UINT fFlag,
+ PMENU_OBJECT *SubMenu,
+ PMENU_ITEM *MenuItem,
PMENU_ITEM *PrevMenuItem)
{
PMENU_ITEM PrevItem = NULL;
@@ -1039,17 +1042,22 @@
}
BOOL FASTCALL
-IntHiliteMenuItem(PWND WindowObject, PMENU_OBJECT MenuObject,
- UINT uItemHilite, UINT uHilite)
+IntHiliteMenuItem(PWND WindowObject,
+ PMENU_OBJECT MenuObject,
+ UINT uItemHilite,
+ UINT uHilite)
{
PMENU_ITEM MenuItem;
- BOOL res = IntGetMenuItemByFlag(MenuObject, uItemHilite, uHilite, NULL, &MenuItem,
NULL);
- if(!MenuItem || !res)
+ int Pos;
+
+ Pos = IntGetMenuItemByFlag(MenuObject, uItemHilite, uHilite, NULL, &MenuItem,
NULL);
+
+ if (!MenuItem || (uHilite & MF_BYPOSITION && Pos == -1))
{
return FALSE;
}
- if(uHilite & MF_HILITE)
+ if (uHilite & MF_HILITE)
{
MenuItem->fState |= MF_HILITE;
}
@@ -2058,12 +2066,7 @@
RETURN(FALSE);
}
- if(Window->IDMenu == (UINT)(UINT_PTR)hMenu)
- {
- RETURN( IntHiliteMenuItem(Window, Menu, uItemHilite, uHilite));
- }
-
- RETURN(FALSE);
+ RETURN( IntHiliteMenuItem(Window, Menu, uItemHilite, uHilite));
CLEANUP:
TRACE("Leave NtUserHiliteMenuItem, ret=%u\n",_ret_);
@@ -2224,7 +2227,7 @@
EngSetLastError(ERROR_INVALID_PARAMETER);
// This will crash menu (line 80) correct_behavior test!
// "NT4 and below can't handle a bigger MENUITEMINFO struct"
- //EngSetLastError(ERROR_MENU_ITEM_NOT_FOUND);
+// EngSetLastError(ERROR_MENU_ITEM_NOT_FOUND);
return( FALSE);
}
Modified: trunk/reactos/win32ss/user/user32/user32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/user32…
==============================================================================
--- trunk/reactos/win32ss/user/user32/user32.spec [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/user32.spec [iso-8859-1] Tue Mar 18 21:54:59 2014
@@ -387,7 +387,7 @@
@ stdcall GrayStringA(long long ptr long long long long long long)
@ stdcall GrayStringW(long long ptr long long long long long long)
@ stdcall HideCaret(long) NtUserHideCaret
-@ stdcall HiliteMenuItem(long long long long) NtUserHiliteMenuItem
+@ stdcall HiliteMenuItem(long long long long) ; Use both ReactOS and wine
NtUserHiliteMenuItem
@ stdcall IMPGetIMEA(long ptr)
@ stdcall IMPGetIMEW(long ptr)
@ stdcall IMPQueryIMEA(ptr)
Modified: trunk/reactos/win32ss/user/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] Tue Mar 18 21:54:59
2014
@@ -4181,20 +4181,17 @@
return TRUE;
}
-// So this one maybe one day it will be a callback!
BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
UINT wHilite )
{
ROSMENUINFO MenuInfo;
- ROSMENUITEMINFO mii;
TRACE("(%p, %p, %04x, %04x);\n", hWnd, hMenu, wItemID, wHilite);
- if (!hWnd)
- {
- SetLastError(ERROR_INVALID_WINDOW_HANDLE);
- return FALSE;
- }
- if (!NtUserMenuItemInfo(hMenu, wItemID, wHilite, &mii, FALSE)) return FALSE;
- if (!NtUserMenuInfo(hMenu, &MenuInfo, FALSE)) return FALSE;
+ // Force bits to be set call server side....
+ // This alone works and passes all the menu test_menu_hilitemenuitem tests.
+ if (!NtUserHiliteMenuItem(hWnd, hMenu, wItemID, wHilite)) return FALSE;
+ // Without the above call we fail 3 out of the wine failed todo tests, see CORE-7967
+ // Now redraw menu.
+ if (!MenuGetRosMenuInfo(&MenuInfo, hMenu)) return FALSE;
if (MenuInfo.FocusedItem == wItemID) return TRUE;
MenuHideSubPopups( hWnd, &MenuInfo, FALSE, 0 );
MenuSelectItem( hWnd, &MenuInfo, wItemID, TRUE, 0 );