Index: trunk/src/user32/new/controls.cpp
===================================================================
--- trunk/src/user32/new/controls.cpp	(revision 2394)
+++ trunk/src/user32/new/controls.cpp	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: controls.cpp,v 1.14 2000-01-02 19:30:42 cbratschi Exp $ */
+/* $Id: controls.cpp,v 1.15 2000-01-10 17:18:07 cbratschi Exp $ */
 /* File: controls.cpp -- Win32 common controls
  *
@@ -19,4 +19,5 @@
 #include "winswitch.h"
 #include "icontitle.h"
+#include "menu.h"
 #include "controls.h"
 
@@ -74,4 +75,8 @@
   controlAtoms[ICONTITLE_CONTROL] = ICONTITLE_Register();
   if (!controlAtoms[ICONTITLE_CONTROL]) dprintf(("failed!!!"));
+
+  dprintf(("Register POPUPMENU class"));
+  controlAtoms[POPUPMENU_CONTROL] = POPUPMENU_Register();
+  if (!controlAtoms[POPUPMENU_CONTROL]) dprintf(("failed!!!"));
 }
 
@@ -113,4 +118,8 @@
   dprintf(("Unregister ICONTITLE class"));
   if (!ICONTITLE_Unregister()) dprintf(("failed!!!"));
+
+  dprintf(("Unregister POPUPMENU class"));
+  if (!POPUPMENU_Unregister()) dprintf(("failed!!!"));
+
 }
 
Index: trunk/src/user32/new/controls.h
===================================================================
--- trunk/src/user32/new/controls.h	(revision 2394)
+++ trunk/src/user32/new/controls.h	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: controls.h,v 1.2 2000-01-02 19:30:42 cbratschi Exp $ */
+/* $Id: controls.h,v 1.3 2000-01-10 17:18:07 cbratschi Exp $ */
 /*
  * Win32 common controls
@@ -31,5 +31,6 @@
 #define WINSWITCH_CONTROL       10
 #define ICONTITLE_CONTROL       11
-#define MAX_CONTROLS            12
+#define POPUPMENU_CONTROL       12
+#define MAX_CONTROLS            13
 
 BOOL CONTROLS_IsControl(Win32BaseWindow *window, int control);
Index: trunk/src/user32/new/makefile
===================================================================
--- trunk/src/user32/new/makefile	(revision 2394)
+++ trunk/src/user32/new/makefile	(revision 2396)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.54 2000-01-09 14:14:22 cbratschi Exp $
+# $Id: makefile,v 1.55 2000-01-10 17:18:07 cbratschi Exp $
 
 #
@@ -31,5 +31,5 @@
 OBJS =  user32.obj loadres.obj \
         dde.obj win32wndhandle.obj wsprintf.obj winmouse.obj \
-        icon.obj hook.obj winmenu.obj winkeyboard.obj \
+        icon.obj hook.obj winkeyboard.obj \
         defwndproc.obj syscolor.obj char.obj initterm.obj \
         uitools.obj unknown.obj spy.obj wndmsg.obj display.obj \
@@ -37,9 +37,9 @@
         msgbox.obj window.obj windowmsg.obj windowclass.obj win32wbase.obj \
         windowword.obj gen_object.obj oslibwin.obj win32wndchild.obj \
-        controls.obj button.obj static.obj scroll.obj listbox.obj \
+        controls.obj button.obj static.obj scroll.obj listbox.obj menu.obj\
         combo.obj edit.obj winswitch.obj icontitle.obj clipboard.obj winicon.obj \
         win32wmdiclient.obj oslibutil.obj oslibmsg.obj dib.obj oslibdos.obj \
         win32wmdichild.obj winprop.obj wingdi.obj oslibgdi.obj winaccel.obj \
-        win32wbasepos.obj oslibres.obj dummy.obj oslibmenu.obj dc.obj timer.obj \
+        win32wbasepos.obj oslibres.obj dummy.obj dc.obj timer.obj \
         caret.obj resource.obj winproc.obj text.obj oslibmsgtranslate.obj \
         windlgmsg.obj windlg.obj win32wdesktop.obj
@@ -94,5 +94,4 @@
 loadres.obj: loadres.cpp user32.h dib.h
 icon.obj: icon.cpp $(PDWIN32_INCLUDE)\winicon.h
-winmenu.obj: winmenu.cpp user32.h $(PDWIN32_INCLUDE)\winres.h win32wbase.h winmenudef.h oslibwin.h oslibmenu.h
 syscolor.obj: syscolor.cpp syscolor.h
 dde.obj: dde.cpp
@@ -135,5 +134,5 @@
 win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h controls.h winmouse.h $(PDWIN32_INCLUDE)\win\winproc.h $(PDWIN32_INCLUDE)\win\hook.h oslibmsg.h
 win32wbasepos.obj: win32wbasepos.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h
-win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
+win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h
 win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h oslibmsg.h controls.h $(PDWIN32_INCLUDE)\win\winproc.h
 win32wndchild.obj: win32wndchild.cpp win32wndchild.h gen_object.h
@@ -146,5 +145,4 @@
 oslibmsg.obj:   oslibmsg.cpp oslibmsg.h timer.h win32wbase.h win32wnd.h $(PDWIN32_INCLUDE)\win\thread.h
 oslibmsgtranslate.obj: oslibmsgtranslate.cpp oslibmsg.h timer.h win32wbase.h win32wnd.h $(PDWIN32_INCLUDE)\win\thread.h
-oslibmenu.obj:  oslibmenu.cpp oslibmenu.h
 oslibgdi.obj:   oslibgdi.cpp oslibgdi.h win32wbase.h
 oslibres.obj:   oslibres.cpp oslibwin.h oslibres.h $(PDWIN32_INCLUDE)\winconst.h
Index: trunk/src/user32/new/menu.cpp
===================================================================
--- trunk/src/user32/new/menu.cpp	(revision 2394)
+++ trunk/src/user32/new/menu.cpp	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: menu.cpp,v 1.4 2000-01-01 14:57:16 cbratschi Exp $*/
+/* $Id: menu.cpp,v 1.5 2000-01-10 17:18:08 cbratschi Exp $*/
 /*
  * Menu functions
@@ -274,7 +274,34 @@
 #undef MENUFLAG
 
-#define USER_HEAP_LIN_ADDR(a) ((PVOID)a)
-#define USER_HEAP_ALLOC(size) HeapAlloc(GetProcessHeap(),0,size)
-#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle)
+//#define USER_HEAP_ALLOC(size) HeapAlloc(GetProcessHeap(),0,size)
+//#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle)
+
+HMENU getMenu(HWND hwnd)
+{
+  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+
+  return win32wnd ? win32wnd->GetMenu():(HMENU)0;
+}
+
+VOID setMenu(HWND hwnd,HMENU hMenu)
+{
+  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+
+  if (win32wnd) win32wnd->SetMenu(hMenu);
+}
+
+HMENU getSysMenu(HWND hwnd)
+{
+  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+
+  return win32wnd ? win32wnd->GetSysMenu():(HMENU)0;
+}
+
+VOID setSysMenu(HWND hwnd,HMENU hMenu)
+{
+  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+
+  win32wnd->SetSysMenu(hMenu);
+}
 
 /***********************************************************************
@@ -288,5 +315,5 @@
 
     if( hMenu ) {
-        POPUPMENU* menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu);
+        POPUPMENU* menu = (POPUPMENU*)hMenu;
         menu->wFlags |= MF_SYSMENU | MF_POPUP;
         SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE);
@@ -347,5 +374,5 @@
     if (hMenu)
     {
-        POPUPMENU *menu = (POPUPMENU*) USER_HEAP_LIN_ADDR(hMenu);
+        POPUPMENU *menu = (POPUPMENU*)hMenu;
         menu->wFlags = MF_SYSMENU;
         menu->hWnd = hWnd;
@@ -361,5 +388,5 @@
             menu->items[0].fType = MF_SYSMENU | MF_POPUP;
             menu->items[0].fState = 0;
-            menu = (POPUPMENU*) USER_HEAP_LIN_ADDR(hPopupMenu);
+            menu = (POPUPMENU*)hPopupMenu;
             menu->wFlags |= MF_SYSMENU;
 
@@ -487,5 +514,5 @@
     HMENU  hMenu )
 {
-    POPUPMENU  *menu = (POPUPMENU *)USER_HEAP_LIN_ADDR(hMenu);
+    POPUPMENU  *menu = (POPUPMENU*)hMenu;
     UINT  i = menu->FocusedItem + 1;
 
@@ -515,5 +542,5 @@
     HMENU  hMenu )
 {
-    POPUPMENU const  *menu = (POPUPMENU *)USER_HEAP_LIN_ADDR(hMenu);
+    POPUPMENU const  *menu = (POPUPMENU*)hMenu;
     UINT  i;
 
@@ -556,5 +583,5 @@
     UINT i;
 
-    if (((*hmenu)==0xffff) || (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(*hmenu)))) return NULL;
+    if (((*hmenu)==0xffff) || (!(menu = (POPUPMENU*)*hmenu))) return NULL;
     if (wFlags & MF_BYPOSITION)
     {
@@ -565,4 +592,5 @@
     {
         MENUITEM *item = menu->items;
+
         for (i = 0; i < menu->nItems; i++, item++)
         {
@@ -600,5 +628,5 @@
     MENUITEM *item;
     if (((*hmenu)==0xffff) ||
-            (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(*hmenu))))
+            (!(menu = (POPUPMENU*)*hmenu)))
         return NO_SELECTED_ITEM;
     item = menu->items;
@@ -673,10 +701,10 @@
     if (!IsMenu( hmenu ))
     {
-        hmenu = GetSubMenu(GetSystemMenu(hwndOwner,FALSE), 0);
+        hmenu = GetSubMenu(getSysMenu(hwndOwner), 0);
     }
 
     if (hmenu)
     {
-        POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+        POPUPMENU *menu = (POPUPMENU*)hmenu;
         MENUITEM *item = menu->items;
         LONG menuchar;
@@ -1009,10 +1037,9 @@
     if (lpitem->fType & MF_SYSMENU)
     {
-        if( !IsIconic(hwnd) ) {
-#if 0 //CB: todo
-                NC_DrawSysButton95( hwnd, hdc,
-                                    lpitem->fState &
-                                    (MF_HILITE | MF_MOUSESELECT) );
-#endif
+        if( !IsIconic(hwnd) )
+        {
+          Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+
+          if (win32wnd) win32wnd->DrawSysButton(hdc,lpitem->fState & (MF_HILITE | MF_MOUSESELECT));
         }
 
@@ -1304,5 +1331,5 @@
             /* draw menu items */
 
-            menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+            menu = (POPUPMENU*)hmenu;
             if (menu && menu->nItems)
             {
@@ -1335,5 +1362,5 @@
     HFONT hfontOld = 0;
 
-    lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU)GetWindowLongA(hwnd,GWL_ID));
+    lppop = (LPPOPUPMENU)getMenu(hwnd);
     if (lppop == NULL || lprect == NULL)
     {
@@ -1371,5 +1398,5 @@
     for (i = 0; i < lppop->nItems; i++)
     {
-        MENU_DrawMenuItem( hwnd, (HMENU)GetWindowLongA(hwnd,GWL_ID), GetWindow(hwnd,GW_OWNER),
+        MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
                          hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
     }
@@ -1455,5 +1482,5 @@
     //hwndOwner, hmenu, id, x, y, xanchor, yanchor);
 
-    if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE;
+    if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
     if (menu->FocusedItem != NO_SELECTED_ITEM)
     {
@@ -1499,5 +1526,5 @@
             assert( uSubPWndLevel == 0 );
 
-            pTopPopupWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
+            pTopPopupWnd = CreateWindowA( POPUPMENUCLASSNAME, NULL,
                                           WS_POPUP, x, y, width, height,
                                           hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE),
@@ -1515,5 +1542,5 @@
                 /* create a new window for the submenu */
 
-                menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
+                menu->hWnd = CreateWindowA( POPUPMENUCLASSNAME, NULL,
                                           WS_POPUP, x, y, width, height,
                                           hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE),
@@ -1563,5 +1590,5 @@
     //TRACE("owner=0x%04x menu=0x%04x index=0x%04x select=0x%04x\n", hwndOwner, hmenu, wIndex, sendMenuSelect);
 
-    lppop = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+    lppop = (POPUPMENU*)hmenu;
     if (!lppop->nItems) return;
 
@@ -1604,5 +1631,5 @@
             int pos;
             if((pos=MENU_FindSubMenu(&topmenu, hmenu))!=NO_SELECTED_ITEM){
-                POPUPMENU *ptm = (POPUPMENU *) USER_HEAP_LIN_ADDR( topmenu );
+                POPUPMENU *ptm = (POPUPMENU*)topmenu;
                 MENUITEM *ip = &ptm->items[pos];
                 SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(pos,
@@ -1630,5 +1657,5 @@
     //TRACE("hwnd=0x%04x hmenu=0x%04x off=0x%04x\n", hwndOwner, hmenu, offset);
 
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+    menu = (POPUPMENU*)hmenu;
     if (!menu->items) return;
 
@@ -1702,5 +1729,5 @@
     if (flags & MF_POPUP)
     {
-        POPUPMENU *menu = (POPUPMENU *)USER_HEAP_LIN_ADDR((UINT)id);
+        POPUPMENU *menu = (POPUPMENU*)(UINT)id;
         if (IS_A_MENU(menu)) menu->wFlags |= MF_POPUP;
         else
@@ -1746,5 +1773,5 @@
     POPUPMENU *menu;
 
-    if (!(menu = (POPUPMENU *)USER_HEAP_LIN_ADDR(hMenu)))
+    if (!(menu = (POPUPMENU*)hMenu))
     {
         //WARN("%04x not a menu handle\n",
@@ -1770,5 +1797,5 @@
             return NULL;
         }
-        if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu)))
+        if (!(menu = (LPPOPUPMENU)hMenu))
         {
             //WARN("%04x not a menu handle\n",
@@ -1914,5 +1941,5 @@
     MENUITEM *item;
 
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+    menu = (POPUPMENU*)hmenu;
 
     if (menu->FocusedItem == NO_SELECTED_ITEM) return 0;
@@ -1933,5 +1960,5 @@
                                 BOOL sendMenuSelect )
 {
-    POPUPMENU *menu = (POPUPMENU*) USER_HEAP_LIN_ADDR( hmenu );;
+    POPUPMENU *menu = (POPUPMENU*)hmenu;
 
     //TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, sendMenuSelect);
@@ -1952,5 +1979,5 @@
         } else return;
 
-        submenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hsubmenu );
+        submenu = (POPUPMENU*)hsubmenu;
         MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE );
         MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect, 0 );
