[PATCH] Ensure that GetSystemMenu returns valid HMENU unless bRevert explicitly requested
Brent Roman
brent at mbari.org
Wed Jul 1 00:30:01 CDT 2009
---
dlls/user32/menu.c | 61 ++++++++++++++++++++++++---------------------------
1 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index ab473ea..6b73499 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -4104,39 +4104,36 @@ BOOL WINAPI DestroyMenu( HMENU hMenu )
*/
HMENU WINAPI GetSystemMenu( HWND hWnd, BOOL bRevert )
{
- WND *wndPtr = WIN_GetPtr( hWnd );
- HMENU retvalue = 0;
-
- if (wndPtr == WND_DESKTOP) return 0;
- if (wndPtr == WND_OTHER_PROCESS)
- {
- if (IsWindow( hWnd )) FIXME( "not supported on other process window %p\n", hWnd );
- }
- else if (wndPtr)
- {
- if (wndPtr->hSysMenu && bRevert)
- {
- DestroyMenu(wndPtr->hSysMenu);
- wndPtr->hSysMenu = 0;
- }
-
- if(!wndPtr->hSysMenu && (wndPtr->dwStyle & WS_SYSMENU) )
- wndPtr->hSysMenu = MENU_GetSysMenu( hWnd, 0 );
-
- if( wndPtr->hSysMenu )
- {
- POPUPMENU *menu;
- retvalue = GetSubMenu(wndPtr->hSysMenu, 0);
-
- /* Store the dummy sysmenu handle to facilitate the refresh */
- /* of the close button if the SC_CLOSE item change */
- menu = MENU_GetMenu(retvalue);
- if ( menu )
- menu->hSysMenuOwner = wndPtr->hSysMenu;
- }
- WIN_ReleasePtr( wndPtr );
- }
- return bRevert ? 0 : retvalue;
+ WND *wndPtr = WIN_GetPtr( hWnd );
+ HMENU retvalue = 0;
+
+ if (wndPtr == WND_DESKTOP) return 0;
+ if (wndPtr == WND_OTHER_PROCESS) {
+ if (IsWindow( hWnd ))
+ FIXME( "not supported on other process window %p\n", hWnd );
+ }else if (wndPtr) {
+ if (bRevert) {
+ if (wndPtr->hSysMenu) {
+ DestroyMenu(wndPtr->hSysMenu);
+ wndPtr->hSysMenu = 0;
+ }
+ }else{
+ if(!wndPtr->hSysMenu)
+ wndPtr->hSysMenu = MENU_GetSysMenu( hWnd, 0 );
+ if( wndPtr->hSysMenu ) {
+ POPUPMENU *menu;
+ retvalue = GetSubMenu(wndPtr->hSysMenu, 0);
+
+ /* Store the dummy sysmenu handle to facilitate the refresh */
+ /* of the close button if the SC_CLOSE item change */
+ menu = MENU_GetMenu(retvalue);
+ if( menu )
+ menu->hSysMenuOwner = wndPtr->hSysMenu;
+ }
+ }
+ WIN_ReleasePtr( wndPtr );
+ }
+ return retvalue;
}
--
1.6.1.76.gc123b
--------------000701030506040201020101--
More information about the wine-patches
mailing list