@@ -1987,5 +2014,5 @@
     //TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, selectFirst);
 
-    if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return hmenu;
+    if (!(menu = (POPUPMENU*)hmenu)) return hmenu;
 
     if (menu->FocusedItem == NO_SELECTED_ITEM)
@@ -2031,7 +2058,9 @@
     if (IS_SYSTEM_MENU(menu))
     {
+        Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(menu->hWnd);
+
         MENU_InitSysMenuPopup(item->hSubMenu,GetWindowLongA(menu->hWnd,GWL_STYLE), GetClassLongA(menu->hWnd, GCL_STYLE));
 
-        //NC_GetSysPopupPos( menu->hWnd, &rect ); //CB: todo
+        if (win32wnd) win32wnd->GetSysPopupPos(&rect);
         rect.top = rect.bottom;
         rect.right = GetSystemMetrics(SM_CXSIZE);
@@ -2076,5 +2105,5 @@
 static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
 {
-   POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hMenu );
+   POPUPMENU *menu = (POPUPMENU*)hMenu;
    register UINT ht = menu->FocusedItem;
 
@@ -2087,5 +2116,7 @@
    if( !ht )    /* check the current window (avoiding WM_HITTEST) */
    {
-        //ht = (UINT)NC_HandleNCHitTest( menu->hWnd, pt ); //CB: todo
+        Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(menu->hWnd);
+
+        ht = win32wnd->HandleNCHitTest(pt);
         if( menu->wFlags & MF_POPUP )
             ht =  (ht != (UINT)HTNOWHERE &&
@@ -2093,6 +2124,6 @@
         else
         {
-            ht = ( ht == HTSYSMENU ) ? (UINT)(GetSystemMenu(menu->hWnd,FALSE))
-                 : ( ht == HTMENU ) ? (UINT)(GetWindowLongA(menu->hWnd,GWL_ID)) : 0;
+            ht = ( ht == HTSYSMENU ) ? (UINT)(getSysMenu(menu->hWnd))
+                 : ( ht == HTMENU ) ? (UINT)(getMenu(menu->hWnd)) : 0;
         }
    }
@@ -2113,5 +2144,5 @@
 {
     MENUITEM *item;
-    POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hMenu );
+    POPUPMENU *menu = (POPUPMENU*)hMenu;
 
     //TRACE("%p hmenu=0x%04x\n", pmt, hMenu);
@@ -2155,6 +2186,6 @@
 static void MENU_SwitchTracking( MTRACKER* pmt, HMENU hPtMenu, UINT id )
 {
-    POPUPMENU *ptmenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hPtMenu );
-    POPUPMENU *topmenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( pmt->hTopMenu );
+    POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
+    POPUPMENU *topmenu = (POPUPMENU*)pmt->hTopMenu;
 
     //TRACE("%p hmenu=0x%04x 0x%04x\n", pmt, hPtMenu, id);
@@ -2185,5 +2216,5 @@
     {
         UINT id = 0;
-        POPUPMENU *ptmenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hPtMenu );
+        POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
         MENUITEM *item;
 
@@ -2226,5 +2257,5 @@
     {
         UINT id = 0;
-        POPUPMENU *ptmenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hPtMenu );
+        POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
         MENUITEM *item;
 
@@ -2263,5 +2294,5 @@
     if( hPtMenu )
     {
-        ptmenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hPtMenu );
+        ptmenu = (POPUPMENU*)hPtMenu;
         if( IS_SYSTEM_MENU(ptmenu) )
             id = 0;
@@ -2292,10 +2323,9 @@
 static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
 {
-    POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( pmt->hTopMenu );
+    POPUPMENU *menu = (POPUPMENU*)pmt->hTopMenu;
 
     if( (vk == VK_LEFT &&  menu->FocusedItem == 0 ) ||
         (vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1))
     {
-        WND*    wndPtr;
         HMENU hNewMenu;
         HWND  hNewWnd;
@@ -2314,13 +2344,13 @@
                 /* switch to the menu bar */
 
-                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !GetWindowLongA(pmt->hOwnerWnd,GWL_ID) )
+                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !getMenu(pmt->hOwnerWnd) )
                 {
                     return FALSE;
                 }
 
-                hNewMenu = GetWindowLongA(pmt->hOwnerWnd,GWL_ID);
+                hNewMenu = getMenu(pmt->hOwnerWnd);
                 if( vk == VK_LEFT )
                 {
-                    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hNewMenu );
+                    menu = (POPUPMENU*)hNewMenu;
                     id = menu->nItems - 1;
                 }
@@ -2329,5 +2359,5 @@
             {
                 /* switch to the system menu */
-                hNewMenu = GetSystemMenu(pmt->hOwnerWnd,FALSE);
+                hNewMenu = getSysMenu(pmt->hOwnerWnd);
             }
             else
@@ -2343,10 +2373,10 @@
             {
                 if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_SYSMENU) &&
-                    GetSubMenu(GetSystemMenu(hNewWnd,FALSE), 0) == hNewMenu )
+                    GetSubMenu(getSysMenu(hNewWnd), 0) == hNewMenu )
                 {
                     /* get the real system menu */
-                    hNewMenu =  GetSystemMenu(hNewWnd,FALSE);
+                    hNewMenu =  getSysMenu(hNewWnd);
                 }
-                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (GetWindowLongA(hNewWnd,GWL_ID) != hNewMenu) )
+                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (getMenu(hNewWnd) != hNewMenu) )
                 {
                     /* FIXME: Not sure what to do here, perhaps,
@@ -2372,5 +2402,5 @@
             ReleaseCapture();
             pmt->hOwnerWnd = hNewWnd;
-            //EVENT_Capture( pmt->hOwnerWnd, HTMENU ); //CB:
+            //EVENT_Capture( pmt->hOwnerWnd, HTMENU ); //CB: todo
         }
 
@@ -2433,5 +2463,5 @@
 
     hmenuprev = hmenutmp = pmt->hTopMenu;
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenutmp );
+    menu = (POPUPMENU*)hmenutmp;
 
     /* Try to move 1 column left (if possible) */
@@ -2482,5 +2512,5 @@
 {
     HMENU hmenutmp;
-    POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( pmt->hTopMenu );
+    POPUPMENU *menu = (POPUPMENU*)pmt->hTopMenu;
     UINT  nextcol;
 
@@ -2557,5 +2587,5 @@
 
     fEndMenu = FALSE;
-    if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE;
+    if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
 
     if (wFlags & TPM_BUTTONDOWN) MENU_ButtonDown( &mt, hmenu, wFlags );
@@ -2565,13 +2595,10 @@
     while (!fEndMenu)
     {
-        menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( mt.hCurrentMenu );
+        menu = (POPUPMENU*)mt.hCurrentMenu;
         msg.hwnd = (wFlags & TPM_ENTERIDLEEX && menu->wFlags & MF_POPUP) ? menu->hWnd : 0;
 
         /* we have to keep the message in the queue until it's
          * clear that menu loop is not over yet. */
-#if 0 //CB: todo
-        if (!MSG_InternalGetMessage( QMSG_WIN32A, &msg, msg.hwnd, mt.hOwnerWnd,
-                                     MSGF_MENU, PM_NOREMOVE, !enterIdleSent, &enterIdleSent )) break;
-#endif
+        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
         TranslateMessage( &msg );
         mt.pt = msg.pt;
@@ -2652,5 +2679,5 @@
                 case VK_DOWN: /* If on menu bar, pull-down the menu */
 
-                    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( mt.hCurrentMenu );
+                    menu = (POPUPMENU*)mt.hCurrentMenu;
                     if (!(menu->wFlags & MF_POPUP))
                         mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags);
@@ -2733,5 +2760,5 @@
     ReleaseCapture();
 
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( mt.hTopMenu );
+    menu = (POPUPMENU*)mt.hTopMenu;
 
     if( IsWindow( mt.hOwnerWnd ) )
@@ -2792,8 +2819,7 @@
  * Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
  */
-void MENU_TrackMouseMenuBar( WND* wndPtr, INT ht, POINT pt )
-{
-    HWND  hWnd = wndPtr->hwndSelf;
-    HMENU hMenu = (ht == HTSYSMENU) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
+void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
+{
+    HMENU hMenu = (ht == HTSYSMENU) ? getSysMenu(hWnd):getMenu(hWnd);
     UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
 
@@ -2814,5 +2840,5 @@
  * Menu-bar tracking upon a keyboard event. Called from NC_HandleSysCommand().
  */
-void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
+void MENU_TrackKbdMenuBar( HWND hWnd, UINT wParam, INT vkey)
 {
    UINT uItem = NO_SELECTED_ITEM;
@@ -2822,27 +2848,27 @@
     /* find window that has a menu */
 
-    while( wndPtr->dwStyle & WS_CHILD)
-        if( !(wndPtr = wndPtr->parent) ) return;
+    while(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD)
+        if( !(hWnd = GetParent(hWnd)) ) return;
 
     /* check if we have to track a system menu */
 
-    if( (wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) ||
-        !wndPtr->wIDmenu || vkey == VK_SPACE )
-    {
-        if( !(wndPtr->dwStyle & WS_SYSMENU) ) return;
-        hTrackMenu = wndPtr->hSysMenu;
+    if( (GetWindowLongA(hWnd,GWL_STYLE) & (WS_CHILD | WS_MINIMIZE)) ||
+        !getMenu(hWnd) || vkey == VK_SPACE )
+    {
+        if( !(GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) ) return;
+        hTrackMenu = getSysMenu(hWnd);
         uItem = 0;
         wParam |= HTSYSMENU;    /* prevent item lookup */
     }
     else
-        hTrackMenu = wndPtr->wIDmenu;
+        hTrackMenu = getMenu(hWnd);
 
     if (IsMenu( hTrackMenu ))
     {
-        MENU_InitTracking( wndPtr->hwndSelf, hTrackMenu, FALSE, wFlags );
+        MENU_InitTracking( hWnd, hTrackMenu, FALSE, wFlags );
 
         if( vkey && vkey != VK_SPACE )
         {
-            uItem = MENU_FindItemByKey( wndPtr->hwndSelf, hTrackMenu,
+            uItem = MENU_FindItemByKey( hWnd, hTrackMenu,
                                         vkey, (wParam & HTSYSMENU) );
             if( uItem >= (UINT)(-2) )
@@ -2855,15 +2881,15 @@
         if( hTrackMenu )
         {
-            MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE, 0 );
+            MENU_SelectItem( hWnd, hTrackMenu, uItem, TRUE, 0 );
 
             if( uItem == NO_SELECTED_ITEM )
-                MENU_MoveSelection( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
+                MENU_MoveSelection( hWnd, hTrackMenu, ITEM_NEXT );
             else if( vkey )
-                PostMessageA( wndPtr->hwndSelf, WM_KEYDOWN, VK_DOWN, 0L );
-
-            MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, wndPtr->hwndSelf, NULL );
-        }
-
-        MENU_ExitTracking (wndPtr->hwndSelf);
+                PostMessageA( hWnd, WM_KEYDOWN, VK_DOWN, 0L );
+
+            MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd, NULL );
+        }
+
+        MENU_ExitTracking (hWnd);
     }
 }
@@ -2881,4 +2907,6 @@
 {
     BOOL ret = FALSE;
+
+    dprintf(("USER32: TrackPopupMenu"));
 
     MENU_InitTracking(hWnd, hMenu, TRUE, wFlags);
@@ -2904,4 +2932,5 @@
                                 HWND hWnd, LPTPMPARAMS lpTpm )
 {
+    dprintf(("USER32: TrackPopupMenuEx"));
     //FIXME("not fully implemented\n" );
     return TrackPopupMenu( hMenu, wFlags, x, y, 0, hWnd,
@@ -3006,6 +3035,5 @@
  * Compute the size of the menu bar height. Used by NC_HandleNCCalcSize().
  */
-UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
-                              INT orgX, INT orgY )
+UINT MENU_GetMenuBarHeight(HWND hwnd,UINT menubarWidth,INT orgX,INT orgY)
 {
     HDC hdc;
@@ -3017,5 +3045,5 @@
     //             hwnd, menubarWidth, orgX, orgY );
 
-    if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)GetWindowLongA(hwnd,GWL_ID))))
+    if (!(lppop = (LPPOPUPMENU)getMenu(hwnd)))
     {
         return 0;
@@ -3038,4 +3066,6 @@
                              UINT id, UINT flags )
 {
+    dprintf(("USER32: ChangeMenuA"));
+
     //TRACE("menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
     //              hMenu, pos, (DWORD)data, id, flags );
@@ -3059,4 +3089,6 @@
                              UINT id, UINT flags )
 {
+    dprintf(("USER32: ChangeMenuW"));
+
     //TRACE("menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
     //              hMenu, pos, (DWORD)data, id, flags );
@@ -3082,4 +3114,6 @@
     DWORD ret;
 
+    dprintf(("USER32: CheckMenuItem"));
+
     //TRACE("menu=%04x id=%04x flags=%04x\n", hMenu, id, flags );
     if (!(item = MENU_FindItem( &hMenu, &id, flags ))) return -1;
@@ -3100,9 +3134,11 @@
     POPUPMENU *menu;
 
+    dprintf(("USER32: EnableMenuItem"));
+
     //TRACE("(%04x, %04X, %04X) !\n",
     //             hMenu, wItemID, wFlags);
 
     /* Get the Popupmenu to access the owner menu */
-    if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu)))
+    if (!(menu = (POPUPMENU*)hMenu))
         return (UINT)-1;
 
@@ -3121,5 +3157,5 @@
 
             /* Get the parent menu to access*/
-            if (!(parentMenu = (POPUPMENU *) USER_HEAP_LIN_ADDR(menu->hSysMenuOwner)))
+            if (!(parentMenu = (POPUPMENU*)menu->hSysMenuOwner))
                 return (UINT)-1;
 
@@ -3141,4 +3177,6 @@
 {
     MENUITEM *item;
+
+    dprintf(("USER32: GetMenuStringA"));
 
     //TRACE("menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
@@ -3162,4 +3200,6 @@
     MENUITEM *item;
 
+    dprintf(("USER32: GetMenuStringW"));
+
     //TRACE("menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
     //             hMenu, wItemID, str, nMaxSiz, wFlags );
@@ -3180,8 +3220,11 @@
 {
     LPPOPUPMENU menu;
+
+    dprintf(("USER32: HiliteMenuItem"));
+
     //TRACE("(%04x, %04x, %04x, %04x);\n",
     //             hWnd, hMenu, wItemID, wHilite);
     if (!MENU_FindItem( &hMenu, &wItemID, wHilite )) return FALSE;
-    if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
+    if (!(menu = (LPPOPUPMENU)hMenu)) return FALSE;
     if (menu->FocusedItem == wItemID) return TRUE;
     MENU_HideSubPopups( hWnd, hMenu, FALSE );
@@ -3197,11 +3240,16 @@
 {
     MENUITEM *item;
+
+    dprintf(("USER32: GetMenuState %d %d",wItemID,wFlags));
+
     //TRACE("(menu=%04x, id=%04x, flags=%04x);\n",
     //             hMenu, wItemID, wFlags);
+
     if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
+
     //debug_print_menuitem ("  item: ", item, "");
     if (item->fType & MF_POPUP)
     {
-        POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( item->hSubMenu );
+        POPUPMENU *menu = (POPUPMENU*)item->hSubMenu;
         if (!menu) return -1;
         else return (menu->nItems << 8) | ((item->fState|item->fType) & 0xff);
@@ -3222,5 +3270,8 @@
 INT WINAPI GetMenuItemCount( HMENU hMenu )
 {
-    LPPOPUPMENU menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
+    LPPOPUPMENU menu = (LPPOPUPMENU)hMenu;
+
+    dprintf(("USER32: GetMenuItemCount"));
+
     if (!IS_A_MENU(menu)) return -1;
     //TRACE("(%04x) returning %d\n",
@@ -3236,4 +3287,6 @@
     MENUITEM * lpmi;
 
+    dprintf(("USER32: GetMenuItemID"));
+
     if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
     if (lpmi->fType & MF_POPUP) return -1;
@@ -3249,4 +3302,6 @@
 {
     MENUITEM *item;
+
+    dprintf(("USER32: InsertMenuA"));
 
     //if (IS_STRING_ITEM(flags) && str)
@@ -3267,5 +3322,5 @@
 
     if (flags & MF_POPUP)  /* Set the MF_POPUP flag on the popup-menu */
-        ((POPUPMENU *)USER_HEAP_LIN_ADDR((HMENU)id))->wFlags |= MF_POPUP;
+        ((POPUPMENU *)(HMENU)id)->wFlags |= MF_POPUP;
 
     item->hCheckBit = item->hUnCheckBit = 0;
@@ -3281,4 +3336,6 @@
 {
     BOOL ret;
+
+    dprintf(("USER32: InsertMenuW"));
 
     if (IS_STRING_ITEM(flags) && str)
@@ -3299,4 +3356,6 @@
                              UINT id, LPCSTR data )
 {
+    dprintf(("USER32: AppendMenuA"));
+
     return InsertMenuA( hMenu, -1, flags | MF_BYPOSITION, id, data );
 }
@@ -3309,4 +3368,6 @@
                              UINT id, LPCWSTR data )
 {
+    dprintf(("USER32: AppendMenuW"));
+
     return InsertMenuW( hMenu, -1, flags | MF_BYPOSITION, id, data );
 }
@@ -3321,7 +3382,9 @@
     MENUITEM *item;
 
+    dprintf(("USER32: RemoveMenu"));
+
     //TRACE("(menu=%04x pos=%04x flags=%04x)\n",hMenu, nPos, wFlags);
     if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
-    if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
+    if (!(menu = (LPPOPUPMENU)hMenu)) return FALSE;
 
       /* Remove item */
@@ -3355,4 +3418,7 @@
 {
     MENUITEM *item = MENU_FindItem( &hMenu, &nPos, wFlags );
+
+    dprintf(("USER32: DeleteMenu"));
+
     if (!item) return FALSE;
     if (item->fType & MF_POPUP) DestroyMenu( item->hSubMenu );
@@ -3371,4 +3437,6 @@
     MENUITEM *item;
 
+    dprintf(("USER32: ModifyMenuA"));
+
     if (IS_STRING_ITEM(flags))
     {
@@ -3395,4 +3463,6 @@
 {
     BOOL ret;
+
+    dprintf(("USER32: ModifyMenuW"));
 
     if (IS_STRING_ITEM(flags) && str)
@@ -3415,6 +3485,8 @@
     POPUPMENU *menu;
 
+    dprintf(("USER32: CreatePopupMenu"));
+
     if (!(hmenu = CreateMenu())) return 0;
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
+    menu = (POPUPMENU*)hmenu;
     menu->wFlags |= MF_POPUP;
     menu->bTimeToHide = FALSE;
@@ -3428,4 +3500,6 @@
 DWORD WINAPI GetMenuCheckMarkDimensions(void)
 {
+    dprintf(("USER32: GetMenuCheckMarkDimensions"));
+
     return MAKELONG( check_bitmap_width, check_bitmap_height );
 }
@@ -3439,4 +3513,7 @@
 {
     MENUITEM *item;
+
+    dprintf(("USER32: SetMenuItemBitmaps"));
+
     //TRACE("(%04x, %04x, %04x, %04x, %04x)\n",
     //             hMenu, nPos, wFlags, hNewCheck, hNewUnCheck);
@@ -3464,6 +3541,9 @@
     HMENU hMenu;
     LPPOPUPMENU menu;
-    if (!(hMenu = (HMENU)USER_HEAP_ALLOC( sizeof(POPUPMENU) ))) return 0;
-    menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
+
+    dprintf(("USER32: CreateMenu"));
+
+    if (!(hMenu = (HMENU)HeapAlloc(GetProcessHeap(),0,sizeof(POPUPMENU)))) return 0;
+    menu = (LPPOPUPMENU)hMenu;
 
     ZeroMemory(menu, sizeof(POPUPMENU));
@@ -3485,9 +3565,11 @@
     //TRACE("(%04x)\n", hMenu);
 
+    dprintf(("USER32: DestroyMenu"));
+
     /* Silently ignore attempts to destroy default system popup */
 
     if (hMenu && hMenu != MENU_DefSysPopup)
     {
-        LPPOPUPMENU lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
+        LPPOPUPMENU lppop = (LPPOPUPMENU)hMenu;
         HWND pTPWnd = MENU_GetTopPopupWnd();
 
@@ -3514,5 +3596,5 @@
                 HeapFree(GetProcessHeap(), 0, lppop->items );
             }
-            USER_HEAP_FREE( hMenu );
+            HeapFree(GetProcessHeap(),0,(LPVOID)hMenu);
             MENU_ReleaseTopPopupWnd();
         }
@@ -3526,5 +3608,4 @@
 }
 
-#if 0 //CB: todo
 /**********************************************************************
  *         GetSystemMenu32    (USER32.291)
@@ -3533,19 +3614,22 @@
 {
     HMENU retvalue = 0;
-    Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+    Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hWnd);
+
+    dprintf(("USER32: GetSystemMenu"));
 
     if (win32wnd)
     {
-        if( wndPtr->hSysMenu )
+        HMENU hSysMenu = getSysMenu(hWnd);
+        if(hSysMenu)
         {
             if( bRevert )
             {
-                DestroyMenu(wndPtr->hSysMenu);
-                wndPtr->hSysMenu = 0;
+                DestroyMenu(hSysMenu);
+                hSysMenu = 0;
+                setSysMenu(hWnd,hSysMenu);
             }
             else
             {
-                POPUPMENU *menu = (POPUPMENU*)
-                           USER_HEAP_LIN_ADDR(wndPtr->hSysMenu);
+                POPUPMENU *menu = (POPUPMENU*)hSysMenu;
                 if( IS_A_MENU(menu) )
                 {
@@ -3557,22 +3641,26 @@
                    //WARN("Current sys-menu (%04x) of wnd %04x is broken\n",
                    //     wndPtr->hSysMenu, hWnd);
-                   wndPtr->hSysMenu = 0;
+                   hSysMenu = 0;
+                   setSysMenu(hWnd,hSysMenu);
                 }
             }
         }
 
-        if(!wndPtr->hSysMenu && (wndPtr->dwStyle & WS_SYSMENU) )
-            wndPtr->hSysMenu = MENU_GetSysMenu( hWnd, (HMENU)(-1) );
-
-        if( wndPtr->hSysMenu )
+        if(!hSysMenu && (GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) )
+        {
+            hSysMenu = MENU_GetSysMenu( hWnd, (HMENU)(-1) );
+            setSysMenu(hWnd,hSysMenu);
+        }
+
+        if( hSysMenu )
         {
             POPUPMENU *menu;
-            retvalue = GetSubMenu(wndPtr->hSysMenu, 0);
+            retvalue = GetSubMenu(hSysMenu, 0);
 
             /* Store the dummy sysmenu handle to facilitate the refresh */
             /* of the close button if the SC_CLOSE item change */
-            menu = (POPUPMENU*) USER_HEAP_LIN_ADDR(retvalue);
+            menu = (POPUPMENU*)retvalue;
             if ( IS_A_MENU(menu) )
-               menu->hSysMenuOwner = wndPtr->hSysMenu;
+               menu->hSysMenuOwner = hSysMenu;
         }
     }
@@ -3588,13 +3676,14 @@
     Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
 
-    if (wndPtr)
-    {
-        if (wndPtr->hSysMenu) DestroyMenu( wndPtr->hSysMenu );
-        wndPtr->hSysMenu = MENU_GetSysMenu( hwnd, hMenu );
+    dprintf(("USER32: SetSystemMenu"));
+
+    if (win32wnd)
+    {
+        if (win32wnd->GetSysMenu()) DestroyMenu(win32wnd->GetSysMenu());
+        win32wnd->SetSysMenu(MENU_GetSysMenu( hwnd, hMenu ));
         return TRUE;
     }
     return FALSE;
 }
-#endif
 
 /**********************************************************************
@@ -3605,9 +3694,10 @@
     HMENU retvalue;
 
+    dprintf(("USER32: GetMenu"));
+
     if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) return 0;
-    else return GetWindowLongA(hWnd,GWL_ID);
-}
-
-#if 0 //CB: todo
+    else return getMenu(hWnd);
+}
+
 /**********************************************************************
  *         SetMenu32    (USER32.487)
@@ -3617,4 +3707,6 @@
     //TRACE("(%04x, %04x);\n", hWnd, hMenu);
 
+    dprintf(("USER32: SetMenu"));
+
     if (hMenu && !IsMenu(hMenu))
     {
@@ -3628,10 +3720,10 @@
         if (GetCapture() == hWnd) ReleaseCapture();
 
-        wndPtr->wIDmenu = (UINT)hMenu;
+        setMenu(hWnd,hMenu);
         if (hMenu != 0)
         {
             LPPOPUPMENU lpmenu;
 
-            if (!(lpmenu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu)))
+            if (!(lpmenu = (LPPOPUPMENU)hMenu))
             {
                 return FALSE;
@@ -3648,5 +3740,4 @@
     return FALSE;
 }
-#endif
 
 
@@ -3657,4 +3748,6 @@
 {
     MENUITEM * lpmi;
+
+    dprintf(("USER32: GetSubMenu"));
 
     if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
@@ -3671,7 +3764,9 @@
     LPPOPUPMENU lppop;
 
-    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && GetWindowLongA(hWnd,GWL_ID))
-    {
-        lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU)GetWindowLongA(hWnd,GWL_ID));
+    dprintf(("USER32: DrawMenuBar"));
+
+    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))
+    {
+        lppop = (LPPOPUPMENU)getMenu(hWnd);
         if (lppop == NULL)
         {
@@ -3694,4 +3789,5 @@
 void WINAPI EndMenu(void)
 {
+    dprintf(("USER32: EndMenu not implemented!"));
     /*
      * FIXME: NOT ENOUGH! This has to cancel menu tracking right away.
@@ -3708,4 +3804,7 @@
 {
     HRSRC hrsrc = FindResourceA( instance, name, RT_MENUA );
+
+    dprintf(("USER32: LoadMenuA"));
+
     if (!hrsrc) return 0;
     return LoadMenuIndirectA( (MENUITEMTEMPLATEHEADER*)LoadResource( instance, hrsrc ));
@@ -3719,4 +3818,7 @@
 {
     HRSRC hrsrc = FindResourceW( instance, name, RT_MENUW );
+
+    dprintf(("USER32: LoadMenuW"));
+
     if (!hrsrc) return 0;
     return LoadMenuIndirectW( (MENUITEMTEMPLATEHEADER*)LoadResource( instance, hrsrc ));
@@ -3732,4 +3834,6 @@
     WORD version, offset;
     LPCSTR p = (LPCSTR)lpMenuTemplate;
+
+    dprintf(("USER32: LoadMenuIndirectA"));
 
     //TRACE("%p\n", template );
@@ -3770,4 +3874,6 @@
 HMENU WINAPI LoadMenuIndirectW(CONST MENUITEMTEMPLATEHEADER *lpMenuTemplate )
 {
+    dprintf(("USER32: LoadMenuIndirectW"));
+
     /* FIXME: is there anything different between A and W? */
     return LoadMenuIndirectA(lpMenuTemplate);
@@ -3780,5 +3886,8 @@
 BOOL WINAPI IsMenu(HMENU hmenu)
 {
-    LPPOPUPMENU menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hmenu);
+    LPPOPUPMENU menu = (LPPOPUPMENU)hmenu;
+
+    dprintf(("USER32: IsMenu"));
+
     return IS_A_MENU(menu);
 }
@@ -3862,4 +3971,6 @@
                                   LPMENUITEMINFOA lpmii)
 {
+    dprintf(("USER32: GetMenuItemInfoA"));
+
     return GetMenuItemInfo_common (hmenu, item, bypos, lpmii, FALSE);
 }
@@ -3871,4 +3982,6 @@
                                   LPMENUITEMINFOW lpmii)
 {
+    dprintf(("USER32: GetMenuItemInfoW"));
+
     return GetMenuItemInfo_common (hmenu, item, bypos,
                                      (LPMENUITEMINFOA)lpmii, TRUE);
@@ -3939,5 +4052,5 @@
         menu->hSubMenu = lpmii->hSubMenu;
         if (menu->hSubMenu) {
-            POPUPMENU *subMenu = (POPUPMENU *)USER_HEAP_LIN_ADDR((UINT)menu->hSubMenu);
+            POPUPMENU *subMenu = (POPUPMENU*)(UINT)menu->hSubMenu;
             if (IS_A_MENU(subMenu)) {
                 subMenu->wFlags |= MF_POPUP;
@@ -3970,4 +4083,6 @@
                                  const MENUITEMINFOA *lpmii)
 {
+    dprintf(("USER32: SetMenuItemInfoA"));
+
     return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
                                     lpmii, FALSE);
@@ -3980,4 +4095,6 @@
                                  const MENUITEMINFOW *lpmii)
 {
+    dprintf(("USER32: SetMenuItemInfoW"));
+
     return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
                                     (const MENUITEMINFOA*)lpmii, TRUE);
@@ -3994,7 +4111,9 @@
         MENUITEM *item;
 
+
+        dprintf(("USER32: SetMenuDefaultItem"));
         //TRACE("(0x%x,%d,%d)\n", hmenu, uItem, bypos);
 
-        if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hmenu))) return FALSE;
+        if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
 
         /* reset all default-item flags */
@@ -4042,7 +4161,8 @@
         UINT i = 0;
 
+        dprintf(("USER32: GetMenuDefaultItem"));
         //TRACE("(0x%x,%d,%d)\n", hmenu, bypos, flags);
 
-        if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hmenu))) return -1;
+        if (!(menu = (POPUPMENU*)hmenu)) return -1;
 
         /* find default item */
@@ -4081,4 +4201,7 @@
 {
     MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
+
+    dprintf(("USER32: InsertMenuItemA"));
+
     return SetMenuItemInfo_common(item, lpmii, FALSE);
 }
@@ -4092,4 +4215,7 @@
 {
     MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
+
+    dprintf(("USER32: InsertMenuItemW"));
+
     return SetMenuItemInfo_common(item, (const MENUITEMINFOA*)lpmii, TRUE);
 }
@@ -4106,4 +4232,5 @@
      HMENU mfirst = hMenu, mlast = hMenu, mcheck = hMenu;
 
+     dprintf(("USER32: CheckMenuRadioItem"));
      //TRACE("ox%x: %d-%d, check %d, bypos=%d\n",
      //             hMenu, first, last, check, bypos);
@@ -4149,4 +4276,5 @@
      HWND referenceHwnd;
 
+     dprintf(("USER32: GetMenuItemRect"));
      //TRACE("(0x%x,0x%x,%d,%p)\n", hwnd, hMenu, uItem, rect);
 
@@ -4156,5 +4284,5 @@
      if(!hwnd)
      {
-         itemMenu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu);
+         itemMenu = (POPUPMENU*)hMenu;
          if (itemMenu == NULL)
              return FALSE;
@@ -4186,7 +4314,8 @@
     POPUPMENU *menu;
 
+    dprintf(("USER32: SetMenuInfo"));
     //TRACE("(0x%04x %p)\n", hMenu, lpmi);
 
-    if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)USER_HEAP_LIN_ADDR(hMenu)))
+    if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)hMenu))
     {
 
@@ -4221,7 +4350,8 @@
 {   POPUPMENU *menu;
 
+    dprintf(("USER32: GetMenuInfo"));
     //TRACE("(0x%04x %p)\n", hMenu, lpmi);
 
-    if (lpmi && (menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu)))
+    if (lpmi && (menu = (POPUPMENU*)hMenu))
     {
 
@@ -4253,7 +4383,8 @@
     LPPOPUPMENU menu;
 
+    dprintf(("USER32: SetMenuContextHelpId"));
     //TRACE("(0x%04x 0x%08lx)\n", hMenu, dwContextHelpID);
 
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu);
+    menu = (POPUPMENU*)hMenu;
     if (menu)
     {
@@ -4271,7 +4402,8 @@
     LPPOPUPMENU menu;
 
+    dprintf(("USER32: GetMenuContextHelpId"));
     //TRACE("(0x%04x)\n", hMenu);
 
-    menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu);
+    menu = (POPUPMENU*)hMenu;
     if (menu)
     {
@@ -4286,4 +4418,5 @@
 UINT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen)
 {
+    dprintf(("USER32: MenuItemFromPoint not implemented!"));
     //FIXME("(0x%04x,0x%04x,(%ld,%ld)):stub\n",
     //      hWnd, hMenu, ptScreen.x, ptScreen.y);
@@ -4294,4 +4427,5 @@
 {
     WNDCLASSA wndClass;
+    BOOL rc;
 
 //SvL: Don't check this now
@@ -4307,5 +4441,8 @@
     wndClass.lpszClassName = POPUPMENUCLASSNAME;
 
-    return RegisterClassA(&wndClass);
+    rc = RegisterClassA(&wndClass);
+    MENU_Init();
+
+    return rc;
 }
 //******************************************************************************
Index: trunk/src/user32/new/oslibmenu.cpp
===================================================================
--- trunk/src/user32/new/oslibmenu.cpp	(revision 2394)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/* $Id: oslibmenu.cpp,v 1.3 2000-01-01 14:57:18 cbratschi Exp $ */
-/*
- * Window Menu wrapper functions for OS/2
- *
- *
- * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
- *
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#define  INCL_WIN
-#define  INCL_PM
-#include <os2.h>
-#include <os2wrap.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <misc.h>
-#include <winconst.h>
-#include "oslibwin.h"
-#include "oslibutil.h"
-#include "oslibmenu.h"
-
-//******************************************************************************
-//******************************************************************************
-HWND OSLibWinSetMenu(HWND hwndParent, HMENU hMenu)
-{
-   // Remove current menu from window
-   HWND currMenu = WinWindowFromID( (HWND)hwndParent, FID_MENU );
-   if (currMenu)
-   {
-      dprintf(("OSLibWinSetMenu: old menu %x, new menu %x", currMenu, hMenu));
-      WinSetOwner (currMenu, HWND_OBJECT);
-      WinSetParent(currMenu, HWND_OBJECT, FALSE);
-   }
-
-   if (hMenu)
-   {
-      	if(WinIsWindow(GetThreadHAB(), hMenu) == TRUE) 
-	{
-         	WinSetOwner (hMenu, hwndParent);
-         	WinSetParent(hMenu, hwndParent, FALSE );
-         	WinSetWindowUShort(hMenu, QWS_ID, FID_MENU);
-     		WinSendMsg(hwndParent, WM_UPDATEFRAME, (MPARAM)FCF_MENU, 0);
-     		return hMenu;
-      	}
-	else {
-		dprintf(("OSLibWinSetMenu: %x = invalid menu handle", hMenu));
-	}
-   }
-   return 0;
-}
-//******************************************************************************
-//******************************************************************************
-int OSLibGetMenuItemCount(HWND hMenu)
-{
-   return (int)SHORT1FROMMR(WinSendMsg(hMenu, MM_QUERYITEMCOUNT, NULL, NULL));
-}
-//******************************************************************************
-//******************************************************************************
-HMENU OSLibWinCreateMenu(PVOID menutemplate)
-{
-    return (HMENU)WinCreateMenu(HWND_OBJECT, menutemplate);
-}
-//******************************************************************************
-//******************************************************************************
-HMENU OSLibWinCreateEmptyMenu()
-{
-   return WinCreateWindow(HWND_OBJECT, WC_MENU, NULL, MS_ACTIONBAR | 0x0008 | WS_SAVEBITS,
-                          0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, NULL, NULL);
-}
-//******************************************************************************
-//******************************************************************************
-HMENU OSLibWinCreateEmptyPopupMenu()
-{
-   return WinCreateWindow(HWND_OBJECT, WC_MENU, NULL, WS_CLIPSIBLINGS | WS_SAVEBITS,
-                          0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, NULL, NULL);
-}
-//******************************************************************************
-//Returns menu item rectange in screen coordinates
-//******************************************************************************
-BOOL OSLibGetMenuItemRect(HWND hMenu, int index, LPRECT pRect)
-{
-  RECTL rectl;
-  BOOL  rc;
-  ULONG id;
-
-   //First get id from menu index
-   id = (ULONG)WinSendMsg(hMenu, MM_ITEMIDFROMPOSITION, MPARAM(index), 0);
-
-   rc = (BOOL)WinSendMsg(hMenu, MM_QUERYITEMRECT, MPARAM(id), (MPARAM)&rectl);
-   if(rc == FALSE) {
-	dprintf(("OSLibGetMenuItemRect %x %d %d failed!", hMenu, index, id));
-	return FALSE;
-   }
-   WinMapWindowPoints(hMenu, HWND_DESKTOP, (PPOINTL)&rectl, 2);
-   pRect->left  = rectl.xLeft;
-   pRect->right = rectl.xRight;
-   pRect->top   = OSLibQueryScreenHeight() - rectl.yTop;
-   pRect->bottom= OSLibQueryScreenHeight() - rectl.yBottom;
-   return TRUE;
-}
-//******************************************************************************
-//******************************************************************************
-
Index: trunk/src/user32/new/oslibmenu.h
===================================================================
--- trunk/src/user32/new/oslibmenu.h	(revision 2394)
+++ 	(revision )
@@ -1,26 +1,0 @@
-/* $Id: oslibmenu.h,v 1.3 2000-01-01 14:54:52 cbratschi Exp $ */
-/*
- * Window Menu wrapper functions for OS/2
- *
- *
- * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
- *
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#ifndef __OSLIBMENU_H__
-#define __OSLIBMENU_H__
-
-#ifdef OS2_INCLUDED
-#include "win32type.h"
-#endif
-
-HWND  OSLibWinSetMenu(HWND hwndParent, HMENU hMenu);
-HMENU OSLibWinCreateMenu(PVOID menutemplate);
-HMENU OSLibWinCreateEmptyMenu();
-HMENU OSLibWinCreateEmptyPopupMenu();
-int   OSLibGetMenuItemCount(HWND hMenu);
-BOOL  OSLibGetMenuItemRect(HWND hMenu, int index, LPRECT pRect);
- 
-#endif //__OSLIBGDI_H__
Index: trunk/src/user32/new/uitools.cpp
===================================================================
--- trunk/src/user32/new/uitools.cpp	(revision 2394)
+++ trunk/src/user32/new/uitools.cpp	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: uitools.cpp,v 1.5 2000-01-01 14:57:24 cbratschi Exp $ */
+/* $Id: uitools.cpp,v 1.6 2000-01-10 17:18:09 cbratschi Exp $ */
 /*
  * User Interface Functions
@@ -1792,19 +1792,4 @@
   return TRUE;
 }
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API DrawMenuBar(HWND hwnd)
-{
- Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("DrawMenuBar, window %x not found", hwnd));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return 0;
-    }
-    dprintf(("DrawMenuBar %x", hwnd));
-    return O32_DrawMenuBar(window->getOS2FrameWindowHandle());
-}
 /*****************************************************************************
  * Name      : BOOL WIN32API DrawAnimatedRects
Index: trunk/src/user32/new/win32wbase.cpp
===================================================================
--- trunk/src/user32/new/win32wbase.cpp	(revision 2394)
+++ trunk/src/user32/new/win32wbase.cpp	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.27 2000-01-09 17:13:39 cbratschi Exp $ */
+/* $Id: win32wbase.cpp,v 1.28 2000-01-10 17:18:09 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -32,5 +32,4 @@
 #include "oslibgdi.h"
 #include "oslibres.h"
-#include "oslibmenu.h"
 #include "oslibdos.h"
 #include "syscolor.h"
@@ -45,4 +44,5 @@
 #include <win\hook.h>
 #include <shellapi.h>
+#include <menu.h>
 #define INCL_TIMERWIN32
 #include "timer.h"
@@ -81,5 +81,5 @@
     !(style & (WS_CHILD | WS_POPUP))
 
-#define HAS_MENU(w) (!((w)->getStyle() & WS_CHILD) && ((w)->getWindowId() != 0))
+#define HAS_MENU() (!(getStyle() & WS_CHILD) && (GetMenu() != 0))
 
 /* bits in the dwKeyData */
@@ -674,5 +674,4 @@
   if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
   {
-#if 0 //CB: todo
         if (cs->hMenu) {
             SetMenu(cs->hMenu);
@@ -684,5 +683,4 @@
                 }
         }
-#endif
   }
   else
@@ -690,4 +688,5 @@
         setWindowId((DWORD)cs->hMenu);
   }
+  hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
 
   // Subclass frame
@@ -1257,7 +1256,5 @@
       return;
     /* Check if the sysmenu item for minimize is there  */
-#if 0 //CB: todo
     state = GetMenuState(hSysMenu,SC_MINIMIZE,MF_BYCOMMAND);
-#endif
   } else
   {
@@ -1266,7 +1263,5 @@
       return;
     /* Check if the sysmenu item for maximize is there  */
-#if 0 //CB: todo
     state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
-#endif
   }
   SetCapture(Win32Hwnd);
@@ -1314,11 +1309,7 @@
   UINT state;
 
-#if 0 //CB: todo
   if (hSysMenu == 0)
     return;
   state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
-#else
-state = 0;
-#endif
   /* If the item close of the sysmenu is disabled or not there do nothing */
   if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF))
@@ -1532,5 +1523,5 @@
   if(!(dwStyle & WS_MINIMIZE))
   {
-    AdjustRectOuter(&tmpRect,FALSE); //CB: todo: menu
+    AdjustRectOuter(&tmpRect,FALSE);
 
     clientRect->left   -= tmpRect.left;
@@ -1539,12 +1530,10 @@
     clientRect->bottom -= tmpRect.bottom;
 
-    if (HAS_MENU(this))
-    {
-#if 0 //CB: todo
-      winRect->top +=
+    if (HAS_MENU())
+    {
+      clientRect->top +=
                 MENU_GetMenuBarHeight(Win32Hwnd,
                                        winRect->right - winRect->left,
                                        -tmpRect.left, -tmpRect.top ) + 1;
-#endif
     }
 
@@ -1693,5 +1682,5 @@
   /* Check menu bar */
 
-  if (HAS_MENU(this))
+  if (HAS_MENU())
   {
     if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
@@ -1795,4 +1784,25 @@
 
     return (hIcon != 0);
+  }
+  return FALSE;
+}
+//******************************************************************************
+//******************************************************************************
+BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
+{
+  if(hSysMenu)
+  {
+      if(dwStyle & WS_MINIMIZE )
+        *rect = rectWindow;
+      else
+      {
+          GetInsideRect(rect );
+          OffsetRect( rect, rectWindow.left, rectWindow.top);
+          if ((dwStyle & WS_CHILD) && getParent())
+              ClientToScreen(getParent()->getWindowHandle(), (POINT *)rect );
+          rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
+          rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
+      }
+      return TRUE;
   }
   return FALSE;
@@ -1938,5 +1948,4 @@
   char  buffer[256];
   HPEN  hPrevPen;
-  HMENU hSysMenu;
 
   if (flags & WIN_MANAGED) return;
@@ -1947,9 +1956,4 @@
   SelectObject( hdc, hPrevPen );
   r.bottom--;
-
-  //CB: todo:
-   //COLOR_GRADIENTACTIVECAPTION
-   //COLOR_GRADIENTINACTIVECAPTION
-   //-> end color
 
   if (SYSCOLOR_GetUseWinColors())
@@ -2006,10 +2010,8 @@
   {
     UINT state;
-#if 0 //CB: todo
+
     /* Go get the sysmenu */
     state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
-#else
-state = 0;
-#endif
+
     /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
     DrawCloseButton(hdc, FALSE,
@@ -2115,13 +2117,11 @@
     }
   }
-#if 0 //CB: todo
-  if (HAS_MENU(wndPtr))
+  if (HAS_MENU())
   {
     RECT r = rect;
     r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
 
-    rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1;
-  }
-#endif
+    rect.top += MENU_DrawMenuBar( hdc, &r, Win32Hwnd, suppress_menupaint ) + 1;
+  }
 
   if (dwExStyle & WS_EX_CLIENTEDGE)
@@ -2319,13 +2319,13 @@
         TrackScrollBar(wParam,*pt32);
         break;
-#if 0
+
     case SC_MOUSEMENU:
-        MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt32 );
+        MENU_TrackMouseMenuBar(Win32Hwnd,wParam & 0x000F,*pt32);
         break;
 
     case SC_KEYMENU:
-        MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
+        MENU_TrackKbdMenuBar(Win32Hwnd,wParam,pt32->x);
         break;
-#endif
+
     case SC_TASKLIST:
         WinExec("taskman.exe",SW_SHOWNORMAL);
@@ -2573,4 +2573,8 @@
           switch(LOWORD(lParam))
           {
+            case HTCLIENT:
+              hCursor = windowClass ? windowClass->getCursor():LoadCursorA(0,IDC_ARROWA);
+              break;
+
             case HTLEFT:
             case HTRIGHT:
@@ -2594,5 +2598,5 @@
 
             default:
-              hCursor = windowClass ? windowClass->getCursor():LoadCursorA(0,IDC_ARROWA);
+              hCursor = LoadCursorA(0,IDC_ARROWA);
               break;
           }
@@ -2769,5 +2773,5 @@
 
     case WM_CANCELMODE:
-        //if (getParent() == windowDesktop) EndMenu();
+        if (getParent() == windowDesktop) EndMenu();
         if (GetCapture() == Win32Hwnd) ReleaseCapture();
         return 0;
Index: trunk/src/user32/new/win32wbase.h
===================================================================
--- trunk/src/user32/new/win32wbase.h	(revision 2394)
+++ trunk/src/user32/new/win32wbase.h	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.20 2000-01-09 14:14:25 cbratschi Exp $ */
+/* $Id: win32wbase.h,v 1.21 2000-01-10 17:18:10 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -365,8 +365,11 @@
         VOID  AdjustRectInner(LPRECT rect);
         LONG  HandleNCCalcSize(BOOL calcValidRects,RECT *winRect);
-        LONG  HandleNCHitTest(POINT pt);
         VOID  GetInsideRect(RECT *rect);
         VOID  DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active);
+public:
+        LONG  HandleNCHitTest(POINT pt);
         BOOL  DrawSysButton(HDC hdc,BOOL down);
+        BOOL  GetSysPopupPos(RECT* rect);
+private:
         BOOL  DrawGrayButton(HDC hdc,int x,int y);
         VOID  DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed);
Index: trunk/src/user32/new/win32wbasepos.cpp
===================================================================
--- trunk/src/user32/new/win32wbasepos.cpp	(revision 2394)
+++ trunk/src/user32/new/win32wbasepos.cpp	(revision 2396)
@@ -1,3 +1,3 @@
-/* $Id: win32wbasepos.cpp,v 1.3 2000-01-05 21:25:08 cbratschi Exp $ */
+/* $Id: win32wbasepos.cpp,v 1.4 2000-01-10 17:18:11 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2 (nonclient/position methods)
@@ -32,5 +32,4 @@
 #include "oslibgdi.h"
 #include "oslibres.h"
-#include "oslibmenu.h"
 #include "oslibdos.h"
 #include "syscolor.h"
Index: trunk/src/user32/new/winmenu.cpp
===================================================================
--- trunk/src/user32/new/winmenu.cpp	(revision 2394)
+++ 	(revision )
@@ -1,1318 +1,0 @@
-/* $Id: winmenu.cpp,v 1.12 2000-01-08 16:47:50 cbratschi Exp $ */
-
-/*
- * Win32 menu API functions for OS/2
- *
- * Copyright 1998 Sander van Leeuwen
- * Copyright 1998 Patrick Haller
- *
- * Parts ported from Wine:
- * Copyright 1993 Martin Ayotte
- * Copyright 1994 Alexandre Julliard
- * Copyright 1997 Morten Welinder
- *
- *
- * TODO: Set/GetMenu(Item)Info only partially implemented
- * TODO: Memory leak when deleting submenus
- * TODO: Check error nrs
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <os2win.h>
-#include <odin.h>
-#include <odinwrap.h>
-#include <stdlib.h>
-#include <string.h>
-#include <win32wbase.h>
-#include "oslibmenu.h"
-#include "oslibwin.h"
-#include "winmenudef.h"
-
-ODINDEBUGCHANNEL(USER32)
-
-BOOL  ODIN_INTERNAL ODIN_InsertMenuA(HMENU,UINT,UINT,UINT,LPCSTR);
-BOOL  ODIN_INTERNAL ODIN_InsertMenuW(HMENU,UINT,UINT,UINT,LPCWSTR);
-BOOL  ODIN_INTERNAL ODIN_InsertMenuItemA(HMENU,UINT,BOOL,const MENUITEMINFOA*);
-BOOL  ODIN_INTERNAL ODIN_InsertMenuItemW(HMENU,UINT,BOOL,const MENUITEMINFOW*);
-BOOL  ODIN_INTERNAL ODIN_AppendMenuA(HMENU,UINT,UINT,LPCSTR);
-BOOL  ODIN_INTERNAL ODIN_AppendMenuW(HMENU,UINT,UINT,LPCWSTR);
-HMENU ODIN_INTERNAL ODIN_CreateMenu(void);
-HMENU ODIN_INTERNAL ODIN_CreatePopupMenu(void);
-BOOL  ODIN_INTERNAL ODIN_DestroyMenu(HMENU);
-BOOL  ODIN_INTERNAL ODIN_DeleteMenu(HMENU, UINT, UINT);
-
-//@@@PH: experiment with WINE LoadMenuIndirect code
-#include <heapstring.h>
-#define MENU_ITEM_TYPE(flags) \
-  ((flags) & (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR))
-
-#define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING)
-#define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP)
-
-/**********************************************************************
- *         MENU_ParseResource
- *
- * Parse a standard menu resource and add items to the menu.
- * Return a pointer to the end of the resource.
- */
-static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu)
-{
-    WORD flags, id = 0;
-    LPCSTR str;
-
-    do
-    {
-        flags = GET_WORD(res);
-        res += sizeof(WORD);
-        if (!(flags & MF_POPUP))
-        {
-            id = GET_WORD(res);
-            res += sizeof(WORD);
-        }
-        if (!IS_STRING_ITEM(flags))
-            dprintf(("USER32: WinMenu: MENU_ParseResource: not a string item %04x\n", flags ));
-        str = res;
-
-        res += (lstrlenW((LPCWSTR)str) + 1) * sizeof(WCHAR);
-        if (flags & MF_POPUP)
-        {
-            HMENU hSubMenu = ODIN_CreatePopupMenu();
-            if (!hSubMenu) return NULL;
-            if (!(res = MENU_ParseResource( res, hSubMenu)))
-                return NULL;
-            ODIN_AppendMenuW( hMenu, flags, (UINT)hSubMenu, (LPCWSTR)str );
-        }
-        else  /* Not a popup */
-        {
-            ODIN_AppendMenuW( hMenu, flags, id, *(LPCWSTR)str ? (LPCWSTR)str : NULL );
-        }
-    } while (!(flags & MF_END));
-    return res;
-}
-
-
-/**********************************************************************
- *         MENUEX_ParseResource
- *
- * Parse an extended menu resource and add items to the menu.
- * Return a pointer to the end of the resource.
- */
-static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu)
-{
-   WORD resinfo;
-
-    do {
-        MENUITEMINFOW mii;
-
-        mii.cbSize = sizeof(mii);
-        mii.fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
-        mii.fType = GET_DWORD(res);
-        res += sizeof(DWORD);
-        mii.fState = GET_DWORD(res);
-        res += sizeof(DWORD);
-        mii.wID = GET_DWORD(res);
-        res += sizeof(DWORD);
-        resinfo = GET_WORD(res); /* FIXME: for 16-bit apps this is a byte.  */
-        res += sizeof(WORD);
-
-        /* Align the text on a word boundary.  */
-        res += (~((int)res - 1)) & 1;
-        mii.dwTypeData = (LPWSTR) res;
-        res += (1 + lstrlenW(mii.dwTypeData)) * sizeof(WCHAR);
-        /* Align the following fields on a dword boundary.  */
-        res += (~((int)res - 1)) & 3;
-
-        /* FIXME: This is inefficient and cannot be optimised away by gcc.  */
-        {
-            LPSTR newstr = HEAP_strdupWtoA(GetProcessHeap(), 0, mii.dwTypeData);
-
-            dprintf(("USER32:WinMenu:MENUEX_ParseResource Menu item: [%08x,%08x,%04x,%04x,%s]\n",
-                     mii.fType, mii.fState, mii.wID, resinfo, newstr));
-            HeapFree( GetProcessHeap(), 0, newstr );
-        }
-
-        if (resinfo & 1) {                    /* Pop-up? */
-            /* DWORD helpid = GET_DWORD(res); FIXME: use this.  */
-            res += sizeof(DWORD);
-            mii.hSubMenu = ODIN_CreatePopupMenu();
-            if (!mii.hSubMenu)
-                return NULL;
-            if (!(res = MENUEX_ParseResource(res, mii.hSubMenu))) {
-                DestroyMenu(mii.hSubMenu);
-                return NULL;
-            }
-            mii.fMask |= MIIM_SUBMENU;
-            mii.fType |= MF_POPUP;
-        }
-        ODIN_InsertMenuItemW(hMenu, -1, MF_BYPOSITION, &mii);
-    }
-    while (!(resinfo & MF_END));
-
-    return res;
-}
-/**********************************************************************
- *    myLoadMenuIndirect
- */
-HMENU myLoadMenuIndirect(LPCVOID pMenuTemplate)
-{
-  HMENU hMenu;
-  WORD  version,
-        offset;
-  LPCSTR p = (LPCSTR)pMenuTemplate;
-
-    version = GET_WORD(p);
-    p += sizeof(WORD);
-
-    switch (version)
-    {
-    case 0:
-        offset = GET_WORD(p);
-        p += sizeof(WORD) + offset;
-        if (!(hMenu = ODIN_CreateMenu()))
-            return 0;
-        if (!MENU_ParseResource( p, hMenu))
-        {
-            DestroyMenu( hMenu );
-            return 0;
-        }
-        return hMenu;
-
-    case 1:
-        offset = GET_WORD(p);
-        p += sizeof(WORD) + offset;
-        if (!(hMenu = ODIN_CreateMenu()))
-            return 0;
-        if (!MENUEX_ParseResource( p, hMenu))
-        {
-            ODIN_DestroyMenu( hMenu );
-            return 0;
-        }
-        return hMenu;
-
-    default:
-        dprintf(("USER32: LoadMenuIndirectA: version %d not supported.\n", version));
-        return 0;
-    }
-}
-//******************************************************************************
-//******************************************************************************
-void SetInternalMenuInfo(HMENU hMenu)
-{
-  LPPOPUPMENU lpMenuInfo;
-
-    lpMenuInfo = (LPPOPUPMENU)malloc(sizeof(*lpMenuInfo));
-    memset(lpMenuInfo, 0, sizeof(*lpMenuInfo));
-    OSLibWinSetWindowULong(hMenu, OSLIB_QWL_USER, (ULONG)lpMenuInfo);
-}
-//******************************************************************************
-//******************************************************************************
-LPPOPUPMENU GetInternalMenuInfo(HMENU hMenu)
-{
-    return (LPPOPUPMENU)OSLibWinGetWindowULong(hMenu, OSLIB_QWL_USER);
-}
-//******************************************************************************
-//******************************************************************************
-void DeleteInternalMenuInfo(HMENU hMenu)
-{
-  LPPOPUPMENU lpMenuInfo;
-
-    lpMenuInfo = (LPPOPUPMENU)OSLibWinGetWindowULong(hMenu, OSLIB_QWL_USER);
-    if(lpMenuInfo) {
-        free(lpMenuInfo);
-        OSLibWinSetWindowULong(hMenu, OSLIB_QWL_USER, 0);
-    }
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION0(HMENU, CreateMenu)
-{
-  HMENU hMenu;
-
-    dprintf(("USER32: CreateMenu\n"));
-
-    hMenu = OSLibWinCreateEmptyMenu();
-    if(hMenu) {
-            SetInternalMenuInfo(hMenu);
-    }
-    else    SetLastError(ERROR_INVALID_PARAMETER); //wrong error
-
-    return hMenu;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION0(HMENU, CreatePopupMenu)
-{
-  HMENU hMenu;
-
-    dprintf(("USER32: CreatePopupMenu\n"));
-
-    hMenu = OSLibWinCreateEmptyPopupMenu();
-    if(hMenu) {
-            SetInternalMenuInfo(hMenu);
-    }
-    else    SetLastError(ERROR_INVALID_PARAMETER); //wrong error
-
-    return hMenu;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(HMENU,     LoadMenuA,
-              HINSTANCE, hinst,
-              LPCSTR,    lpszMenu)
-{
-  Win32Resource *winres;
-  HMENU hMenu;
-
-    winres = (Win32Resource *)FindResourceA(hinst, lpszMenu, RT_MENUA);
-    if(winres)
-    {
-        hMenu = myLoadMenuIndirect((MENUITEMTEMPLATEHEADER *)winres->lockResource());
-        if(hMenu) {
-                SetInternalMenuInfo(hMenu);
-        }
-        else    SetLastError(ERROR_INVALID_PARAMETER);
-
-        delete winres;
-        return hMenu;
-    }
-    return 0;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(HMENU, LoadMenuW,
-              HINSTANCE, hinst,
-              LPCWSTR, lpszMenu)
-{
-  Win32Resource *winres;
-  HMENU hMenu;
-
-    winres = (Win32Resource *)FindResourceW(hinst, lpszMenu, RT_MENUW);
-    if(winres) {
-        hMenu = myLoadMenuIndirect((MENUITEMTEMPLATEHEADER *)winres->lockResource());
-        if(hMenu) {
-                SetInternalMenuInfo(hMenu);
-        }
-        else    SetLastError(ERROR_INVALID_PARAMETER);
-
-        delete winres;
-        return hMenu;
-    }
-    return 0;
-}
-//******************************************************************************
-//NOTE: menutemplate strings are always in Unicode format
-//******************************************************************************
-ODINFUNCTION1(HMENU, LoadMenuIndirectW,
-              const MENUITEMTEMPLATEHEADER *, menuTemplate)
-{
-  HMENU hMenu;
-
-    hMenu = myLoadMenuIndirect(menuTemplate);
-    if(hMenu) {
-            SetInternalMenuInfo(hMenu);
-    }
-    else    SetLastError(ERROR_INVALID_PARAMETER);
-
-    return (HMENU)hMenu;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION1(BOOL,  DestroyMenu,
-              HMENU, hMenu)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    DeleteInternalMenuInfo(hMenu);
-    return O32_DestroyMenu(hMenu);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION1(HMENU, GetMenu,
-              HWND,  hwnd)
-{
-  Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window)
-    {
-        dprintf(("GetMenu, window %x not found", hwnd));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return 0;
-    }
-
-    return window->GetMenu();
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(BOOL,  SetMenu,
-              HWND,  hwnd,
-              HMENU, hMenu)
-{
-  Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window)
-    {
-        dprintf(("SetMenu, window %x not found", hwnd));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return 0;
-    }
-
-    window->SetMenu(hMenu);
-    return TRUE;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION0(DWORD, GetMenuCheckMarkDimensions)
-{
-  return O32_GetMenuCheckMarkDimensions();
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION1(int,   GetMenuItemCount,
-              HMENU, hMenu)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return OSLibGetMenuItemCount(hMenu);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(UINT,  GetMenuItemID,
-              HMENU, hMenu,
-              int,   nPos)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return O32_GetMenuItemID(hMenu, nPos);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(UINT,  GetMenuState,
-              HMENU, hMenu,
-              UINT,  arg2,
-              UINT,  arg3)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_GetMenuState(hMenu, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(int,   GetMenuStringA,
-              HMENU, hMenu,
-              UINT,  idItem,
-              LPSTR, lpsz,
-              int,   cchMax,
-              UINT,  fuFlags)
-{
- int rc, nritems;
-
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    if(!lpsz || !cchMax) {//determine menu string length
-        char menustr[256];
-        rc = O32_GetMenuString(hMenu, idItem, menustr, sizeof(menustr), fuFlags);
-        //SvL: Open32 returns the wrong error
-        return (rc == -1) ? 0 : rc;
-    }
-    rc = O32_GetMenuString(hMenu, idItem, lpsz, cchMax, fuFlags);
-    //SvL: Open32 returns the wrong error
-    return (rc == -1) ? 0 : rc;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(int,   GetMenuStringW,
-              HMENU, hMenu,
-              UINT,  idItem,
-              LPWSTR,lpsz,
-              int,   cchMax,
-              UINT,  fuFlags)
-{
-  char *astring = (char *)malloc(cchMax);
-  int   rc;
-
-    rc = ODIN_GetMenuStringA(hMenu, idItem, astring, cchMax, fuFlags);
-    if(rc)
-    {
-            dprintf(("USER32: GetMenuStringW %s\n", astring));
-            AsciiToUnicode(astring, lpsz);
-    }
-    else    lpsz[0] = 0;
-    free(astring);
-
-    return(rc);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, SetMenuItemBitmaps,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3,
-              HBITMAP, arg4,
-              HBITMAP, arg5)
-{
-    dprintf(("USER32:  SetMenuItemBitmaps\n"));
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return O32_SetMenuItemBitmaps(hMenu, arg2, arg3, arg4, arg5);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(HMENU, GetSubMenu,
-              HWND, hMenu,
-              int, arg2)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_GetSubMenu(hMenu, arg2);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(HMENU, GetSystemMenu,
-              HWND,  hSystemWindow,
-              BOOL,  bRevert)
-{
-    Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hSystemWindow);
-    if(!window)
-    {
-        dprintf(("GetSystemMenu, window %x not found", hSystemWindow));
-        return 0;
-    }
-
-    return O32_GetSystemMenu(window->getOS2FrameWindowHandle(), bRevert);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION1(BOOL, IsMenu,
-              HMENU, hMenu)
-{
-    dprintf(("USER32:  IsMenu\n"));
-    return O32_IsMenu(hMenu);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION7(BOOL, TrackPopupMenu,
-              HMENU, hMenu,
-              UINT, arg2,
-              int, arg3,
-              int, arg4,
-              int, arg5,
-              HWND, arg6,
-              const RECT *, arg7)
-{
-  Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(arg6);
-    if(!window)
-    {
-        dprintf(("TrackPopupMenu, window %x not found", arg6));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return 0;
-    }
-    dprintf(("USER32:  TrackPopupMenu\n"));
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return O32_TrackPopupMenu(hMenu, arg2, arg3, arg4, arg5, window->getOS2WindowHandle(),
-                              arg7);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION6(BOOL, TrackPopupMenuEx,
-              HMENU, hMenu,
-              UINT, flags,
-              int, X,
-              int, Y,
-              HWND, hwnd,
-              LPTPMPARAMS, lpPM)
-{
-  RECT *rect = NULL;
-  Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window)
-    {
-        dprintf(("TrackPopupMenu, window %x not found", hwnd));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return 0;
-    }
-
-    dprintf(("USER32:  TrackPopupMenuEx, not completely implemented\n"));
-
-    if (lpPM != NULL) // this parameter can be NULL
-      if(lpPM->cbSize != 0)
-        rect = &lpPM->rcExclude;
-
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return O32_TrackPopupMenu(hMenu, flags, X, Y, 0, window->getOS2WindowHandle(), rect);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION4(BOOL, AppendMenuA,
-              HMENU, hMenu,
-              UINT, uFlags,
-              UINT, id,
-              LPCSTR, lpNewItem)
-{
-     return ODIN_InsertMenuA( hMenu, -1, uFlags | MF_BYPOSITION, id, lpNewItem );
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION4(BOOL, AppendMenuW,
-              HMENU, hMenu,
-              UINT, uFlags,
-              UINT, id,
-              LPCWSTR, lpNewItem)
-{
-     return ODIN_InsertMenuW( hMenu, -1, uFlags | MF_BYPOSITION, id, lpNewItem );
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(DWORD, CheckMenuItem,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    return O32_CheckMenuItem(hMenu, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(BOOL,EnableMenuItem,HMENU,hMenu,
-                                  UINT, uIDEnableItem,
-                                  UINT, uEnable)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_EnableMenuItem(hMenu,
-                              uIDEnableItem,
-                              uEnable);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, ModifyMenuA,
-              HMENU, hMenu,
-              UINT, uItem,
-              UINT, fuFlags,
-              UINT, idNewItem,
-              LPCSTR, lpszNewItem)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    if(IS_STRING_ITEM(fuFlags) && HIWORD(lpszNewItem) != 0) {
-        dprintf(("ModifyMenuA %s", lpszNewItem));
-    }
-/* //CB: doesn't compile, but don't need it anyway
-    if(((fuFlags & (MF_BYCOMMAND|MF_BYPOSITION|MF_POPUP)) == MF_BYCOMMAND) && uItem != idNewItem) {
-        DWORD pos = OSLibGetMenuItemPos(hMenu, uItem);
-        ODIN_DeleteMenu(hMenu, uItem, MF_BYCOMMAND);
-        return ODIN_InsertMenuA(hMenu, pos, fuFlags | MF_BYPOSITION, idNewItem, lpszNewItem);
-    }
-*/
-    return O32_ModifyMenu(hMenu, uItem, fuFlags, idNewItem, lpszNewItem);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, ModifyMenuW,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3,
-              UINT, arg4,
-              LPCWSTR, arg5)
-{
- BOOL  rc;
- char *astring = NULL;
-
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
-      astring = UnicodeToAsciiString((LPWSTR)arg5);
-    else
-      astring = (char *) arg5;
-
-    rc = ODIN_ModifyMenuA(hMenu, arg2, arg3, arg4, astring);
-    if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
-      FreeAsciiString(astring);
-
-    return(rc);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(BOOL, RemoveMenu,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_RemoveMenu(hMenu, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(BOOL, DeleteMenu,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3)
-{
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_DeleteMenu(hMenu, arg2, arg3);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION4(BOOL, HiliteMenuItem,
-              HWND, hMenu,
-              HMENU, arg2,
-              UINT, arg3,
-              UINT, arg4)
-{
-    dprintf(("USER32:  OS2HiliteMenuItem\n"));
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return O32_HiliteMenuItem(hMenu, arg2, arg3, arg4);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, InsertMenuA,
-              HMENU, hMenu,
-              UINT, pos,
-              UINT, flags,
-              UINT, id,
-              LPCSTR, str)
-{
-    if(IS_STRING_ITEM(flags) && HIWORD(str)) {
-         dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
-    }
-    else dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
-
-    if(hMenu == 0)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    if(IS_STRING_ITEM(flags) && (!str || *str == NULL)) {
-        flags |= MF_SEPARATOR;
-    }
-    //SvL: RealPlayer calls InsertMenu with flag 0 & pos -1
-    if((flags & (MF_BYCOMMAND|MF_BYPOSITION)) == 0 && (pos == 0xffffffff))
-        flags |= MF_BYPOSITION;
-
-    return O32_InsertMenu(hMenu, pos, flags, id, str);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, InsertMenuW,
-              HMENU, hMenu,
-              UINT, arg2,
-              UINT, arg3,
-              UINT, arg4,
-              LPCWSTR, arg5)
-{
- BOOL  rc;
- char *astring = NULL;
-
-    if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
-      astring = UnicodeToAsciiString((LPWSTR)arg5);
-    else
-      astring = (char *) arg5;
-
-    rc = ODIN_InsertMenuA(hMenu, arg2, arg3, arg4, astring);
-
-    if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
-      FreeAsciiString(astring);
-
-    return(rc);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION2(BOOL, SetMenuContextHelpId,
-              HMENU, hMenu,
-              DWORD, dwContextHelpId)
-{
- POPUPMENU *menu;
-
-    menu = GetInternalMenuInfo(hMenu);
-    if(menu == NULL) {
-        dprintf(("USER32: SetMenuContextHelpId(%x) No POPUPMENU structure found!", hMenu));
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-    dprintf(("USER32:  SetMenuContextHelpId %x %d", hMenu, dwContextHelpId));
-    menu->dwContextHelpID = dwContextHelpId;
-    return(TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION1(DWORD, GetMenuContextHelpId,
-              HMENU, hMenu)
-{
- POPUPMENU *menu;
-
-    menu = GetInternalMenuInfo(hMenu);
-    if(menu == NULL) {
-        dprintf(("USER32: GetMenuContextHelpId(%x) No POPUPMENU structure found!", hMenu));
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-    dprintf(("USER32:  GetMenuContextHelpId %x %d", hMenu, menu->dwContextHelpID));
-    return menu->dwContextHelpID;
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, CheckMenuRadioItem,
-              HMENU, hMenu,
-              UINT, idFirst,
-              UINT, idLast,
-              UINT, idCheck,
-              UINT, uFlags)
-{
-  dprintf(("USER32:  OS2CheckMenuRadioItem, not implemented\n"));
-  return(TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, ChangeMenuA,
-              HMENU, hMenu,
-              UINT, pos,
-              LPCSTR, data,
-              UINT, id,
-              UINT, flags)
-{
-    dprintf(("USER32:  ChangeMenuA flags %X\n", flags));
-
-    if (flags & MF_APPEND) return ODIN_AppendMenuA(hMenu, flags & ~MF_APPEND,
-                                                   id, data );
-    if (flags & MF_DELETE) return ODIN_DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
-    if (flags & MF_CHANGE) return ODIN_ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE,
-                                                   id, data );
-    if (flags & MF_REMOVE) return ODIN_RemoveMenu(hMenu,
-                                                  flags & MF_BYPOSITION ? pos : id,
-                                                  flags & ~MF_REMOVE );
-    /* Default: MF_INSERT */
-    return InsertMenuA( hMenu, pos, flags, id, data );
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION5(BOOL, ChangeMenuW,
-              HMENU, hMenu,
-              UINT, pos,
-              LPCWSTR, data,
-              UINT, id,
-              UINT, flags)
-{
-    dprintf(("USER32:  ChangeMenuW flags %X\n", flags));
-
-    if (flags & MF_APPEND) return ODIN_AppendMenuW(hMenu, flags & ~MF_APPEND,
-                                                   id, data );
-    if (flags & MF_DELETE) return ODIN_DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
-    if (flags & MF_CHANGE) return ODIN_ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE,
-                                                   id, data );
-    if (flags & MF_REMOVE) return ODIN_RemoveMenu(hMenu,
-                                                  flags & MF_BYPOSITION ? pos : id,
-                                                     flags & ~MF_REMOVE );
-    /* Default: MF_INSERT */
-    return InsertMenuW(hMenu, pos, flags, id, data);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION4(BOOL, SetMenuItemInfoA,
-              HMENU, hMenu,
-              UINT, par1,
-              BOOL, par2,
-              const MENUITEMINFOA *, lpmii)
-{
-    dprintf(("USER32:  SetMenuItemInfoA faked %x", hMenu));
-
-    if (!hMenu) {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-    return TRUE;
-}
-/*****************************************************************************
- * Function  : SetMenuItemInfoW
- * Purpose   : The SetMenuItemInfo function changes information about a menu item.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *               error information, use the GetLastError function.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION4(BOOL, SetMenuItemInfoW,
-              HMENU, hMenu,
-              UINT, uItem,
-              BOOL, fByPosition,
-              const MENUITEMINFOW *, lpmmi)
-{
-  dprintf(("USER32:SetMenuItemInfoW (%08xh,%08xh,%08xh,%08x) not implemented.\n",
-         hMenu,
-         uItem,
-         fByPosition,
-         lpmmi));
-
-  return (SetMenuItemInfoA(hMenu,
-                           uItem,
-                           fByPosition,
-                           (const MENUITEMINFOA *)lpmmi));
-}
-/*****************************************************************************
- * Function  : GetMenuDefaultItem
- * Purpose   : TheGetMenuDefaultItem function determines the default menu item
- *             on the specified menu.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is the identifier or
- *             position of the menu item.
- *             If the function fails, the return value is - 1.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION3(UINT, GetMenuDefaultItem,
-              HMENU, hMenu,
-              UINT, fByPos,
-              UINT, gmdiFlags)
-{
-  dprintf(("USER32:GetMenuDefaultItem (%08xh,%u,%08x) not implemented.\n",
-         hMenu,
-         fByPos,
-         gmdiFlags));
-
-  return (-1);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION3(BOOL, SetMenuDefaultItem,
-              HMENU, hMenu,
-              UINT, uItem,
-              UINT, fByPos)
-{
-    dprintf(("USER32:  SetMenuDefaultItem, faked\n"));
-    return(TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL GetMenuItemInfoAW(HMENU hMenu, UINT uItem, BOOL byPos, MENUITEMINFOA *lpmii, BOOL unicode)
-{
-    if(byPos) {
-        uItem = GetMenuItemID(hMenu, uItem);
-    }
-    if(ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND) == -1) {
-        //item doesn't exist
-        dprintf(("USER32:  GetMenuItemInfoAW %x item %d doesn't exist", hMenu, uItem));
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-    if (lpmii->fMask & MIIM_TYPE)
-    {
-        lpmii->fType = ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND); //not correct
-//      lpmii->fType = menu->fType;
-        if (unicode) {
-            lpmii->cch = ODIN_GetMenuStringW(hMenu, uItem, (LPWSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
-        }
-        else {
-            lpmii->cch = ODIN_GetMenuStringA(hMenu, uItem, (LPSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
-        }
-//TODO:
-#if 0
-        switch (MENU_ITEM_TYPE(menu->fType)) {
-        case MF_STRING:
-            if (menu->text && lpmii->dwTypeData && lpmii->cch) {
-                if (unicode) {
-                    lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text, lpmii->cch);
-                    lpmii->cch = lstrlenW((LPWSTR)menu->text);
-                }
-                else {
-                    lstrcpynA(lpmii->dwTypeData, menu->text, lpmii->cch);
-                    lpmii->cch = lstrlenA(menu->text);
-                }
-            }
-            break;
-        case MF_OWNERDRAW:
-        case MF_BITMAP:
-            lpmii->dwTypeData = menu->text;
-            /* fall through */
-        default:
-            lpmii->cch = 0;
-        }
-#endif
-    }
-
-    if (lpmii->fMask & MIIM_STRING) {
-        if (unicode) {
-            lpmii->cch = ODIN_GetMenuStringW(hMenu, uItem, (LPWSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
-        }
-        else {
-            lpmii->cch = ODIN_GetMenuStringA(hMenu, uItem, (LPSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
-        }
-    }
-
-//TODO:
-#if 0
-    if (lpmii->fMask & MIIM_FTYPE)
-        lpmii->fType = menu->fType;
-
-    if (lpmii->fMask & MIIM_BITMAP)
-        lpmii->hbmpItem = menu->hbmpItem;
-#endif
-
-    if (lpmii->fMask & MIIM_STATE)
-        lpmii->fState = ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND);
-
-    if (lpmii->fMask & MIIM_ID)
-        lpmii->wID = uItem;
-
-//TODO:
-#if 1
-    lpmii->hSubMenu = 0;
-    lpmii->hbmpChecked = 0;
-    lpmii->hbmpUnchecked = 0;
-    lpmii->dwItemData = 0;
-#else
-    if (lpmii->fMask & MIIM_SUBMENU)
-        lpmii->hSubMenu = ODIN_GetSubMenu(hMenu, uItem); //need index, not id
-
-    if (lpmii->fMask & MIIM_CHECKMARKS) {
-        lpmii->hbmpChecked = menu->hCheckBit;
-        lpmii->hbmpUnchecked = menu->hUnCheckBit;
-    }
-    if (lpmii->fMask & MIIM_DATA)
-        lpmii->dwItemData = menu->dwItemData;
-#endif
-
-    return(FALSE);
-}
-//******************************************************************************
-//******************************************************************************
-ODINFUNCTION4(BOOL, GetMenuItemInfoA,
-              HMENU, hMenu,
-              UINT, uItem,
-              BOOL, byPos,
-              MENUITEMINFOA *, lpMenuItemInfo)
-{
-    return GetMenuItemInfoAW(hMenu, uItem, byPos, lpMenuItemInfo, FALSE);
-}
-/*****************************************************************************
- * Function  : GetMenuItemInfoW
- * Purpose   : The GetMenuItemInfo function retrieves information about a menu item.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *             error information, use the GetLastError function.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION4(BOOL, GetMenuItemInfoW,
-              HMENU, hMenu,
-              UINT, uItem,
-              BOOL, byPos,
-              MENUITEMINFOW *, lpMenuItemInfo)
-{
-    return GetMenuItemInfoAW(hMenu, uItem, byPos, (MENUITEMINFOA*)lpMenuItemInfo, TRUE);
-}
-/*****************************************************************************
- * Function  : GetMenuItemRect
- * Purpose   : The GetMenuItemRect function retrieves the bounding rectangle
- *             for the specified menu item.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get
- *             extended error information, use the GetLastError function.
- * Remark    :
- * Status    :
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-BOOL GetMenuItemRect(HWND hwnd, HMENU hMenu, UINT uItem, LPRECT lprcItem)
-{
- BOOL rc;
-
-    rc = OSLibGetMenuItemRect(hMenu, uItem, lprcItem);
-    dprintf(("GetMenuItemRect %x %x %x (%d,%d)(%d,%d)", hwnd, hMenu, uItem, lprcItem->top, lprcItem->left, lprcItem->bottom, lprcItem->right));
-    return rc;
-}
-/*****************************************************************************
- * Function  : InsertMenuItemA
- * Purpose   : The InsertMenuItem function inserts a new menu item at the specified
- *             position in a menu bar or pop-up menu.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *             error information, use the GetLastError function.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION4(BOOL, InsertMenuItemA,
-              HMENU, hMenu,
-              UINT, uItem,
-              BOOL, fByPosition,
-              const MENUITEMINFOA*, lpmii)
-{
- DWORD dwType;
- BOOL rc;
-
-    dprintf(("USER32:InsertMenuItemA (%08xh,%08xh,%u,%08x) not correctly implemented.\n",
-         hMenu,
-         uItem,
-         fByPosition,
-         lpmii));
-
-    if(fByPosition) {
-            dwType = lpmii->fType | MF_BYPOSITION;
-    }
-    else    dwType = lpmii->fType | MF_BYCOMMAND;
-
-    if(lpmii->fMask & MIIM_SUBMENU && lpmii->hSubMenu) {
-        rc &= ODIN_InsertMenuA(hMenu, uItem, dwType | MF_POPUP, lpmii->hSubMenu, lpmii->dwTypeData);
-    }
-    else
-    if(lpmii->fMask & MIIM_ID) {
-        rc = ODIN_InsertMenuA(hMenu, uItem, dwType, lpmii->wID, lpmii->dwTypeData);
-    }
-    if(lpmii->fMask & MIIM_STATE) {
-    //TODO
-    }
-    return rc;
-}
-
-
-/*****************************************************************************
- * Function  : InsertMenuItemW
- * Purpose   : The InsertMenuItem function inserts a new menu item at the specified
- *             position in a menu bar or pop-up menu.
- * Parameters:
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *             error information, use the GetLastError function.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION4(BOOL, InsertMenuItemW,
-              HMENU, hMenu,
-              UINT, uItem,
-              BOOL, fByPosition,
-              const MENUITEMINFOW *, lpmii)
-{
-    dprintf(("USER32:InsertMenuItemW (%08xh,%08xh,%u,%08x) not correctly implemented.\n",
-         hMenu,
-         uItem,
-         fByPosition,
-         lpmii));
-
-    if(fByPosition) {
-            return ODIN_InsertMenuW(hMenu, uItem, lpmii->fType | MF_BYPOSITION, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
-    }
-    else    return ODIN_InsertMenuW(hMenu, uItem, lpmii->fType | MF_BYCOMMAND, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
-}
-/*****************************************************************************
- * Function  : MenuItemFromPoint
- * Purpose   : TheMenuItemFromPoint function determines which menu item, if
- *             any, is at the specified location.
- * Parameters:
- * Variables :
- * Result    : Returns the zero-based position of the menu item at the specified
- *             location or -1 if no menu item is at the specified location.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION3(UINT, MenuItemFromPoint,
-              HWND, hWnd,
-              HMENU, hMenu,
-              POINT, ptScreen)
-{
-  dprintf(("USER32:MenuItemFromPoint (%08xh,%08xh,%u) not implemented.\n",
-         hWnd,
-         hMenu,
-         ptScreen));
-
-  return (-1);
-}
-
-
-/*****************************************************************************
- * Function  :  GetMenuInfo
- * Parameters:
- * Variables :
- * Result    :
- * Remark    :
- * Status    : UNTESTED STUB win98/NT5.0
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION2(BOOL, GetMenuInfo,
-              HMENU, hMenu,
-              LPMENUINFO, lpmi)
-{
- POPUPMENU *menu;
-
-    menu = GetInternalMenuInfo(hMenu);
-    if(menu == NULL) {
-        dprintf(("USER32: GetMenuInfo(%08xh,%08xh) No POPUPMENU structure found!", hMenu, lpmi));
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-    dprintf(("USER32: GetMenuInfo(%08xh,%08xh)", hMenu, lpmi));
-
-    if (lpmi)
-    {
-        if (lpmi->fMask & MIM_BACKGROUND)
-            lpmi->hbrBack = menu->hbrBack;
-
-        if (lpmi->fMask & MIM_HELPID)
-            lpmi->dwContextHelpID = menu->dwContextHelpID;
-
-        if (lpmi->fMask & MIM_MAXHEIGHT)
-            lpmi->cyMax = menu->cyMax;
-
-        if (lpmi->fMask & MIM_MENUDATA)
-            lpmi->dwMenuData = menu->dwMenuData;
-
-        if (lpmi->fMask & MIM_STYLE)
-            lpmi->dwStyle = menu->dwStyle;
-
-        return TRUE;
-    }
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return FALSE;
-}
-/*****************************************************************************
- * Function  :  SetMenuInfo
- * Purpose   :
- * Parameters:
- * Variables :
- * Result    :
- * Remark    :
- * FIXME
- * MIM_APPLYTOSUBMENUS
- * actually use the items to draw the menu
- * Status    : UNTESTED STUB win98/NT5.0
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-ODINFUNCTION2(BOOL, SetMenuInfo,
-              HMENU, hMenu,
-              LPCMENUINFO, lpmi)
-{
- POPUPMENU *menu;
-
-    menu = GetInternalMenuInfo(hMenu);
-    if(menu == NULL) {
-        dprintf(("USER32: SetMenuInfo(%08xh,%08xh) No POPUPMENU structure found!", hMenu, lpmi));
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    dprintf(("USER32: SetMenuInfo(%08xh,%08xh)", hMenu, lpmi));
-
-    if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)))
-    {
-        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)
-            menu->dwMenuData = lpmi->dwMenuData;
-
-        if (lpmi->fMask & MIM_STYLE)
-            menu->dwStyle = lpmi->dwStyle;
-
-        return TRUE;
-    }
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return FALSE;
-}
-//******************************************************************************
-//******************************************************************************
-
Index: trunk/src/user32/new/winmenudef.h
===================================================================
--- trunk/src/user32/new/winmenudef.h	(revision 2394)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/* $Id: winmenudef.h,v 1.1 2000-01-01 14:54:58 cbratschi Exp $ */
-
-/*
- * Win32 menu API functions for OS/2
- *
- * Copyright 1998 Sander van Leeuwen
- * Copyright 1998 Patrick Haller
- *
- * Parts ported from Wine: 
- * Copyright 1993 Martin Ayotte
- * Copyright 1994 Alexandre Julliard
- * Copyright 1997 Morten Welinder
- *
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-
-#ifndef __WINMENUDEF_H__
-#define __WINMENUDEF_H__
-
-/* Menu item structure */
-typedef struct {
-    /* ----------- MENUITEMINFO Stuff ----------- */
-    UINT fType;			/* Item type. */
-    UINT fState;		/* Item state.  */
-    UINT wID;			/* Item id.  */
-    HMENU hSubMenu;		/* Pop-up menu.  */
-    HBITMAP hCheckBit;		/* Bitmap when checked.  */
-    HBITMAP hUnCheckBit;	/* Bitmap when unchecked.  */
-    LPSTR text;			/* Item text or bitmap handle.  */
-    DWORD dwItemData;		/* Application defined.  */
-    DWORD dwTypeData;		/* depends on fMask */
-    HBITMAP hbmpItem;		/* bitmap in win98 style menus */
-    /* ----------- Wine stuff ----------- */
-    RECT      rect;		/* Item area (relative to menu window) */
-    UINT      xTab;		/* X position of text after Tab */
-} MENUITEM;
-
-/* Popup menu structure */
-typedef struct {
-    WORD        wFlags;       /* Menu flags (MF_POPUP, MF_SYSMENU) */
-    WORD        wMagic;       /* Magic number */
-    HQUEUE16    hTaskQ;       /* Task queue for this menu */
-    WORD	Width;        /* Width of the whole menu */
-    WORD	Height;       /* Height of the whole menu */
-    WORD	nItems;       /* Number of items in the menu */
-    HWND        hWnd;         /* Window containing the menu */
-    MENUITEM    *items;       /* Array of menu items */
-    UINT        FocusedItem;  /* Currently focused item */
-    HWND	hwndOwner;    /* window receiving the messages for ownerdraw */
-    /* ------------ MENUINFO members ------ */
-    DWORD	dwStyle;	/* Extended mennu style */
-    UINT	cyMax;		/* max hight of the whole menu, 0 is screen hight */
-    HBRUSH	hbrBack;	/* brush for menu background */
-    DWORD	dwContextHelpID;
-    DWORD	dwMenuData;	/* application defined value */
-    HMENU       hSysMenuOwner;  /* Handle to the dummy sys menu holder */
-} POPUPMENU, *LPPOPUPMENU;
-
-#endif //__WINMENUDEF_H__
