Made all 16<->32 HWND conversions use explicit functions instead of
implicit type casts.
Moved a lot of 16-bit functions to the new wnd16.c file.
Changed DIALOGINFO structure handling to support 32-bit handles.

diff --git a/controls/button.c b/controls/button.c
index 20ac815..12c6188 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -218,7 +218,8 @@
            btn_type == BS_OWNERDRAW)
         {
             SendMessageW( GetParent(hWnd), WM_COMMAND,
-                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_DOUBLECLICKED ), hWnd);
+                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_DOUBLECLICKED ),
+                          (LPARAM)hWnd);
             break;
         }
         /* fall through */
@@ -263,7 +264,7 @@
                 break;
             }
             SendMessageW( GetParent(hWnd), WM_COMMAND,
-                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_CLICKED ), hWnd);
+                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_CLICKED ), (LPARAM)hWnd);
         }
         break;
 
@@ -308,7 +309,7 @@
             if (btn_type == BS_AUTORADIOBUTTON)
                 SendMessageW( hWnd, BM_SETCHECK, BUTTON_CHECKED, 0 );
             SendMessageW( GetParent(hWnd), WM_COMMAND,
-                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_CLICKED ), hWnd);
+                          MAKEWPARAM( GetWindowLongA(hWnd,GWL_ID), BN_CLICKED ), (LPARAM)hWnd);
         }
         set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS );
         paint_button( hWnd, btn_type, ODA_FOCUS );
@@ -677,7 +678,7 @@
 
     /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
-    SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, hwnd );
+    SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
     hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
     hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
     oldBkMode = SetBkMode(hDC, TRANSPARENT);
@@ -802,10 +803,9 @@
 
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
 
-    /* GetControlBrush16 sends WM_CTLCOLORBTN, plus it returns default brush
-     * if parent didn't return valid one. So we kill two hares at once
-     */
-    hBrush = GetControlBrush16( hwnd, hDC, CTLCOLOR_BTN );
+    hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
+    if (!hBrush) /* did the app forget to call defwindowproc ? */
+        hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
 
     if (style & BS_LEFTTEXT) 
     {
@@ -951,7 +951,9 @@
 
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
     /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
-    hbr = GetControlBrush16( hwnd, hDC, CTLCOLOR_STATIC );
+    hbr = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd );
+    if (!hbr) /* did the app forget to call defwindowproc ? */
+        hbr = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd );
 
     GetClientRect( hwnd, &rc);
     if (TWEAK_WineLook == WIN31_LOOK) {
@@ -1008,7 +1010,10 @@
     GetClientRect( hwnd, &rc);
 
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
-    hBrush = GetControlBrush16( hwnd, hDC, CTLCOLOR_BTN );
+
+    hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
+    if (!hBrush) /* did the app forget to call defwindowproc ? */
+        hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
 
     FillRect( hDC, &rc, hBrush );
     if ((action == ODA_FOCUS) ||
diff --git a/controls/combo.c b/controls/combo.c
index 92dddb2..8d41c6d 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -31,8 +31,8 @@
  */
 
 #define CB_NOTIFY( lphc, code ) \
-	(SendMessageW((lphc)->owner, WM_COMMAND, \
-                      MAKEWPARAM(GetWindowLongA((lphc)->self,GWL_ID), (code)), (lphc)->self))
+    (SendMessageW((lphc)->owner, WM_COMMAND, \
+                  MAKEWPARAM(GetWindowLongA((lphc)->self,GWL_ID), (code)), (LPARAM)(lphc)->self))
 
 #define CB_DISABLED( lphc )   (!IsWindowEnabled((lphc)->self))
 #define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
@@ -626,7 +626,7 @@
 	    }
 
 	    TRACE("init done\n");
-	    return hwnd;
+	    return 0;
 	  }
 	  ERR("edit control failure.\n");
       } else ERR("listbox failure.\n");
@@ -898,7 +898,7 @@
    */
   if (CB_DISABLED(lphc))
   {
-    hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, hDC, lphc->self );
+    hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, hDC, (LPARAM)lphc->self );
 
     /*
      * We have to change the text color since WM_CTLCOLORSTATIC will
@@ -911,11 +911,11 @@
   {
     if (lphc->wState & CBF_EDIT)
     {
-      hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT, hDC, lphc->self );
+      hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT, hDC, (LPARAM)lphc->self );
     }
     else
     {
-      hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX, hDC, lphc->self );
+      hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX, hDC, (LPARAM)lphc->self );
     }
   }
 
diff --git a/controls/icontitle.c b/controls/icontitle.c
index 03bb6da..85bcd42 100644
--- a/controls/icontitle.c
+++ b/controls/icontitle.c
@@ -123,6 +123,7 @@
  */
 static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
 {
+    RECT rect;
     HFONT hPrevFont;
     HBRUSH hBrush = 0;
     COLORREF textColor = 0;
@@ -158,18 +159,16 @@
 	}
     }
 
-    FillWindow16( GetParent(hwnd), hwnd, hDC, hBrush );
+    GetClientRect( hwnd, &rect );
+    DPtoLP( hDC, (LPPOINT)&rect, 2 );
+    FillRect( hDC, &rect, hBrush );
 
     hPrevFont = SelectObject( hDC, hIconTitleFont );
     if( hPrevFont )
     {
-        RECT  rect;
-	INT	length;
 	WCHAR buffer[80];
 
-        GetClientRect( hwnd, &rect );
-
-	length = GetWindowTextW( owner, buffer, 80 );
+        INT length = GetWindowTextW( owner, buffer, sizeof(buffer) );
         SetTextColor( hDC, textColor );
         SetBkMode( hDC, TRANSPARENT );
 
@@ -178,7 +177,7 @@
 
 	SelectObject( hDC, hPrevFont );
     }
-    return ( hPrevFont ) ? TRUE : FALSE;
+    return (hPrevFont != 0);
 }
 
 /***********************************************************************
@@ -187,12 +186,9 @@
 LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
                                  WPARAM wParam, LPARAM lParam )
 {
-    LRESULT retvalue;
     HWND owner = GetWindow( hWnd, GW_OWNER );
-    WND *wnd = WIN_FindWndPtr( hWnd );
 
-    if( !wnd )
-      return 0;
+    if (!IsWindow(hWnd)) return 0;
 
     switch( msg )
     {
@@ -204,44 +200,30 @@
                 SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &bMultiLineTitle, 0 );
                 hIconTitleFont = CreateFontIndirectA( &logFont );
             }
-            retvalue = (hIconTitleFont) ? 0 : -1;
-            goto END;
+            return (hIconTitleFont ? 0 : -1);
 	case WM_NCHITTEST:
-	     retvalue = HTCAPTION;
-             goto END;
+	     return HTCAPTION;
 	case WM_NCMOUSEMOVE:
 	case WM_NCLBUTTONDBLCLK:
-	     retvalue = SendMessageW( owner, msg, wParam, lParam );
-             goto END;
+	     return SendMessageW( owner, msg, wParam, lParam );
 	case WM_ACTIVATE:
 	     if( wParam ) SetActiveWindow( owner );
-	     /* fall through */
-
+             return 0;
 	case WM_CLOSE:
-	     retvalue = 0;
-             goto END;
+	     return 0;
 	case WM_SHOWWINDOW:
-	     if( wnd && wParam ) ICONTITLE_SetTitlePos( hWnd, owner );
-	     retvalue = 0;
-             goto END;
+            if (wParam) ICONTITLE_SetTitlePos( hWnd, owner );
+	     return 0;
 	case WM_ERASEBKGND:
-	     if( wnd )
-	     {
-		 if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
-		     lParam = SendMessageA( owner, WM_ISACTIVEICON, 0, 0 );
-		 else
-		     lParam = (owner == GetActiveWindow());
-		 if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) )
-		     ValidateRect( hWnd, NULL );
-                 retvalue = 1;
-                 goto END;
-	     }
+            if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
+                lParam = SendMessageA( owner, WM_ISACTIVEICON, 0, 0 );
+            else
+                lParam = (owner == GetActiveWindow());
+            if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) )
+                ValidateRect( hWnd, NULL );
+            return 1;
     }
-
-    retvalue = DefWindowProcW( hWnd, msg, wParam, lParam );
-END:
-    WIN_ReleaseWndPtr(wnd);
-    return retvalue;
+    return DefWindowProcW( hWnd, msg, wParam, lParam );
 }
 
 
diff --git a/controls/menu.c b/controls/menu.c
index 675026d..f15adea 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -1068,7 +1068,7 @@
         if (lpitem->fState & MF_GRAYED)  dis.itemState |= ODS_GRAYED;
         if (lpitem->fState & MF_HILITE)  dis.itemState |= ODS_SELECTED;
         dis.itemAction = odaction; /* ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS; */
-        dis.hwndItem   = hmenu;
+        dis.hwndItem   = (HWND)hmenu;
         dis.hDC        = hdc;
         dis.rcItem     = lpitem->rect;
         TRACE("Ownerdraw: owner=%04x itemID=%d, itemState=%d, itemAction=%d, "
@@ -2901,7 +2901,7 @@
     if (!(wFlags & TPM_NONOTIFY))
        SendMessageA( hWnd, WM_ENTERMENULOOP, bPopup, 0 );
 
-    SendMessageA( hWnd, WM_SETCURSOR, hWnd, HTCAPTION );
+    SendMessageA( hWnd, WM_SETCURSOR, (WPARAM)hWnd, HTCAPTION );
 
     if (!(wFlags & TPM_NONOTIFY))
     {
@@ -3007,20 +3007,6 @@
 
 
 /**********************************************************************
- *           TrackPopupMenu   (USER.416)
- */
-BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
-                           INT16 nReserved, HWND16 hWnd, const RECT16 *lpRect )
-{
-    RECT r;
-    if (lpRect)
-   	 CONV_RECT16TO32( lpRect, &r );
-    return TrackPopupMenu( hMenu, wFlags, x, y, nReserved, hWnd,
-                             lpRect ? &r : NULL );
-}
-
-
-/**********************************************************************
  *           TrackPopupMenu   (USER32.@)
  *
  * Like the win32 API, the function return the command ID only if the
@@ -3350,16 +3336,6 @@
 
 
 /**********************************************************************
- *         HiliteMenuItem    (USER.162)
- */
-BOOL16 WINAPI HiliteMenuItem16( HWND16 hWnd, HMENU16 hMenu, UINT16 wItemID,
-                                UINT16 wHilite )
-{
-    return HiliteMenuItem( hWnd, hMenu, wItemID, wHilite );
-}
-
-
-/**********************************************************************
  *         HiliteMenuItem    (USER32.@)
  */
 BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
@@ -3836,15 +3812,6 @@
 
 
 /**********************************************************************
- *         GetSystemMenu    (USER.156)
- */
-HMENU16 WINAPI GetSystemMenu16( HWND16 hWnd, BOOL16 bRevert )
-{
-    return GetSystemMenu( hWnd, bRevert );
-}
-
-
-/**********************************************************************
  *         GetSystemMenu    (USER32.@)
  */
 HMENU WINAPI GetSystemMenu( HWND hWnd, BOOL bRevert )
@@ -3899,15 +3866,6 @@
 
 
 /*******************************************************************
- *         SetSystemMenu    (USER.280)
- */
-BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
-{
-    return SetSystemMenu( hwnd, hMenu );
-}
-
-
-/*******************************************************************
  *         SetSystemMenu    (USER32.@)
  */
 BOOL WINAPI SetSystemMenu( HWND hwnd, HMENU hMenu )
@@ -3926,15 +3884,6 @@
 
 
 /**********************************************************************
- *         GetMenu    (USER.157)
- */
-HMENU16 WINAPI GetMenu16( HWND16 hWnd ) 
-{
-    return (HMENU16)GetMenu(hWnd);
-}
-
-
-/**********************************************************************
  *         GetMenu    (USER32.@)
  */
 HMENU WINAPI GetMenu( HWND hWnd ) 
@@ -3946,15 +3895,6 @@
 
 
 /**********************************************************************
- *         SetMenu    (USER.158)
- */
-BOOL16 WINAPI SetMenu16( HWND16 hWnd, HMENU16 hMenu )
-{
-    return SetMenu( hWnd, hMenu );
-}
-
-
-/**********************************************************************
  *         SetMenu    (USER32.@)
  */
 BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
@@ -4013,15 +3953,6 @@
 
 
 /**********************************************************************
- *         DrawMenuBar    (USER.160)
- */
-void WINAPI DrawMenuBar16( HWND16 hWnd )
-{
-    DrawMenuBar( hWnd );
-}
-
-
-/**********************************************************************
  *         DrawMenuBar    (USER32.@)
  */
 BOOL WINAPI DrawMenuBar( HWND hWnd )
@@ -4702,21 +4633,6 @@
      return TRUE;
 }
 
-/**********************************************************************
- *		GetMenuItemRect    (USER.665)
- */
-
-BOOL16 WINAPI GetMenuItemRect16 (HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
-				 LPRECT16 rect)
-{
-     RECT r32;
-     BOOL res;
-
-     if (!rect) return FALSE;
-     res = GetMenuItemRect (hwnd, hMenu, uItem, &r32);
-     CONV_RECT32TO16 (&r32, rect);
-     return res;
-}
 
 /**********************************************************************
  *		SetMenuInfo    (USER32.@)
@@ -5037,43 +4953,3 @@
     WARN_(accel)("couldn't translate accelerator key\n");
     return 0;
 }
-
-
-/**********************************************************************
- *           TranslateAccelerator      (USER.178)
- */
-INT16 WINAPI TranslateAccelerator16( HWND16 hWnd, HACCEL16 hAccel, LPMSG16 msg )
-{
-    LPACCEL16 lpAccelTbl;
-    int i;
-
-    if (msg == NULL)
-    {
-        WARN_(accel)("msg null; should hang here to be win compatible\n");
-        return 0;
-    }
-    if (!hAccel || !(lpAccelTbl = (LPACCEL16) LockResource16(hAccel)))
-    {
-        WARN_(accel)("invalid accel handle=%x\n", hAccel);
-        return 0;
-    }
-    if ((msg->message != WM_KEYDOWN &&
-         msg->message != WM_KEYUP &&
-         msg->message != WM_SYSKEYDOWN &&
-         msg->message != WM_SYSKEYUP &&
-         msg->message != WM_CHAR)) return 0;
-
-    TRACE_(accel)("TranslateAccelerators hAccel=%04x, hWnd=%04x,"
-                  "msg->hwnd=%04x, msg->message=%04x, wParam=%04x, lParam=%lx\n",
-                  hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam);
-
-    i = 0;
-    do
-    {
-        if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam,
-                                   lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd ))
-            return 1;
-    } while ((lpAccelTbl[i++].fVirt & 0x80) == 0);
-    WARN_(accel)("couldn't translate accelerator key\n");
-    return 0;
-}
diff --git a/controls/scroll.c b/controls/scroll.c
index f5a4fc0..f2b5e4d 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -883,7 +883,7 @@
     }
     SendMessageW( GetParent(hwnd),
                   (GetWindowLongA( hwnd, GWL_STYLE ) & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
-                  msg, hwnd );
+                  msg, (LPARAM)hwnd );
 }
 
 
@@ -974,7 +974,7 @@
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
             {
                 SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                                SB_LINEUP, hwndCtl );
+                                SB_LINEUP, (LPARAM)hwndCtl );
 	    }
              
 	    SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
@@ -993,7 +993,7 @@
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
             {
                 SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                                SB_PAGEUP, hwndCtl );
+                                SB_PAGEUP, (LPARAM)hwndCtl );
             }
             SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
                               SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
@@ -1042,7 +1042,7 @@
                                                          SCROLL_TrackingPos );
                 SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                                 MAKEWPARAM( SB_THUMBTRACK, SCROLL_TrackingVal),
-                                hwndCtl );
+                                (LPARAM)hwndCtl );
 		if (!SCROLL_MovingThumb)
 		    SCROLL_DrawMovingThumb( hdc, &rect, vertical,
                                         arrowSize, thumbSize );
@@ -1059,7 +1059,7 @@
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
             {
                 SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                                SB_PAGEDOWN, hwndCtl );
+                                SB_PAGEDOWN, (LPARAM)hwndCtl );
             }
             SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
                               SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
@@ -1076,7 +1076,7 @@
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
             {
                 SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                                SB_LINEDOWN, hwndCtl );
+                                SB_LINEDOWN, (LPARAM)hwndCtl );
 	    }
 
 	    SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
@@ -1097,11 +1097,11 @@
             UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
                                  trackThumbPos + lastMousePos - lastClickPos );
             SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                            MAKEWPARAM( SB_THUMBPOSITION, val ), hwndCtl );
+                            MAKEWPARAM( SB_THUMBPOSITION, val ), (LPARAM)hwndCtl );
         }
         else
             SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                            SB_ENDSCROLL, hwndCtl );
+                          SB_ENDSCROLL, (LPARAM)hwndCtl );
     }
 
     ReleaseDC( hwnd, hdc );
@@ -1302,16 +1302,6 @@
 
 
 /*************************************************************************
- *           SetScrollInfo   (USER.475)
- */
-INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info,
-                              BOOL16 bRedraw )
-{
-    return (INT16)SetScrollInfo( hwnd, nBar, info, bRedraw );
-}
-
-
-/*************************************************************************
  *           SetScrollInfo   (USER32.@)
  * SetScrollInfo can be used to set the position, upper bound, 
  * lower bound, and page size of a scrollbar control.
@@ -1487,15 +1477,6 @@
 
 
 /*************************************************************************
- *           GetScrollInfo   (USER.476)
- */
-BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
-{
-    return GetScrollInfo( hwnd, nBar, info );
-}
-
-
-/*************************************************************************
  *           GetScrollInfo   (USER32.@)
  * GetScrollInfo can be used to retrieve the position, upper bound, 
  * lower bound, and page size of a scrollbar control.
@@ -1528,16 +1509,6 @@
 
 
 /*************************************************************************
- *           SetScrollPos   (USER.62)
- */
-INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos,
-                             BOOL16 bRedraw )
-{
-    return (INT16)SetScrollPos( hwnd, nBar, nPos, bRedraw );
-}
-
-
-/*************************************************************************
  *           SetScrollPos   (USER32.@)
  *
  * RETURNS
@@ -1569,15 +1540,6 @@
 
 
 /*************************************************************************
- *           GetScrollPos   (USER.63)
- */
-INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
-{
-    return (INT16)GetScrollPos( hwnd, nBar );
-}
-
-
-/*************************************************************************
  *           GetScrollPos   (USER32.@)
  *
  * RETURNS
@@ -1600,18 +1562,6 @@
 
 
 /*************************************************************************
- *           SetScrollRange   (USER.64)
- */
-void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar,
-                              INT16 MinVal, INT16 MaxVal, BOOL16 bRedraw )
-{
-    /* Invalid range -> range is set to (0,0) */
-    if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
-    SetScrollRange( hwnd, nBar, MinVal, MaxVal, bRedraw );
-}
-
-
-/*************************************************************************
  *           SetScrollRange   (USER32.@)
  *
  * RETURNS STD
@@ -1672,20 +1622,6 @@
 
 
 /*************************************************************************
- *           GetScrollRange   (USER.65)
- */
-BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar,
-                                LPINT16 lpMin, LPINT16 lpMax)
-{
-    INT min, max;
-    BOOL16 ret = GetScrollRange( hwnd, nBar, &min, &max );
-    if (lpMin) *lpMin = min;
-    if (lpMax) *lpMax = max;
-    return ret;
-}
-
-
-/*************************************************************************
  *           GetScrollRange   (USER32.@)
  *
  * RETURNS STD
@@ -1786,16 +1722,6 @@
 
 
 /*************************************************************************
- *           ShowScrollBar   (USER.267)
- */
-void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
-{
-    SCROLL_ShowScrollBar( hwnd, nBar, (nBar == SB_VERT) ? 0 : fShow,
-				      (nBar == SB_HORZ) ? 0 : fShow );
-}
-
-
-/*************************************************************************
  *           ShowScrollBar   (USER32.@)
  *
  * RETURNS STD
@@ -1812,15 +1738,6 @@
 
 
 /*************************************************************************
- *           EnableScrollBar   (USER.482)
- */
-BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
-{
-    return EnableScrollBar( hwnd, nBar, flags );
-}
-
-
-/*************************************************************************
  *           EnableScrollBar   (USER32.@)
  */
 BOOL WINAPI EnableScrollBar( HWND hwnd, INT nBar, UINT flags )
diff --git a/dlls/user/Makefile.in b/dlls/user/Makefile.in
index 0884e3e..b92b019 100644
--- a/dlls/user/Makefile.in
+++ b/dlls/user/Makefile.in
@@ -27,6 +27,7 @@
 	text.c \
 	thunk.c \
 	user_main.c \
+	wnd16.c \
 	wsprintf.c
 
 RC_SRCS = \
diff --git a/dlls/user/controls.h b/dlls/user/controls.h
index d14fbb1..3285a89 100644
--- a/dlls/user/controls.h
+++ b/dlls/user/controls.h
@@ -99,35 +99,30 @@
 
 extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
 
-/* Dialog info structure.
- * This structure is stored into the window extra bytes (cbWndExtra).
- * sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30).
- */
-#include "pshpack1.h"
-
+/* Dialog info structure */
 typedef struct
 {
-    INT         msgResult;   /* 00 Last message result */
-    HWINDOWPROC dlgProc;     /* 04 Dialog procedure */
-    LONG        userInfo;    /* 08 User information (for DWL_USER) */
-
-    /* implementation-dependent part */
-
-    HWND16      hwndFocus;   /* 0c Current control with focus */
-    HFONT16     hUserFont;   /* 0e Dialog font */
-    HMENU16     hMenu;       /* 10 Dialog menu */
-    WORD        xBaseUnit;   /* 12 Dialog units (depends on the font) */
-    WORD        yBaseUnit;   /* 14 */
-    INT         idResult;    /* 16 EndDialog() result / default pushbutton ID */
-    UINT16      flags;       /* 1a EndDialog() called for this dialog */
-    HGLOBAL16   hDialogHeap; /* 1c */
+    HWND      hwndFocus;   /* Current control with focus */
+    HFONT     hUserFont;   /* Dialog font */
+    HMENU     hMenu;       /* Dialog menu */
+    UINT      xBaseUnit;   /* Dialog units (depends on the font) */
+    UINT      yBaseUnit;
+    INT       idResult;    /* EndDialog() result / default pushbutton ID */
+    UINT      flags;       /* EndDialog() called for this dialog */
+    HGLOBAL16 hDialogHeap;
 } DIALOGINFO;
 
-#include "poppack.h"
-
 #define DF_END  0x0001
 #define DF_OWNERENABLED 0x0002
 
+/* offset of DIALOGINFO ptr in dialog extra bytes */
+#define DWL_WINE_DIALOGINFO (DWL_USER+sizeof(ULONG_PTR))
+
+inline static DIALOGINFO *DIALOG_get_info( HWND hwnd )
+{
+    return (DIALOGINFO *)GetWindowLongW( hwnd, DWL_WINE_DIALOGINFO );
+}
+
 extern BOOL DIALOG_Init(void);
 
 #endif  /* __WINE_CONTROLS_H */
diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c
index 60f5df2..c827107 100644
--- a/dlls/user/msg16.c
+++ b/dlls/user/msg16.c
@@ -20,9 +20,10 @@
 /***********************************************************************
  *		SendMessage  (USER.111)
  */
-LRESULT WINAPI SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wparam, LPARAM lparam )
+LRESULT WINAPI SendMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM lparam )
 {
     LRESULT result;
+    HWND hwnd = WIN_Handle32( hwnd16 );
 
     if (hwnd != HWND_BROADCAST &&
         GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId())
@@ -37,12 +38,16 @@
 
             if ((cwp = SEGPTR_NEW(CWPSTRUCT16)))
             {
-                cwp->hwnd    = hwnd;
+                cwp->hwnd    = hwnd16;
                 cwp->message = msg;
                 cwp->wParam  = wparam;
                 cwp->lParam  = lparam;
                 HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 1, SEGPTR_GET(cwp) );
-                hwnd   = cwp->hwnd;
+                if (cwp->hwnd != hwnd16)
+                {
+                    hwnd16 = cwp->hwnd;
+                    hwnd = WIN_Handle32( hwnd16 );
+                }
                 msg    = cwp->message;
                 wparam = cwp->wParam;
                 lparam = cwp->lParam;
@@ -50,10 +55,10 @@
             }
         }
 
-        if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd, GWL_WNDPROC ))) return 0;
+        if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd16, GWL_WNDPROC ))) return 0;
 
         SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wparam, lparam );
-        result = CallWindowProc16( (WNDPROC16)winproc, hwnd, msg, wparam, lparam );
+        result = CallWindowProc16( (WNDPROC16)winproc, hwnd16, msg, wparam, lparam );
         SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, result, wparam, lparam );
     }
     else  /* map to 32-bit unicode for inter-thread/process message */
@@ -73,10 +78,11 @@
 /***********************************************************************
  *		PostMessage  (USER.110)
  */
-BOOL16 WINAPI PostMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wparam, LPARAM lparam )
+BOOL16 WINAPI PostMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM lparam )
 {
     WPARAM wparam32;
     UINT msg32;
+    HWND hwnd = WIN_Handle32( hwnd16 );
 
     switch (WINPROC_MapMsg16To32W( hwnd, msg, wparam, &msg32, &wparam32, &lparam ))
     {
@@ -136,15 +142,16 @@
 /***********************************************************************
  *		PeekMessage32 (USER.819)
  */
-BOOL16 WINAPI PeekMessage32_16( MSG32_16 *msg16, HWND16 hwnd,
+BOOL16 WINAPI PeekMessage32_16( MSG32_16 *msg16, HWND16 hwnd16,
                                 UINT16 first, UINT16 last, UINT16 flags,
                                 BOOL16 wHaveParamHigh )
 {
     MSG msg;
+    HWND hwnd = WIN_Handle32( hwnd16 );
 
     if (!PeekMessageW( &msg, hwnd, first, last, flags )) return FALSE;
 
-    msg16->msg.hwnd    = msg.hwnd;
+    msg16->msg.hwnd    = WIN_Handle16( msg.hwnd );
     msg16->msg.lParam  = msg.lParam;
     msg16->msg.time    = msg.time;
     msg16->msg.pt.x    = (INT16)msg.pt.x;
@@ -170,15 +177,16 @@
 /***********************************************************************
  *		GetMessage32  (USER.820)
  */
-BOOL16 WINAPI GetMessage32_16( MSG32_16 *msg16, HWND16 hwnd, UINT16 first,
+BOOL16 WINAPI GetMessage32_16( MSG32_16 *msg16, HWND16 hwnd16, UINT16 first,
                                UINT16 last, BOOL16 wHaveParamHigh )
 {
     MSG msg;
+    HWND hwnd = WIN_Handle32( hwnd16 );
 
     do
     {
         GetMessageW( &msg, hwnd, first, last );
-        msg16->msg.hwnd    = msg.hwnd;
+        msg16->msg.hwnd    = WIN_Handle16( msg.hwnd );
         msg16->msg.lParam  = msg.lParam;
         msg16->msg.time    = msg.time;
         msg16->msg.pt.x    = (INT16)msg.pt.x;
@@ -212,7 +220,7 @@
 {
     MSG msg32;
 
-    msg32.hwnd    = msg->msg.hwnd;
+    msg32.hwnd    = WIN_Handle32( msg->msg.hwnd );
     msg32.message = msg->msg.message;
     msg32.wParam  = MAKEWPARAM( msg->msg.wParam, wHaveParamHigh ? msg->wParamHigh : 0 );
     msg32.lParam  = msg->msg.lParam;
@@ -238,6 +246,7 @@
     WNDPROC16 winproc;
     LONG retval;
     int painting;
+    HWND hwnd = WIN_Handle32( msg->hwnd );
 
       /* Process timer messages */
     if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
@@ -247,7 +256,7 @@
             /* before calling window proc, verify whether timer is still valid;
                there's a slim chance that the application kills the timer
 	       between GetMessage and DispatchMessage API calls */
-            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
+            if (!TIMER_IsTimerValid(hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
                 return 0; /* invalid winproc */
 
             return CallWindowProc16( (WNDPROC16)msg->lParam, msg->hwnd,
@@ -255,7 +264,7 @@
         }
     }
 
-    if (!(wndPtr = WIN_FindWndPtr( msg->hwnd ))) return 0;
+    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
     if (!wndPtr->winproc)
     {
         WIN_ReleaseWndPtr( wndPtr );
@@ -266,23 +275,24 @@
     if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
     WIN_ReleaseWndPtr( wndPtr );
 
-    SPY_EnterMessage( SPY_DISPATCHMESSAGE16, msg->hwnd, msg->message, msg->wParam, msg->lParam );
+    SPY_EnterMessage( SPY_DISPATCHMESSAGE16, hwnd, msg->message, msg->wParam, msg->lParam );
     retval = CallWindowProc16( winproc, msg->hwnd, msg->message, msg->wParam, msg->lParam );
-    SPY_ExitMessage( SPY_RESULT_OK16, msg->hwnd, msg->message, retval, msg->wParam, msg->lParam );
+    SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg->message, retval, msg->wParam, msg->lParam );
 
     if (!painting) return retval;
 
-    if ((wndPtr = WIN_FindWndPtr( msg->hwnd )))
+    if ((wndPtr = WIN_FindWndPtr( hwnd )))
     {
         if ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate)
         {
             ERR( "BeginPaint not called on WM_PAINT for hwnd %04x!\n", msg->hwnd );
             wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
+            WIN_ReleaseWndPtr( wndPtr );
             /* Validate the update region to avoid infinite WM_PAINT loop */
-            RedrawWindow( wndPtr->hwndSelf, NULL, 0,
+            RedrawWindow( hwnd, NULL, 0,
                           RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT );
         }
-        WIN_ReleaseWndPtr( wndPtr );
+        else WIN_ReleaseWndPtr( wndPtr );
     }
     return retval;
 }
@@ -299,7 +309,7 @@
     {
         MSG msg;
 
-        msg.hwnd    = msg16->msg.hwnd;
+        msg.hwnd    = WIN_Handle32( msg16->msg.hwnd );
         msg.message = msg16->msg.message;
         msg.wParam  = MAKEWPARAM( msg16->msg.wParam, msg16->wParamHigh );
         msg.lParam  = msg16->msg.lParam;
@@ -374,3 +384,38 @@
 {
     return GetInputState();
 }
+
+
+/**********************************************************************
+ *           TranslateAccelerator      (USER.178)
+ */
+INT16 WINAPI TranslateAccelerator16( HWND16 hwnd, HACCEL16 hAccel, LPMSG16 msg )
+{
+    MSG msg32;
+
+    if (!msg) return 0;
+    msg32.message = msg->message;
+    /* msg32.hwnd not used */
+    msg32.wParam  = msg->wParam;
+    msg32.lParam  = msg->lParam;
+    return TranslateAccelerator( WIN_Handle32(hwnd), hAccel, &msg32 );
+}
+
+
+/**********************************************************************
+ *		TranslateMDISysAccel (USER.451)
+ */
+BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
+{
+    if (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
+    {
+        MSG msg32;
+        msg32.hwnd    = WIN_Handle32(msg->hwnd);
+        msg32.message = msg->message;
+        msg32.wParam  = msg->wParam;
+        msg32.lParam  = msg->lParam;
+        /* MDICLIENTINFO is still the same for win32 and win16 ... */
+        return TranslateMDISysAccel( WIN_Handle32(hwndClient), &msg32 );
+    }
+    return 0;
+}
diff --git a/dlls/user/thunk.c b/dlls/user/thunk.c
index 2131d9a..ce0c4e7 100644
--- a/dlls/user/thunk.c
+++ b/dlls/user/thunk.c
@@ -8,6 +8,7 @@
 #include "windef.h"
 #include "wingdi.h"
 #include "wine/winuser16.h"
+#include "win.h"
 #include "callback.h"
 
 /* ### start build ### */
@@ -33,7 +34,7 @@
 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
 {
     DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
-    return EnumChildWindows( parent, (WNDENUMPROC)&thunk, lParam );
+    return EnumChildWindows( WIN_Handle32(parent), (WNDENUMPROC)&thunk, lParam );
 }
 
 
diff --git a/dlls/user/user.spec b/dlls/user/user.spec
index 84c741d..a4eb68b 100644
--- a/dlls/user/user.spec
+++ b/dlls/user/user.spec
@@ -22,7 +22,7 @@
 16  pascal16 ClipCursor(ptr) ClipCursor16
 17  pascal16 GetCursorPos(ptr) GetCursorPos16
 18  pascal16 SetCapture(word) SetCapture16
-19  pascal16 ReleaseCapture() ReleaseCapture
+19  pascal16 ReleaseCapture() ReleaseCapture16
 20  pascal16 SetDoubleClickTime(word) SetDoubleClickTime16
 21  pascal16 GetDoubleClickTime() GetDoubleClickTime16
 22  pascal16 SetFocus(word) SetFocus16
diff --git a/dlls/user/wnd16.c b/dlls/user/wnd16.c
new file mode 100644
index 0000000..c4ac2fc
--- /dev/null
+++ b/dlls/user/wnd16.c
@@ -0,0 +1,1506 @@
+/*
+ * 16-bit windowing functions
+ *
+ * Copyright 2001 Alexandre Julliard
+ */
+
+#include "wine/winuser16.h"
+#include "user.h"
+#include "win.h"
+#include "stackframe.h"
+
+static HWND16 hwndSysModal;
+
+/* convert insert after window handle to 32-bit */
+inline static HWND full_insert_after_hwnd( HWND16 hwnd )
+{
+    HWND ret = WIN_Handle32( hwnd );
+    if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
+    return ret;
+}
+
+/**************************************************************************
+ *              MessageBox   (USER.1)
+ */
+INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
+{
+    return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
+}
+
+
+/**************************************************************************
+ *              KillTimer   (USER.12)
+ */
+BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
+{
+    return KillTimer( WIN_Handle32(hwnd), id );
+}
+
+
+/**************************************************************************
+ *              SetCapture   (USER.18)
+ */
+HWND16 WINAPI SetCapture16( HWND16 hwnd )
+{
+    return WIN_Handle16( SetCapture( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              ReleaseCapture   (USER.19)
+ */
+BOOL16 WINAPI ReleaseCapture16(void)
+{
+    return ReleaseCapture();
+}
+
+
+/**************************************************************************
+ *              SetFocus   (USER.22)
+ */
+HWND16 WINAPI SetFocus16( HWND16 hwnd )
+{
+    return WIN_Handle16( SetFocus( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              GetFocus   (USER.23)
+ */
+HWND16 WINAPI GetFocus16(void)
+{
+    return WIN_Handle16( GetFocus() );
+}
+
+
+/**************************************************************************
+ *              RemoveProp   (USER.24)
+ */
+HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
+{
+    return (HANDLE16)RemovePropA( WIN_Handle32(hwnd), str );
+}
+
+
+/**************************************************************************
+ *              GetProp   (USER.25)
+ */
+HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
+{
+    return (HANDLE16)GetPropA( WIN_Handle32(hwnd), str );
+}
+
+
+/**************************************************************************
+ *              SetProp   (USER.26)
+ */
+BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
+{
+    return SetPropA( WIN_Handle32(hwnd), str, handle );
+}
+
+
+/**************************************************************************
+ *              ClientToScreen   (USER.28)
+ */
+void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
+{
+    MapWindowPoints16( hwnd, 0, lppnt, 1 );
+}
+
+
+/**************************************************************************
+ *              ScreenToClient   (USER.29)
+ */
+void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
+{
+    MapWindowPoints16( 0, hwnd, lppnt, 1 );
+}
+
+
+/**************************************************************************
+ *              WindowFromPoint   (USER.30)
+ */
+HWND16 WINAPI WindowFromPoint16( POINT16 pt )
+{
+    POINT pt32;
+
+    CONV_POINT16TO32( &pt, &pt32 );
+    return WIN_Handle16( WindowFromPoint( pt32 ) );
+}
+
+
+/**************************************************************************
+ *              IsIconic   (USER.31)
+ */
+BOOL16 WINAPI IsIconic16(HWND16 hwnd)
+{
+    return IsIconic( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetWindowRect   (USER.32)
+ */
+void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
+{
+    RECT rect32;
+
+    GetWindowRect( WIN_Handle32(hwnd), &rect32 );
+    rect->left   = rect32.left;
+    rect->top    = rect32.top;
+    rect->right  = rect32.right;
+    rect->bottom = rect32.bottom;
+}
+
+
+/**************************************************************************
+ *              GetClientRect   (USER.33)
+ */
+void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
+{
+    RECT rect32;
+
+    GetClientRect( WIN_Handle32(hwnd), &rect32 );
+    rect->left   = rect32.left;
+    rect->top    = rect32.top;
+    rect->right  = rect32.right;
+    rect->bottom = rect32.bottom;
+}
+
+
+/**************************************************************************
+ *              EnableWindow   (USER.34)
+ */
+BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
+{
+    return EnableWindow( WIN_Handle32(hwnd), enable );
+}
+
+
+/**************************************************************************
+ *              IsWindowEnabled   (USER.35)
+ */
+BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
+{
+    return IsWindowEnabled( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetWindowText   (USER.36)
+ */
+INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
+{
+    return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
+}
+
+
+/**************************************************************************
+ *              SetWindowText   (USER.37)
+ */
+BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
+{
+    return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
+}
+
+
+/**************************************************************************
+ *              GetWindowTextLength   (USER.38)
+ */
+INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
+{
+    return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
+}
+
+
+/**************************************************************************
+ *              ShowWindow   (USER.42)
+ */
+BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
+{
+    return ShowWindow( WIN_Handle32(hwnd), cmd );
+}
+
+
+/**************************************************************************
+ *              CloseWindow   (USER.43)
+ */
+BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
+{
+    return CloseWindow( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              OpenIcon   (USER.44)
+ */
+BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
+{
+    return OpenIcon( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              BringWindowToTop   (USER.45)
+ */
+BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
+{
+    return BringWindowToTop( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetParent   (USER.46)
+ */
+HWND16 WINAPI GetParent16( HWND16 hwnd )
+{
+    return WIN_Handle16( GetParent( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              IsWindow   (USER.47)
+ */
+BOOL16 WINAPI IsWindow16( HWND16 hwnd )
+{
+    CURRENT_STACK16->es = USER_HeapSel;
+    /* don't use WIN_Handle32 here, we don't care about the full handle */
+    return IsWindow( (HWND)(ULONG_PTR)hwnd );
+}
+
+
+/**************************************************************************
+ *              IsChild   (USER.48)
+ */
+BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
+{
+    return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
+}
+
+
+/**************************************************************************
+ *              IsWindowVisible   (USER.49)
+ */
+BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
+{
+    return IsWindowVisible( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              FindWindow   (USER.50)
+ */
+HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
+{
+    return WIN_Handle16( FindWindowA( className, title ));
+}
+
+
+/**************************************************************************
+ *              DestroyWindow   (USER.53)
+ */
+BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
+{
+    return DestroyWindow( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              MoveWindow   (USER.56)
+ */
+BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
+{
+    return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
+}
+
+
+/**************************************************************************
+ *              GetClassName   (USER.58)
+ */
+INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
+{
+    return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
+}
+
+
+/**************************************************************************
+ *              SetActiveWindow   (USER.59)
+ */
+HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
+{
+    return WIN_Handle16( SetActiveWindow( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              GetActiveWindow   (USER.60)
+ */
+HWND16 WINAPI GetActiveWindow16(void)
+{
+    return WIN_Handle16( GetActiveWindow() );
+}
+
+
+/**************************************************************************
+ *              ScrollWindow   (USER.61)
+ */
+void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
+                            const RECT16 *clipRect )
+{
+    RECT rect32, clipRect32;
+
+    if (rect) CONV_RECT16TO32( rect, &rect32 );
+    if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
+    ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
+                  clipRect ? &clipRect32 : NULL );
+}
+
+
+/**************************************************************************
+ *              SetScrollPos   (USER.62)
+ */
+INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
+{
+    return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
+}
+
+
+/**************************************************************************
+ *              GetScrollPos   (USER.63)
+ */
+INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
+{
+    return GetScrollPos( WIN_Handle32(hwnd), nBar );
+}
+
+
+/**************************************************************************
+ *              SetScrollRange   (USER.64)
+ */
+void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
+{
+    /* Invalid range -> range is set to (0,0) */
+    if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
+    SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
+}
+
+
+/**************************************************************************
+ *              GetScrollRange   (USER.65)
+ */
+BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
+{
+    INT min, max;
+    BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
+    if (lpMin) *lpMin = min;
+    if (lpMax) *lpMax = max;
+    return ret;
+}
+
+
+/**************************************************************************
+ *              GetDC   (USER.66)
+ */
+HDC16 WINAPI GetDC16( HWND16 hwnd )
+{
+    return (HDC16)GetDC( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetWindowDC   (USER.67)
+ */
+HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
+{
+    return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
+}
+
+
+/**************************************************************************
+ *              ReleaseDC   (USER.68)
+ */
+INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
+{
+    return (INT16)ReleaseDC( WIN_Handle32(hwnd), hdc );
+}
+
+
+/**************************************************************************
+ *              EndDialog   (USER.88)
+ */
+BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
+{
+    return EndDialog( WIN_Handle32(hwnd), retval );
+}
+
+
+/**************************************************************************
+ *              GetDlgItem   (USER.91)
+ */
+HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
+{
+    return WIN_Handle16( GetDlgItem( WIN_Handle32(hwndDlg), id ));
+}
+
+
+/**************************************************************************
+ *              SetDlgItemText   (USER.92)
+ */
+void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
+{
+    SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
+}
+
+
+/**************************************************************************
+ *              GetDlgItemText   (USER.93)
+ */
+INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
+{
+    return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, (LPARAM)str );
+}
+
+
+/**************************************************************************
+ *              SetDlgItemInt   (USER.94)
+ */
+void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
+{
+    SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, value, fSigned );
+}
+
+
+/**************************************************************************
+ *              GetDlgItemInt   (USER.95)
+ */
+UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
+{
+    UINT result;
+    BOOL ok;
+
+    if (translated) *translated = FALSE;
+    result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
+    if (!ok) return 0;
+    if (fSigned)
+    {
+        if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
+    }
+    else
+    {
+        if (result > 65535) return 0;
+    }
+    if (translated) *translated = TRUE;
+    return (UINT16)result;
+}
+
+
+/**************************************************************************
+ *              CheckRadioButton   (USER.96)
+ */
+BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
+                                  UINT16 lastID, UINT16 checkID )
+{
+    return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
+}
+
+
+/**************************************************************************
+ *              CheckDlgButton   (USER.97)
+ */
+BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
+{
+    SendDlgItemMessage16( hwnd, id, BM_SETCHECK, check, 0 );
+    return TRUE;
+}
+
+
+/**************************************************************************
+ *              IsDlgButtonChecked   (USER.98)
+ */
+UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
+{
+    return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK, 0, 0 );
+}
+
+
+/**************************************************************************
+ *              DlgDirSelect   (USER.99)
+ */
+BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
+{
+    return DlgDirSelectEx16( hwnd, str, 128, id );
+}
+
+
+/**************************************************************************
+ *              DlgDirList   (USER.100)
+ */
+INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
+                           INT16 idStatic, UINT16 attrib )
+{
+    /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
+     * be set automatically (this is different in Win32, and
+     * DIALOG_DlgDirList sends Win32 messages to the control,
+     * so do it here) */
+    if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
+    return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
+}
+
+
+/**************************************************************************
+ *              SendDlgItemMessage   (USER.101)
+ */
+LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
+                                     WPARAM16 wParam, LPARAM lParam )
+{
+    HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
+    if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
+    else return 0;
+}
+
+
+/**************************************************************************
+ *              MapDialogRect   (USER.103)
+ */
+void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
+{
+    RECT rect32;
+    MapDialogRect( WIN_Handle32(hwnd), &rect32 );
+    rect->left   = rect32.left;
+    rect->right  = rect32.right;
+    rect->top    = rect32.top;
+    rect->bottom = rect32.bottom;
+}
+
+
+/**************************************************************************
+ *              FlashWindow   (USER.105)
+ */
+BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
+{
+    return FlashWindow( WIN_Handle32(hwnd), bInvert );
+}
+
+
+/**************************************************************************
+ *              WindowFromDC   (USER.117)
+ */
+HWND16 WINAPI WindowFromDC16( HDC16 hDC )
+{
+    return WIN_Handle16( WindowFromDC( hDC ) );
+}
+
+
+/**************************************************************************
+ *              UpdateWindow   (USER.124)
+ */
+void WINAPI UpdateWindow16( HWND16 hwnd )
+{
+    RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
+}
+
+
+/**************************************************************************
+ *              InvalidateRect   (USER.125)
+ */
+void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
+{
+    RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
+}
+
+
+/**************************************************************************
+ *              InvalidateRgn   (USER.126)
+ */
+void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
+{
+    RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
+}
+
+
+/**************************************************************************
+ *              ValidateRect   (USER.127)
+ */
+void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
+{
+    RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
+}
+
+
+/**************************************************************************
+ *              ValidateRgn   (USER.128)
+ */
+void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
+{
+    RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
+}
+
+
+/**************************************************************************
+ *              GetClassWord   (USER.129)
+ */
+WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
+{
+    return GetClassWord( WIN_Handle32(hwnd), offset );
+}
+
+
+/**************************************************************************
+ *              SetClassWord   (USER.130)
+ */
+WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
+{
+    return SetClassWord( WIN_Handle32(hwnd), offset, newval );
+}
+
+
+/**************************************************************************
+ *              GetWindowWord   (USER.133)
+ */
+WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
+{
+    return GetWindowWord( WIN_Handle32(hwnd), offset );
+}
+
+
+/**************************************************************************
+ *              SetWindowWord   (USER.134)
+ */
+WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
+{
+    return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
+}
+
+
+/**************************************************************************
+ *              OpenClipboard   (USER.137)
+ */
+BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
+{
+    return OpenClipboard( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetClipboardOwner   (USER.140)
+ */
+HWND16 WINAPI GetClipboardOwner16(void)
+{
+    return WIN_Handle16( GetClipboardOwner() );
+}
+
+
+/**************************************************************************
+ *              SetClipboardViewer   (USER.147)
+ */
+HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
+{
+    return WIN_Handle16( SetClipboardViewer( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              GetClipboardViewer   (USER.148)
+ */
+HWND16 WINAPI GetClipboardViewer16(void)
+{
+    return WIN_Handle16( GetClipboardViewer() );
+}
+
+
+/**************************************************************************
+ *              ChangeClipboardChain   (USER.149)
+ */
+BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
+{
+    return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
+}
+
+
+/**************************************************************************
+ *              GetSystemMenu   (USER.156)
+ */
+HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
+{
+    return GetSystemMenu( WIN_Handle32(hwnd), revert );
+}
+
+
+/**************************************************************************
+ *              GetMenu   (USER.157)
+ */
+HMENU16 WINAPI GetMenu16( HWND16 hwnd )
+{
+    return GetMenu( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              SetMenu   (USER.158)
+ */
+BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
+{
+    return SetMenu( WIN_Handle32(hwnd), hMenu );
+}
+
+
+/**************************************************************************
+ *              DrawMenuBar   (USER.160)
+ */
+void WINAPI DrawMenuBar16( HWND16 hwnd )
+{
+    DrawMenuBar( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              HiliteMenuItem   (USER.162)
+ */
+BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
+{
+    return HiliteMenuItem( WIN_Handle32(hwnd), hMenu, id, wHilite );
+}
+
+
+/**************************************************************************
+ *              CreateCaret   (USER.163)
+ */
+void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
+{
+    CreateCaret( WIN_Handle32(hwnd), bitmap, width, height );
+}
+
+
+/**************************************************************************
+ *              HideCaret   (USER.166)
+ */
+void WINAPI HideCaret16( HWND16 hwnd )
+{
+    HideCaret( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              ShowCaret   (USER.167)
+ */
+void WINAPI ShowCaret16( HWND16 hwnd )
+{
+    ShowCaret( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              ArrangeIconicWindows   (USER.170)
+ */
+UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
+{
+    return ArrangeIconicWindows( WIN_Handle32(parent) );
+}
+
+
+/**************************************************************************
+ *              SwitchToThisWindow   (USER.172)
+ */
+void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
+{
+    SwitchToThisWindow( WIN_Handle32(hwnd), restore );
+}
+
+
+/**************************************************************************
+ *              KillSystemTimer   (USER.182)
+ */
+BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
+{
+    return KillSystemTimer( WIN_Handle32(hwnd), id );
+}
+
+
+/**************************************************************************
+ *              SetSysModalWindow   (USER.188)
+ */
+HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
+{
+    HWND16 old = hwndSysModal;
+    hwndSysModal = hwnd;
+    return old;
+}
+
+
+/**************************************************************************
+ *              GetSysModalWindow   (USER.189)
+ */
+HWND16 WINAPI GetSysModalWindow16(void)
+{
+    return hwndSysModal;
+}
+
+
+/**************************************************************************
+ *              GetUpdateRect   (USER.190)
+ */
+BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
+{
+    RECT r;
+    BOOL16 ret;
+
+    if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
+    ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
+    CONV_RECT32TO16( &r, rect );
+    return ret;
+}
+
+
+/**************************************************************************
+ *              ChildWindowFromPoint   (USER.191)
+ */
+HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
+{
+    POINT pt32;
+    CONV_POINT16TO32( &pt, &pt32 );
+    return WIN_Handle16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
+}
+
+
+/**************************************************************************
+ *              DlgDirSelectComboBox   (USER.194)
+ */
+BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
+{
+    return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
+}
+
+
+/**************************************************************************
+ *              DlgDirListComboBox   (USER.195)
+ */
+INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
+                                   INT16 idStatic, UINT16 attrib )
+{
+    return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
+}
+
+
+/**************************************************************************
+ *              GetNextDlgGroupItem   (USER.227)
+ */
+HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
+                                     BOOL16 fPrevious )
+{
+    return WIN_Handle16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg),
+                                              WIN_Handle32(hwndCtrl), fPrevious ));
+}
+
+
+/**************************************************************************
+ *              GetNextDlgTabItem   (USER.228)
+ */
+HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
+                                   BOOL16 fPrevious )
+{
+    return WIN_Handle16( GetNextDlgTabItem( WIN_Handle32(hwndDlg),
+                                            WIN_Handle32(hwndCtrl), fPrevious ));
+}
+
+
+/**************************************************************************
+ *              GetTopWindow   (USER.229)
+ */
+HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
+{
+    return WIN_Handle16( GetTopWindow( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              GetNextWindow   (USER.230)
+ */
+HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
+{
+    if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
+    return GetWindow16( hwnd, flag );
+}
+
+
+/**************************************************************************
+ *              SetWindowPos   (USER.232)
+ */
+BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
+                              INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
+{
+    return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
+                         x, y, cx, cy, flags );
+}
+
+
+/**************************************************************************
+ *              SetParent   (USER.233)
+ */
+HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
+{
+    return WIN_Handle16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
+}
+
+
+/**************************************************************************
+ *              GetCapture   (USER.236)
+ */
+HWND16 WINAPI GetCapture16(void)
+{
+    return WIN_Handle16( GetCapture() );
+}
+
+
+/**************************************************************************
+ *              GetUpdateRgn   (USER.237)
+ */
+INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
+{
+    return GetUpdateRgn( WIN_Handle32(hwnd), hrgn, erase );
+}
+
+
+/**************************************************************************
+ *              ExcludeUpdateRgn   (USER.238)
+ */
+INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
+{
+    return ExcludeUpdateRgn( hdc, WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetOpenClipboardWindow   (USER.248)
+ */
+HWND16 WINAPI GetOpenClipboardWindow16(void)
+{
+    return WIN_Handle16( GetOpenClipboardWindow() );
+}
+
+
+/**************************************************************************
+ *              BeginDeferWindowPos   (USER.259)
+ */
+HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
+{
+    return BeginDeferWindowPos( count );
+}
+
+
+/**************************************************************************
+ *              DeferWindowPos   (USER.260)
+ */
+HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
+                                INT16 x, INT16 y, INT16 cx, INT16 cy,
+                                UINT16 flags )
+{
+    return DeferWindowPos( hdwp, WIN_Handle32(hwnd), full_insert_after_hwnd(hwndAfter),
+                           x, y, cx, cy, flags );
+}
+
+
+/**************************************************************************
+ *              EndDeferWindowPos   (USER.261)
+ */
+BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
+{
+    return EndDeferWindowPos( hdwp );
+}
+
+
+/**************************************************************************
+ *              GetWindow   (USER.262)
+ */
+HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
+{
+    return WIN_Handle16( GetWindow( WIN_Handle32(hwnd), rel ) );
+}
+
+
+/**************************************************************************
+ *              ShowOwnedPopups   (USER.265)
+ */
+void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
+{
+    ShowOwnedPopups( WIN_Handle32(owner), fShow );
+}
+
+
+/**************************************************************************
+ *              ShowScrollBar   (USER.267)
+ */
+void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
+{
+    ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
+}
+
+
+/**************************************************************************
+ *              IsZoomed   (USER.272)
+ */
+BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
+{
+    return IsZoomed( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetDlgCtrlID   (USER.277)
+ */
+INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
+{
+    return GetDlgCtrlID( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              GetDesktopHwnd   (USER.278)
+ *
+ * Exactly the same thing as GetDesktopWindow(), but not documented.
+ * Don't ask me why...
+ */
+HWND16 WINAPI GetDesktopHwnd16(void)
+{
+    return GetDesktopWindow16();
+}
+
+
+/**************************************************************************
+ *              SetSystemMenu   (USER.280)
+ */
+BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
+{
+    return SetSystemMenu( WIN_Handle32(hwnd), hMenu );
+}
+
+
+/**************************************************************************
+ *              GetDesktopWindow   (USER.286)
+ */
+HWND16 WINAPI GetDesktopWindow16(void)
+{
+    return WIN_Handle16( GetDesktopWindow() );
+}
+
+
+/**************************************************************************
+ *              GetLastActivePopup   (USER.287)
+ */
+HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
+{
+    return WIN_Handle16( GetLastActivePopup( WIN_Handle32(hwnd) ));
+}
+
+
+/**************************************************************************
+ *              RedrawWindow   (USER.290)
+ */
+BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
+                              HRGN16 hrgnUpdate, UINT16 flags )
+{
+    if (rectUpdate)
+    {
+        RECT r;
+        CONV_RECT16TO32( rectUpdate, &r );
+        return RedrawWindow( WIN_Handle32(hwnd), &r, hrgnUpdate, flags );
+    }
+    return RedrawWindow( WIN_Handle32(hwnd), NULL, hrgnUpdate, flags );
+}
+
+
+/**************************************************************************
+ *              LockWindowUpdate   (USER.294)
+ */
+BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
+{
+    return LockWindowUpdate( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              ScrollWindowEx   (USER.319)
+ */
+INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
+                               const RECT16 *rect, const RECT16 *clipRect,
+                               HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
+                               UINT16 flags )
+{
+    RECT rect32, clipRect32, rcUpdate32;
+    BOOL16 ret;
+
+    if (rect) CONV_RECT16TO32( rect, &rect32 );
+    if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
+    ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
+                          clipRect ? &clipRect32 : NULL, hrgnUpdate,
+                          (rcUpdate) ? &rcUpdate32 : NULL, flags );
+    if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate );
+    return ret;
+}
+
+
+/**************************************************************************
+ *              FillWindow   (USER.324)
+ */
+void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
+{
+    RECT rect;
+    RECT16 rc16;
+    GetClientRect( WIN_Handle32(hwnd), &rect );
+    DPtoLP( hdc, (LPPOINT)&rect, 2 );
+    CONV_RECT32TO16( &rect, &rc16 );
+    PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
+}
+
+
+/**************************************************************************
+ *              PaintRect   (USER.325)
+ */
+void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
+                         HBRUSH16 hbrush, const RECT16 *rect)
+{
+    if (hbrush <= CTLCOLOR_STATIC)
+    {
+        HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
+
+        if (!parent) return;
+        hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
+        if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
+                                              (WPARAM)hdc, (LPARAM)hwnd32 );
+    }
+    if (hbrush) FillRect16( hdc, rect, hbrush );
+}
+
+
+/**************************************************************************
+ *              GetControlBrush   (USER.326)
+ */
+HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
+{
+    HBRUSH16 ret;
+    HWND hwnd32 = WIN_Handle32(hwnd);
+    HWND parent = GetParent( hwnd32 );
+
+    if (!parent) parent = hwnd32;
+    ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
+    if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
+                                    (WPARAM)hdc, (LPARAM)hwnd32 );
+    return ret;
+}
+
+
+/**************************************************************************
+ *              GetDCEx   (USER.359)
+ */
+HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
+{
+    return (HDC16)GetDCEx( WIN_Handle32(hwnd), hrgnClip, flags );
+}
+
+
+/**************************************************************************
+ *              GetWindowPlacement   (USER.370)
+ */
+BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
+{
+    WINDOWPLACEMENT wpl;
+
+    wpl.length = sizeof(wpl);
+    if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
+    wp16->length  = sizeof(*wp16);
+    wp16->flags   = wpl.flags;
+    wp16->showCmd = wpl.showCmd;
+    CONV_POINT32TO16( &wpl.ptMinPosition, &wp16->ptMinPosition );
+    CONV_POINT32TO16( &wpl.ptMaxPosition, &wp16->ptMaxPosition );
+    CONV_RECT32TO16( &wpl.rcNormalPosition, &wp16->rcNormalPosition );
+    return TRUE;
+}
+
+
+/**************************************************************************
+ *              SetWindowPlacement   (USER.371)
+ */
+BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
+{
+    WINDOWPLACEMENT wpl;
+
+    if (!wp16) return FALSE;
+    wpl.length  = sizeof(wpl);
+    wpl.flags   = wp16->flags;
+    wpl.showCmd = wp16->showCmd;
+    wpl.ptMinPosition.x = wp16->ptMinPosition.x;
+    wpl.ptMinPosition.y = wp16->ptMinPosition.y;
+    wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
+    wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
+    wpl.rcNormalPosition.left   = wp16->rcNormalPosition.left;
+    wpl.rcNormalPosition.top    = wp16->rcNormalPosition.top;
+    wpl.rcNormalPosition.right  = wp16->rcNormalPosition.right;
+    wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
+    return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
+}
+
+
+/**************************************************************************
+ *              ChildWindowFromPointEx   (USER.399)
+ */
+HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
+{
+    POINT pt32;
+    CONV_POINT16TO32( &pt, &pt32 );
+    return WIN_Handle16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
+}
+
+
+/**************************************************************************
+ *              GetPriorityClipboardFormat   (USER.402)
+ */
+INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
+{
+    int i;
+
+    for (i = 0; i < count; i++)
+        if (IsClipboardFormatAvailable( list[i] )) return list[i];
+    return -1;
+}
+
+
+/**************************************************************************
+ *              TrackPopupMenu   (USER.416)
+ */
+BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
+                                INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
+{
+    RECT r;
+    if (lpRect) CONV_RECT16TO32( lpRect, &r );
+    return TrackPopupMenu( hMenu, wFlags, x, y, nReserved,
+                           WIN_Handle32(hwnd), lpRect ? &r : NULL );
+}
+
+
+/**************************************************************************
+ *              DlgDirSelectEx   (USER.422)
+ */
+BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
+{
+    return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
+}
+
+
+/**************************************************************************
+ *              DlgDirSelectComboBoxEx   (USER.423)
+ */
+BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
+                                        INT16 id )
+{
+    return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
+}
+
+
+/**************************************************************************
+ *              FindWindowEx   (USER.427)
+ */
+HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
+{
+    return WIN_Handle16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
+                                        className, title ));
+}
+
+
+/**************************************************************************
+ *              DrawAnimatedRects   (USER.448)
+ */
+BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
+                                   const RECT16* lprcFrom, const RECT16* lprcTo )
+{
+    RECT rcFrom32, rcTo32;
+    rcFrom32.left   = lprcFrom->left;
+    rcFrom32.top    = lprcFrom->top;
+    rcFrom32.right  = lprcFrom->right;
+    rcFrom32.bottom = lprcFrom->bottom;
+    rcTo32.left     = lprcTo->left;
+    rcTo32.top      = lprcTo->top;
+    rcTo32.right    = lprcTo->right;
+    rcTo32.bottom   = lprcTo->bottom;
+    return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
+}
+
+
+/**************************************************************************
+ *              SetInternalWindowPos   (USER.461)
+ */
+void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
+{
+    RECT rc32;
+    POINT pt32;
+
+    if (rect)
+    {
+        rc32.left   = rect->left;
+        rc32.top    = rect->top;
+        rc32.right  = rect->right;
+        rc32.bottom = rect->bottom;
+    }
+    if (pt)
+    {
+        pt32.x = pt->x;
+        pt32.y = pt->y;
+    }
+    SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
+                          rect ? &rc32 : NULL, pt ? &pt32 : NULL );
+}
+
+
+/**************************************************************************
+ *              CalcChildScroll   (USER.462)
+ */
+void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
+{
+    return CalcChildScroll( WIN_Handle32(hwnd), scroll );
+}
+
+
+/**************************************************************************
+ *              ScrollChildren   (USER.463)
+ */
+void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
+{
+    ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
+}
+
+
+/**************************************************************************
+ *              DragDetect   (USER.465)
+ */
+BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
+{
+    POINT pt32;
+    CONV_POINT16TO32( &pt, &pt32 );
+    return DragDetect( WIN_Handle32(hwnd), pt32 );
+}
+
+
+/**************************************************************************
+ *              SetScrollInfo   (USER.475)
+ */
+INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
+{
+    return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
+}
+
+
+/**************************************************************************
+ *              GetScrollInfo   (USER.476)
+ */
+BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
+{
+    return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
+}
+
+
+/**************************************************************************
+ *              EnableScrollBar   (USER.482)
+ */
+BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
+{
+    return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
+}
+
+
+/**************************************************************************
+ *              GetShellWindow   (USER.600)
+ */
+HWND16 WINAPI GetShellWindow16(void)
+{
+    return WIN_Handle16( GetShellWindow() );
+}
+
+
+/**************************************************************************
+ *              GetForegroundWindow   (USER.608)
+ */
+HWND16 WINAPI GetForegroundWindow16(void)
+{
+    return WIN_Handle16( GetForegroundWindow() );
+}
+
+
+/**************************************************************************
+ *              SetForegroundWindow   (USER.609)
+ */
+BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
+{
+    return SetForegroundWindow( WIN_Handle32(hwnd) );
+}
+
+
+/**************************************************************************
+ *              DrawCaptionTemp   (USER.657)
+ */
+BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
+                                 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
+{
+    RECT rect32;
+
+    if (rect) CONV_RECT16TO32(rect,&rect32);
+
+    return DrawCaptionTempA( WIN_Handle32(hwnd), hdc, rect ? &rect32 : NULL,
+                             hFont, hIcon, str, uFlags & 0x1f );
+}
+
+
+/**************************************************************************
+ *              DrawCaption   (USER.660)
+ */
+BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
+{
+    RECT rect32;
+
+    if (rect) CONV_RECT16TO32( rect, &rect32 );
+
+    return DrawCaption( WIN_Handle32(hwnd), hdc, rect ? &rect32 : NULL, flags );
+}
+
+
+/**************************************************************************
+ *              GetMenuItemRect   (USER.665)
+ */
+BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
+                                 LPRECT16 rect)
+{
+     RECT r32;
+     BOOL res;
+     if (!rect) return FALSE;
+     res = GetMenuItemRect( WIN_Handle32(hwnd), hMenu, uItem, &r32 );
+     CONV_RECT32TO16( &r32, rect );
+     return res;
+}
+
+
+/**************************************************************************
+ *              SetWindowRgn   (USER.668)
+ */
+INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
+{
+    return SetWindowRgn( WIN_Handle32(hwnd), hrgn, redraw );
+}
+
+
+/**************************************************************************
+ *              MessageBoxIndirect   (USER.827)
+ */
+INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
+{
+    MSGBOXPARAMSA msgbox32;
+
+    msgbox32.cbSize             = msgbox->cbSize;
+    msgbox32.hwndOwner          = WIN_Handle32( msgbox->hwndOwner );
+    msgbox32.hInstance          = msgbox->hInstance;
+    msgbox32.lpszText           = MapSL(msgbox->lpszText);
+    msgbox32.lpszCaption        = MapSL(msgbox->lpszCaption);
+    msgbox32.dwStyle            = msgbox->dwStyle;
+    msgbox32.lpszIcon           = MapSL(msgbox->lpszIcon);
+    msgbox32.dwContextHelpId    = msgbox->dwContextHelpId;
+    msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
+    msgbox32.dwLanguageId       = msgbox->dwLanguageId;
+    return MessageBoxIndirectA( &msgbox32 );
+}
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index c858ea6..093cac6 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -651,6 +651,10 @@
 
     /* Check hwndInsertAfter */
 
+    /* fix sign extension */
+    if (winpos->hwndInsertAfter == (HWND)0xffff) winpos->hwndInsertAfter = HWND_TOPMOST;
+    else if (winpos->hwndInsertAfter == (HWND)0xfffe) winpos->hwndInsertAfter = HWND_NOTOPMOST;
+
       /* FIXME: TOPMOST not supported yet */
     if ((winpos->hwndInsertAfter == HWND_TOPMOST) ||
         (winpos->hwndInsertAfter == HWND_NOTOPMOST)) winpos->hwndInsertAfter = HWND_TOP;
@@ -928,7 +932,7 @@
     size.x = wndPtr->rectWindow.left;
     size.y = wndPtr->rectWindow.top;
 
-    if (!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd))
+    if (!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, (WPARAM)wndPtr->hwndSelf, cmd))
     {
         if( wndPtr->dwStyle & WS_MINIMIZE )
         {
@@ -1649,7 +1653,7 @@
         *capturePoint = pt;
     }
     SetCursorPos( pt.x, pt.y );
-    NC_HandleSetCursor( hwnd, hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
+    NC_HandleSetCursor( hwnd, (WPARAM)hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
     return hittest;
 }
 
@@ -1901,7 +1905,7 @@
     }
     wine_tsx11_unlock();
 
-    if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, hwnd, (LPARAM)&sizingRect )) moved = FALSE;
+    if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, (WPARAM)hwnd, (LPARAM)&sizingRect )) moved = FALSE;
 
     SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
     SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
diff --git a/include/win.h b/include/win.h
index cf56178..8cc7bdb 100644
--- a/include/win.h
+++ b/include/win.h
@@ -62,7 +62,7 @@
     RECT16	   rectNormal;
     POINT16	   ptIconPos;
     POINT16	   ptMaxPos;
-    HWND16	   hwndIconTitle;
+    HWND           hwndIconTitle;
 } INTERNALPOS, *LPINTERNALPOS;
 
   /* WND flags values */
@@ -107,6 +107,12 @@
     return LOWORD(hwnd);
 }
 
+inline static WND *WIN_FindWndPtr16( HWND16 hwnd )
+{
+    /* don't bother with full conversion */
+    return WIN_FindWndPtr( (HWND)(ULONG_PTR)hwnd );
+}
+
 extern HWND CARET_GetHwnd(void);
 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
 
diff --git a/include/winproc.h b/include/winproc.h
index 97a79d5..1f68d92 100644
--- a/include/winproc.h
+++ b/include/winproc.h
@@ -52,10 +52,10 @@
                                      LPARAM *plparam );
 extern INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam,
                                      LPARAM *plparam );
-extern INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16,
+extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
                                     UINT *pmsg32, WPARAM *pwparam32,
                                     LPARAM *plparam );
-extern INT WINPROC_MapMsg16To32W( HWND16, UINT16 msg16, WPARAM16 wParam16,
+extern INT WINPROC_MapMsg16To32W( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
                                     UINT *pmsg32, WPARAM *pwparam32,
                                     LPARAM *plparam );
 extern INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32,
@@ -68,9 +68,9 @@
                                          LPARAM lParam, LRESULT result );
 extern void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam,
                                       LPARAM lParam );
-extern LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam,
+extern LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam,
                                         LPARAM lParam, LRESULT result );
-extern LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam,
+extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam,
                                         LPARAM lParam, LRESULT result );
 extern void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam,
                                      LPARAM lParam, MSGPARAM16* pm16 );
diff --git a/include/winuser.h b/include/winuser.h
index 16beba9..d96b26e 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -1070,12 +1070,9 @@
 #define GWL_USERDATA        (-21)
 #define GWL_EXSTYLE         (-20)
 #define GWL_STYLE           (-16)
-#define GWW_ID              (-12)
-#define GWL_ID              GWW_ID
-#define GWW_HWNDPARENT      (-8)
-#define GWL_HWNDPARENT      GWW_HWNDPARENT
-#define GWW_HINSTANCE       (-6)
-#define GWL_HINSTANCE       GWW_HINSTANCE
+#define GWL_ID              (-12)
+#define GWL_HWNDPARENT      (-8)
+#define GWL_HINSTANCE       (-6)
 #define GWL_WNDPROC         (-4)
 #define DWL_MSGRESULT	    0
 #define DWL_DLGPROC	    4
diff --git a/windows/caret.c b/windows/caret.c
index c20d17e..cdefeea 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -129,15 +129,6 @@
 
 
 /*****************************************************************
- *		CreateCaret (USER.163)
- */
-void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap,
-                           INT16 width, INT16 height )
-{
-    CreateCaret( hwnd, bitmap, width, height );
-}
-
-/*****************************************************************
  *		CreateCaret (USER32.@)
  */
 BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap,
@@ -239,15 +230,6 @@
 
 
 /*****************************************************************
- *		HideCaret (USER.166)
- */
-void WINAPI HideCaret16( HWND16 hwnd )
-{
-    HideCaret( hwnd );
-}
-
-
-/*****************************************************************
  *		HideCaret (USER32.@)
  */
 BOOL WINAPI HideCaret( HWND hwnd )
@@ -266,15 +248,6 @@
 
 
 /*****************************************************************
- *		ShowCaret (USER.167)
- */
-void WINAPI ShowCaret16( HWND16 hwnd )
-{
-    ShowCaret( hwnd );
-}
-
-
-/*****************************************************************
  *		ShowCaret (USER32.@)
  */
 BOOL WINAPI ShowCaret( HWND hwnd )
diff --git a/windows/class.c b/windows/class.c
index 83998bc..3c32cd8 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -697,14 +697,6 @@
     return CLASS_FreeClass( classPtr );
 }
 
-/***********************************************************************
- *		GetClassWord (USER.129)
- */
-WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
-{
-    return GetClassWord( hwnd, offset );
-}
-
 
 /***********************************************************************
  *		GetClassWord (USER32.@)
@@ -762,15 +754,15 @@
     switch( offset )
     {
     case GCL_WNDPROC:
-        if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
+        if (!(wndPtr = WIN_FindWndPtr16( hwnd ))) return 0;
         ret = (LONG)CLASS_GetProc( wndPtr->class, WIN_PROC_16 );
         WIN_ReleaseWndPtr(wndPtr);
         return ret;
     case GCL_MENUNAME:
-        ret = GetClassLongA( hwnd, offset );
+        ret = GetClassLongA( WIN_Handle32(hwnd), offset );
         return (LONG)SEGPTR_GET( (void *)ret );
     default:
-        return GetClassLongA( hwnd, offset );
+        return GetClassLongA( WIN_Handle32(hwnd), offset );
     }
 }
 
@@ -868,15 +860,6 @@
 
 
 /***********************************************************************
- *		SetClassWord (USER.130)
- */
-WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
-{
-    return SetClassWord( hwnd, offset, newval );
-}
-
-
-/***********************************************************************
  *		SetClassWord (USER32.@)
  */
 WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
@@ -939,14 +922,15 @@
     switch(offset)
     {
     case GCL_WNDPROC:
-        if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
+        if (!(wndPtr = WIN_FindWndPtr16(hwnd))) return 0;
         retval = (LONG)CLASS_SetProc( wndPtr->class, (WNDPROC)newval, WIN_PROC_16 );
         WIN_ReleaseWndPtr(wndPtr);
         return retval;
     case GCL_MENUNAME:
-        return SetClassLongA( hwnd, offset, (LONG)MapSL(newval) );
+        newval = (LONG)MapSL( newval );
+        /* fall through */
     default:
-        return SetClassLongA( hwnd, offset, newval );
+        return SetClassLongA( WIN_Handle32(hwnd), offset, newval );
     }
 }
 
@@ -1052,15 +1036,6 @@
 
 
 /***********************************************************************
- *		GetClassName (USER.58)
- */
-INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
-{
-    return GetClassNameA( hwnd, buffer, count );
-}
-
-
-/***********************************************************************
  *		GetClassNameA (USER32.@)
  */
 INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
diff --git a/windows/clipboard.c b/windows/clipboard.c
index cc321e1..fc969cd 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -711,15 +711,6 @@
  **************************************************************************/
 
 /**************************************************************************
- *		OpenClipboard (USER.137)
- */
-BOOL16 WINAPI OpenClipboard16( HWND16 hWnd )
-{
-    return OpenClipboard( hWnd );
-}
-
-
-/**************************************************************************
  *		OpenClipboard (USER32.@)
  *
  * Note: Netscape uses NULL hWnd to open the clipboard.
@@ -817,17 +808,6 @@
 
 
 /**************************************************************************
- *		GetClipboardOwner (USER.140)
- *  FIXME: Can't return the owner if the clipbard is owned by an external app
- */
-HWND16 WINAPI GetClipboardOwner16(void)
-{
-    TRACE("()\n");
-    return hWndClipOwner;
-}
-
-
-/**************************************************************************
  *		GetClipboardOwner (USER32.@)
  *  FIXME: Can't return the owner if the clipbard is owned by an external app
  */
@@ -1300,16 +1280,6 @@
 
 
 /**************************************************************************
- *		SetClipboardViewer (USER.147)
- */
-HWND16 WINAPI SetClipboardViewer16( HWND16 hWnd )
-{
-    TRACE("(%04x)\n", hWnd);
-    return SetClipboardViewer( hWnd );
-}
-
-
-/**************************************************************************
  *		SetClipboardViewer (USER32.@)
  */
 HWND WINAPI SetClipboardViewer( HWND hWnd )
@@ -1324,16 +1294,6 @@
 
 
 /**************************************************************************
- *		GetClipboardViewer (USER.148)
- */
-HWND16 WINAPI GetClipboardViewer16(void)
-{
-    TRACE("()\n");
-    return hWndViewer;
-}
-
-
-/**************************************************************************
  *		GetClipboardViewer (USER32.@)
  */
 HWND WINAPI GetClipboardViewer(void)
@@ -1344,15 +1304,6 @@
 
 
 /**************************************************************************
- *		ChangeClipboardChain (USER.149)
- */
-BOOL16 WINAPI ChangeClipboardChain16(HWND16 hWnd, HWND16 hWndNext)
-{
-    return ChangeClipboardChain(hWnd, hWndNext);
-}
-
-
-/**************************************************************************
  *		ChangeClipboardChain (USER32.@)
  */
 BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
@@ -1404,17 +1355,6 @@
 
 
 /**************************************************************************
- *		GetOpenClipboardWindow (USER.248)
- *  FIXME: This wont work if an external app owns the selection
- */
-HWND16 WINAPI GetOpenClipboardWindow16(void)
-{
-    TRACE("()\n");
-    return hWndClipWindow;
-}
-
-
-/**************************************************************************
  *		GetOpenClipboardWindow (USER32.@)
  *  FIXME: This wont work if an external app owns the selection
  */
@@ -1426,34 +1366,17 @@
 
 
 /**************************************************************************
- *		GetPriorityClipboardFormat (USER.402)
- */
-INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *lpPriorityList, INT16 nCount)
-{
-    FIXME("(%p,%d): stub\n", lpPriorityList, nCount );
-    return 0;
-}
-
-
-/**************************************************************************
  *		GetPriorityClipboardFormat (USER32.@)
  */
-INT WINAPI GetPriorityClipboardFormat( UINT *lpPriorityList, INT nCount )
+INT WINAPI GetPriorityClipboardFormat( UINT *list, INT nCount )
 {
-    int Counter;
+    int i;
     TRACE("()\n");
 
-    if(CountClipboardFormats() == 0) 
-    { 
-        return 0;
-    }
+    if(CountClipboardFormats() == 0) return 0;
 
-    for(Counter = 0; Counter <= nCount; Counter++)
-    {
-        if(IsClipboardFormatAvailable(*(lpPriorityList+sizeof(INT)*Counter)))
-            return *(lpPriorityList+sizeof(INT)*Counter);
-    }
-
+    for (i = 0; i < nCount; i++)
+        if (IsClipboardFormatAvailable( list[i] )) return list[i];
     return -1;
 }
 
diff --git a/windows/dce.c b/windows/dce.c
index 2065cb3..4e718e4 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -368,15 +368,6 @@
 
 
 /***********************************************************************
- *		GetDCEx (USER.359)
- */
-HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
-{
-    return (HDC16)GetDCEx( hwnd, hrgnClip, flags );
-}
-
-
-/***********************************************************************
  *		GetDCEx (USER32.@)
  *
  * Unimplemented flags: DCX_LOCKWINDOWUPDATE
@@ -532,15 +523,6 @@
 
 
 /***********************************************************************
- *		GetDC (USER.66)
- */
-HDC16 WINAPI GetDC16( HWND16 hwnd )
-{
-    return (HDC16)GetDC( hwnd );
-}
-
-
-/***********************************************************************
  *		GetDC (USER32.@)
  * RETURNS
  *	:Handle to DC
@@ -556,15 +538,6 @@
 
 
 /***********************************************************************
- *		GetWindowDC (USER.67)
- */
-HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
-{
-    return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
-}
-
-
-/***********************************************************************
  *		GetWindowDC (USER32.@)
  */
 HDC WINAPI GetWindowDC( HWND hwnd )
@@ -574,15 +547,6 @@
 
 
 /***********************************************************************
- *		ReleaseDC (USER.68)
- */
-INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
-{
-    return (INT16)ReleaseDC( hwnd, hdc );
-}
-
-
-/***********************************************************************
  *		ReleaseDC (USER32.@)
  *
  * RETURNS
@@ -671,15 +635,6 @@
 
 
 /**********************************************************************
- *		WindowFromDC (USER.117)
- */
-HWND16 WINAPI WindowFromDC16( HDC16 hDC )
-{
-    return (HWND16)WindowFromDC( hDC );
-}
-
-
-/**********************************************************************
  *		WindowFromDC (USER32.@)
  */
 HWND WINAPI WindowFromDC( HDC hDC )
@@ -700,14 +655,6 @@
 
 
 /***********************************************************************
- *		LockWindowUpdate (USER.294)
- */
-BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
-{
-    return LockWindowUpdate( hwnd );
-}
-
-/***********************************************************************
  *		LockWindowUpdate (USER32.@)
  */
 BOOL WINAPI LockWindowUpdate( HWND hwnd )
diff --git a/windows/defdlg.c b/windows/defdlg.c
index fccd140..3cc9b71 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -15,6 +15,21 @@
 
 
 /***********************************************************************
+ *           DEFDLG_GetDlgProc
+ */
+static WNDPROC DEFDLG_GetDlgProc( HWND hwnd )
+{
+    WNDPROC ret = 0;
+    WND * wndPtr = WIN_FindWndPtr( hwnd );
+    if (wndPtr)
+    {
+        ret = *(WNDPROC *)((char *)wndPtr->wExtra + DWL_DLGPROC);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
+    return ret;
+}
+
+/***********************************************************************
  *           DEFDLG_SetFocus
  *
  * Set the focus to a control of the dialog, selecting the text if
@@ -41,14 +56,11 @@
 static void DEFDLG_SaveFocus( HWND hwnd )
 {
     DIALOGINFO *infoPtr;
-    WND *wndPtr;
     HWND hwndFocus = GetFocus();
 
     if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
-    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return;
-    infoPtr = (DIALOGINFO *)&wndPtr->wExtra;
+    if (!(infoPtr = DIALOG_get_info( hwnd ))) return;
     infoPtr->hwndFocus = hwndFocus;
-    WIN_ReleaseWndPtr( wndPtr );
     /* Remove default button */
 }
 
@@ -59,24 +71,18 @@
 static void DEFDLG_RestoreFocus( HWND hwnd )
 {
     DIALOGINFO *infoPtr;
-    WND *wndPtr;
 
     if (IsIconic( hwnd )) return;
-    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return;
-    infoPtr = (DIALOGINFO *)&wndPtr->wExtra;
-    if (IsWindow( infoPtr->hwndFocus ))
+    if (!(infoPtr = DIALOG_get_info( hwnd ))) return;
+    if (!IsWindow( infoPtr->hwndFocus )) return;
+    /* Don't set the focus back to controls if EndDialog is already called.*/
+    if (!(infoPtr->flags & DF_END))
     {
-        /* Don't set the focus back to controls if EndDialog is already called.*/
-        if (!(infoPtr->flags & DF_END))
-        {
-            WIN_ReleaseWndPtr( wndPtr );
-            DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
-            return;
-        }
-        /* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
-           sometimes losing focus when receiving WM_SETFOCUS messages. */
+        DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
+        return;
     }
-    WIN_ReleaseWndPtr( wndPtr );
+    /* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
+       sometimes losing focus when receiving WM_SETFOCUS messages. */
 }
 
 
@@ -138,38 +144,33 @@
     switch(msg)
     {
         case WM_ERASEBKGND:
-	    FillWindow16( hwnd, hwnd, (HDC16)wParam, (HBRUSH16)CTLCOLOR_DLG );
-	    return 1;
-
+        {
+            HBRUSH brush = SendMessageW( hwnd, WM_CTLCOLORDLG, wParam, (LPARAM)hwnd );
+            if (!brush) brush = DefWindowProcW( hwnd, WM_CTLCOLORDLG, wParam, (LPARAM)hwnd );
+            if (brush)
+            {
+                RECT rect;
+                HDC hdc = (HDC)wParam;
+                GetClientRect( hwnd, &rect );
+                DPtoLP( hdc, (LPPOINT)&rect, 2 );
+                FillRect( hdc, &rect, brush );
+            }
+            return 1;
+        }
 	case WM_NCDESTROY:
-
-	      /* Free dialog heap (if created) */
-	    if (dlgInfo->hDialogHeap)
-	    {
-		GlobalUnlock16(dlgInfo->hDialogHeap);
-		GlobalFree16(dlgInfo->hDialogHeap);
-		dlgInfo->hDialogHeap = 0;
-	    }
-
-	      /* Delete font */
-	    if (dlgInfo->hUserFont)
-	    {
-		DeleteObject( dlgInfo->hUserFont );
-		dlgInfo->hUserFont = 0;
-	    }
-
-	      /* Delete menu */
-	    if (dlgInfo->hMenu)
-	    {		
-		DestroyMenu( dlgInfo->hMenu );
-		dlgInfo->hMenu = 0;
-	    }
-
-            /* Delete window procedure */
-            WINPROC_FreeProc( dlgInfo->dlgProc, WIN_PROC_WINDOW );
-            dlgInfo->dlgProc = (HWINDOWPROC)0;
-            dlgInfo->flags |= DF_END;  /* just in case */
-
+            if ((dlgInfo = (DIALOGINFO *)SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, 0 )))
+            {
+                /* Free dialog heap (if created) */
+                if (dlgInfo->hDialogHeap)
+                {
+                    GlobalUnlock16(dlgInfo->hDialogHeap);
+                    GlobalFree16(dlgInfo->hDialogHeap);
+                }
+                if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
+                if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
+                WINPROC_FreeProc( DEFDLG_GetDlgProc( hwnd ), WIN_PROC_WINDOW );
+                HeapFree( GetProcessHeap(), 0, dlgInfo );
+            }
 	      /* Window clean-up */
 	    return DefWindowProcA( hwnd, msg, wParam, lParam );
 
@@ -263,18 +264,13 @@
 LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
                              LPARAM lParam )
 {
-    DIALOGINFO * dlgInfo;
     WNDPROC16 dlgproc;
+    HWND hwnd32 = WIN_Handle32( hwnd );
     BOOL result = FALSE;
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
 
-    if (!wndPtr) return 0;
-    dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
-    dlgInfo->msgResult = 0;
-    dlgproc = (WNDPROC16)dlgInfo->dlgProc;
-    WIN_ReleaseWndPtr(wndPtr);
+    SetWindowLongW( hwnd32, DWL_MSGRESULT, 0 );
 
-    if (dlgproc)
+    if ((dlgproc = (WNDPROC16)DEFDLG_GetDlgProc( hwnd32 )))
     {
         /* Call dialog procedure */
         result = CallWindowProc16( dlgproc, hwnd, msg, wParam, lParam );
@@ -283,7 +279,7 @@
             result = LOWORD(result);
     }
 
-    if (!result && IsWindow(hwnd))
+    if (!result && IsWindow(hwnd32))
     {
         /* callback didn't process this message */
 
@@ -302,8 +298,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                return DEFDLG_Proc( (HWND)hwnd, msg, 
-                                    (WPARAM)wParam, lParam, dlgInfo );
+                return DEFDLG_Proc( hwnd32, msg, (WPARAM)wParam, lParam, DIALOG_get_info(hwnd32) );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
@@ -314,28 +309,21 @@
                 return DefWindowProc16( hwnd, msg, wParam, lParam );
         }
     }
-    return DEFDLG_Epilog(hwnd, msg, result);
+    return DEFDLG_Epilog( hwnd32, msg, result);
 }
 
 
 /***********************************************************************
  *		DefDlgProcA (USER32.@)
  */
-LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg,
-                              WPARAM wParam, LPARAM lParam )
+LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
-    DIALOGINFO * dlgInfo;
     WNDPROC dlgproc;
     BOOL result = FALSE;
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
 
-    if (!wndPtr) return 0;
-    dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
-    dlgInfo->msgResult = 0;
-    dlgproc = dlgInfo->dlgProc;
-    WIN_ReleaseWndPtr(wndPtr);
+    SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
 
-    if (dlgproc)
+    if ((dlgproc = DEFDLG_GetDlgProc( hwnd )))
     {
         /* Call dialog procedure */
         result = CallWindowProcA( dlgproc, hwnd, msg, wParam, lParam );
@@ -363,7 +351,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
+                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, DIALOG_get_info(hwnd) );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
@@ -381,21 +369,14 @@
 /***********************************************************************
  *		DefDlgProcW (USER32.@)
  */
-LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam,
-                              LPARAM lParam )
+LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
-    DIALOGINFO * dlgInfo;
     BOOL result = FALSE;
     WNDPROC dlgproc;
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
 
-    if (!wndPtr) return 0;
-    dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
-    dlgInfo->msgResult = 0;
-    dlgproc = dlgInfo->dlgProc;
-    WIN_ReleaseWndPtr(wndPtr);
+    SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
 
-    if (dlgproc)
+    if ((dlgproc = DEFDLG_GetDlgProc( hwnd )))
     {
         /* Call dialog procedure */
         result = CallWindowProcW( dlgproc, hwnd, msg, wParam, lParam );
@@ -423,7 +404,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
+                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, DIALOG_get_info(hwnd) );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
diff --git a/windows/defwnd.c b/windows/defwnd.c
index 73e6522..a193cab 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -333,7 +333,7 @@
 	    pt.x = SLOWORD(lParam);
 	    pt.y = SHIWORD(lParam);
             ClientToScreen(hwnd, &pt);
-            SendMessageW( hwnd, WM_CONTEXTMENU, hwnd, MAKELPARAM(pt.x, pt.y) );
+            SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM(pt.x, pt.y) );
         }
         break;
 
@@ -651,10 +651,11 @@
 /***********************************************************************
  *		DefWindowProc (USER.107)
  */
-LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
+LRESULT WINAPI DefWindowProc16( HWND16 hwnd16, UINT16 msg, WPARAM16 wParam,
                                 LPARAM lParam )
 {
     LRESULT result = 0;
+    HWND hwnd = WIN_Handle32( hwnd16 );
 
     if (!IsWindow( hwnd )) return 0;
     SPY_EnterMessage( SPY_DEFWNDPROC16, hwnd, msg, wParam, lParam );
diff --git a/windows/dialog.c b/windows/dialog.c
index 52ffd1a..3d30a76 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -428,11 +428,10 @@
  *
  * Create the control windows for a dialog.
  */
-static BOOL DIALOG_CreateControls( WND *pWnd, LPCSTR template,
-                                     const DLG_TEMPLATE *dlgTemplate,
-                                     HINSTANCE hInst, BOOL win32 )
+static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate,
+                                   HINSTANCE hInst, BOOL win32 )
 {
-    DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
+    DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
     DLG_CONTROL_INFO info;
     HWND hwndCtrl, hwndDefButton = 0;
     INT items = dlgTemplate->nbItems;
@@ -445,7 +444,7 @@
             HINSTANCE16 instance;
             template = DIALOG_GetControl16( template, &info );
             if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
-                ((pWnd->dwStyle & DS_LOCALEDIT) != DS_LOCALEDIT))
+                !(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT))
             {
                 if (!dlgInfo->hDialogHeap)
                 {
@@ -461,15 +460,15 @@
             }
             else instance = (HINSTANCE16)hInst;
 
-            hwndCtrl = CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
-                                         info.className, info.windowName,
-                                         info.style | WS_CHILD,
-                                         MulDiv(info.x, dlgInfo->xBaseUnit, 4),
-                                         MulDiv(info.y, dlgInfo->yBaseUnit, 8),
-                                         MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
-                                         MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                         pWnd->hwndSelf, (HMENU16)info.id,
-                                         instance, (LPVOID)SEGPTR_GET(info.data) );
+            hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
+                                                       info.className, info.windowName,
+                                                       info.style | WS_CHILD,
+                                                       MulDiv(info.x, dlgInfo->xBaseUnit, 4),
+                                                       MulDiv(info.y, dlgInfo->yBaseUnit, 8),
+                                                       MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
+                                                       MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
+                                                       WIN_Handle16(hwnd), (HMENU16)info.id,
+                                                       instance, (LPVOID)SEGPTR_GET(info.data) ));
 
 	    if (info.data) SEGPTR_FREE(info.data);
         }
@@ -491,7 +490,7 @@
                                           MulDiv(info.y, dlgInfo->yBaseUnit, 8),
                                           MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
                                           MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                          pWnd->hwndSelf, (HMENU)info.id,
+                                          hwnd, (HMENU)info.id,
                                           hInst, info.data );
         }
         if (!hwndCtrl) return FALSE;
@@ -507,7 +506,7 @@
                 SendMessageA( hwndDefButton, BM_SETSTYLE,
                                 BS_PUSHBUTTON,FALSE );
             hwndDefButton = hwndCtrl;
-            dlgInfo->idResult = GetWindowWord( hwndCtrl, GWW_ID );
+            dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
         }
     }    
     TRACE(" END\n" );
@@ -703,20 +702,16 @@
  *       is never disabled if the dialog fails because of an invalid template)
  */
 static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
-                                   BOOL win32Template, HWND owner,
-                                   DLGPROC16 dlgProc, LPARAM param,
+                                   HWND owner, DLGPROC dlgProc, LPARAM param,
                                    WINDOWPROCTYPE procType, BOOL modal )
 {
-    HMENU16 hMenu = 0;
-    HFONT16 hFont = 0;
     HWND hwnd;
     RECT rect;
     WND * wndPtr;
     DLG_TEMPLATE template;
     DIALOGINFO * dlgInfo;
-    WORD xUnit = xBaseUnit;
-    WORD yUnit = yBaseUnit;
     BOOL ownerEnabled = TRUE;
+    BOOL win32Template = (procType != WIN_PROC_16);
 
       /* Parse dialog template */
 
@@ -726,12 +721,24 @@
     else
         dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
 
+      /* Initialise dialog extra data */
+
+    if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0;
+    dlgInfo->hwndFocus   = 0;
+    dlgInfo->hUserFont   = 0;
+    dlgInfo->hMenu       = 0;
+    dlgInfo->xBaseUnit   = xBaseUnit;
+    dlgInfo->yBaseUnit   = yBaseUnit;
+    dlgInfo->idResult    = 0;
+    dlgInfo->flags       = 0;
+    dlgInfo->hDialogHeap = 0;
+
       /* Load menu */
 
     if (template.menuName)
     {
-        if (!win32Template) hMenu = LoadMenu16( hInst, template.menuName );
-        else hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
+        if (!win32Template) dlgInfo->hMenu = LoadMenu16( hInst, template.menuName );
+        else dlgInfo->hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
     }
 
       /* Create custom font if needed */
@@ -752,38 +759,34 @@
             ReleaseDC(0, dc);
         }
 	if (win32Template)
-	    hFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
-				 template.italic, FALSE, FALSE, 
-				 DEFAULT_CHARSET, 0, 0,
-				 PROOF_QUALITY, FF_DONTCARE,
-				 (LPCWSTR)template.faceName );
+            dlgInfo->hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
+                                              template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+                                              PROOF_QUALITY, FF_DONTCARE,
+                                              (LPCWSTR)template.faceName );
 	else
-	    hFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
-                                 FALSE, FALSE, FALSE,
-                                 DEFAULT_CHARSET, 0, 0,
-                                 PROOF_QUALITY, FF_DONTCARE,
-                                 template.faceName );
-        if (hFont)
+            dlgInfo->hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
+                                              FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+                                              PROOF_QUALITY, FF_DONTCARE, template.faceName );
+        if (dlgInfo->hUserFont)
         {
             SIZE charSize;
-            if (DIALOG_GetCharSize(hFont,&charSize))
+            if (DIALOG_GetCharSize( dlgInfo->hUserFont, &charSize ))
             {
-                xUnit = charSize.cx;
-                yUnit = charSize.cy;
+                dlgInfo->xBaseUnit = charSize.cx;
+                dlgInfo->yBaseUnit = charSize.cy;
             }
         }
-	TRACE("units = %d,%d\n", xUnit, yUnit );
+        TRACE("units = %d,%d\n", dlgInfo->xBaseUnit, dlgInfo->yBaseUnit );
     }
-    
+
     /* Create dialog main window */
 
     rect.left = rect.top = 0;
-    rect.right = MulDiv(template.cx, xUnit, 4);
-    rect.bottom =  MulDiv(template.cy, yUnit, 8);
+    rect.right = MulDiv(template.cx, dlgInfo->xBaseUnit, 4);
+    rect.bottom =  MulDiv(template.cy, dlgInfo->yBaseUnit, 8);
     if (template.style & DS_MODALFRAME)
         template.exStyle |= WS_EX_DLGMODALFRAME;
-    AdjustWindowRectEx( &rect, template.style, 
-                          hMenu ? TRUE : FALSE , template.exStyle );
+    AdjustWindowRectEx( &rect, template.style, (dlgInfo->hMenu != 0), template.exStyle );
     rect.right -= rect.left;
     rect.bottom -= rect.top;
 
@@ -800,8 +803,8 @@
         }
         else
         {
-            rect.left += MulDiv(template.x, xUnit, 4);
-            rect.top += MulDiv(template.y, yUnit, 8);
+            rect.left += MulDiv(template.x, dlgInfo->xBaseUnit, 4);
+            rect.top += MulDiv(template.y, dlgInfo->yBaseUnit, 8);
         }
         if ( !(template.style & WS_CHILD) )
 	{
@@ -822,50 +825,51 @@
     }
 
     if (modal)
+    {
         ownerEnabled = DIALOG_DisableOwner( owner );
+        if (ownerEnabled) dlgInfo->flags |= DF_OWNERENABLED;
+    }
 
     if (!win32Template)
-        hwnd = CreateWindowEx16(template.exStyle, template.className,
-                                template.caption, template.style & ~WS_VISIBLE,
-                                rect.left, rect.top, rect.right, rect.bottom,
-                                owner, hMenu, hInst, NULL );
+        hwnd = WIN_Handle32( CreateWindowEx16(template.exStyle, template.className,
+                                              template.caption, template.style & ~WS_VISIBLE,
+                                              rect.left, rect.top, rect.right, rect.bottom,
+                                              WIN_Handle16(owner), dlgInfo->hMenu, hInst, NULL ));
     else
         hwnd = CreateWindowExW(template.exStyle, (LPCWSTR)template.className,
                                  (LPCWSTR)template.caption,
                                  template.style & ~WS_VISIBLE,
                                  rect.left, rect.top, rect.right, rect.bottom,
-                                 owner, hMenu, hInst, NULL );
-	
+                                 owner, dlgInfo->hMenu, hInst, NULL );
+
     if (!hwnd)
     {
-	if (hFont) DeleteObject( hFont );
-	if (hMenu) DestroyMenu( hMenu );
-        if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
+        if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
+        if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
+        if (modal && (dlgInfo->flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
+        HeapFree( GetProcessHeap(), 0, dlgInfo );
 	return 0;
     }
     wndPtr = WIN_FindWndPtr( hwnd );
     wndPtr->flags |= WIN_ISDIALOG;
-    wndPtr->helpContext = template.helpId;
+    WIN_ReleaseWndPtr(wndPtr);
 
-      /* Initialise dialog extra data */
-
-    dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
-    WINPROC_SetProc( &dlgInfo->dlgProc, (WNDPROC16)dlgProc, procType, WIN_PROC_WINDOW );
-    dlgInfo->hUserFont = hFont;
-    dlgInfo->hMenu     = hMenu;
-    dlgInfo->xBaseUnit = xUnit;
-    dlgInfo->yBaseUnit = yUnit;
-    dlgInfo->msgResult = 0;
-    dlgInfo->idResult  = 0;
-    dlgInfo->flags     = ownerEnabled ? DF_OWNERENABLED: 0;
-    dlgInfo->hDialogHeap = 0;
+    if (template.helpId) SetWindowContextHelpId( hwnd, template.helpId );
+    SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
+    switch(procType)
+    {
+    case WIN_PROC_16: SetWindowLong16( WIN_Handle16(hwnd), DWL_DLGPROC, (LONG)dlgProc ); break;
+    case WIN_PROC_32A: SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
+    case WIN_PROC_32W: SetWindowLongW( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
+    default: break;
+    }
 
     if (dlgInfo->hUserFont)
         SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
 
     /* Create controls */
 
-    if (DIALOG_CreateControls( wndPtr, dlgTemplate, &template,
+    if (DIALOG_CreateControls( hwnd, dlgTemplate, &template,
                                hInst, win32Template ))
     {
         HWND hwndPreInitFocus;
@@ -886,21 +890,20 @@
         {
             /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
                but the focus has not changed, set the focus where we expect it. */
-            if ( (wndPtr->dwStyle & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
+            if ((GetFocus() == hwndPreInitFocus) &&
+                (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
             {
                 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE); 
                 SetFocus( dlgInfo->hwndFocus );
             }
         }
 
-	if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE)) 
+	if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
 	{
 	   ShowWindow( hwnd, SW_SHOWNORMAL );	/* SW_SHOW doesn't always work */
 	}
-        WIN_ReleaseWndPtr(wndPtr);
 	return hwnd;
     }
-    WIN_ReleaseWndPtr(wndPtr);
     if( IsWindow(hwnd) ) DestroyWindow( hwnd );
     if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
     return 0;
@@ -990,8 +993,8 @@
                                            HWND16 owner, DLGPROC16 dlgProc,
                                            LPARAM param )
 {
-    return DIALOG_CreateIndirect( hInst, dlgTemplate, FALSE, owner,
-                                  dlgProc, param, WIN_PROC_16, FALSE );
+    return WIN_Handle16( DIALOG_CreateIndirect( hInst, dlgTemplate, WIN_Handle32(owner),
+                                                (DLGPROC)dlgProc, param, WIN_PROC_16, FALSE ));
 }
 
 
@@ -1003,8 +1006,7 @@
                                             HWND owner, DLGPROC dlgProc,
                                             LPARAM param )
 {
-    return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32A, FALSE );
+    return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32A, FALSE );
 }
 
 /***********************************************************************
@@ -1015,8 +1017,7 @@
                                             HWND owner, DLGPROC dlgProc,
                                             LPARAM param )
 {   FIXME("assume WIN_PROC_32W\n");
-    return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32W, FALSE );
+    return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
 }
 
 /***********************************************************************
@@ -1027,8 +1028,7 @@
                                             HWND owner, DLGPROC dlgProc,
                                             LPARAM param )
 {
-    return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32W, FALSE );
+    return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
 }
 
 
@@ -1037,21 +1037,19 @@
  */
 static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
 {
-    WND * wndPtr;
     DIALOGINFO * dlgInfo;
     MSG msg;
     INT retval;
     HWND ownerMsg = GetAncestor( owner, GA_ROOT );
 
-    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
-    dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
+    if (!(dlgInfo = DIALOG_get_info( hwnd ))) return -1;
 
     if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
     {
         ShowWindow( hwnd, SW_SHOW );
         for (;;)
         {
-            if (!(wndPtr->dwStyle & DS_NOIDLEMSG))
+            if (!(GetWindowLongW( hwnd, GWL_STYLE ) & DS_NOIDLEMSG))
             {
                 if (!PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
                 {
@@ -1064,6 +1062,7 @@
 
             if (CallMsgFilterW( &msg, MSGF_DIALOGBOX )) continue;
 
+            if (!IsWindow( hwnd )) return -1;
             if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
             {
                 TranslateMessage( &msg );
@@ -1073,8 +1072,7 @@
         }
     }
     if (dlgInfo->flags & DF_OWNERENABLED) DIALOG_EnableOwner( owner );
-    retval = dlgInfo->idResult; 
-    WIN_ReleaseWndPtr(wndPtr);
+    retval = dlgInfo->idResult;
     DestroyWindow( hwnd );
     return retval;
 }
@@ -1094,9 +1092,9 @@
  *		DialogBoxParam (USER.239)
  */
 INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
-                               HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
+                               HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
 {
-    HWND16 hwnd = 0;
+    HWND hwnd = 0;
     HRSRC16 hRsrc;
     HGLOBAL16 hmem;
     LPCVOID data;
@@ -1104,12 +1102,14 @@
 
     if (!(hRsrc = FindResource16( hInst, template, RT_DIALOGA ))) return 0;
     if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
-    if (!(data = LockResource16( hmem ))) hwnd = 0;
-    else hwnd = DIALOG_CreateIndirect( hInst, data, FALSE, owner,
-                                  dlgProc, param, WIN_PROC_16, TRUE );
-    if (hwnd)
-        ret =(INT16)DIALOG_DoDialogBox( hwnd, owner );
-    if (data) GlobalUnlock16( hmem );
+    if ((data = LockResource16( hmem )))
+    {
+        HWND owner = WIN_Handle32(owner16);
+        hwnd = DIALOG_CreateIndirect( hInst, data, owner,
+                                      (DLGPROC)dlgProc, param, WIN_PROC_16, TRUE );
+        if (hwnd) ret = DIALOG_DoDialogBox( hwnd, owner );
+        GlobalUnlock16( hmem );
+    }
     FreeResource16( hmem );
     return ret;
 }
@@ -1125,8 +1125,7 @@
     HANDLE hrsrc = FindResourceA( hInst, name, RT_DIALOGA );
     if (!hrsrc) return 0;
     hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
-                                  TRUE, owner,
-                                  (DLGPROC16) dlgProc, param, WIN_PROC_32A, TRUE );
+                                  owner, dlgProc, param, WIN_PROC_32A, TRUE );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
@@ -1142,8 +1141,7 @@
     HANDLE hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
     if (!hrsrc) return 0;
     hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
-                                  TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32W, TRUE );
+                                  owner, dlgProc, param, WIN_PROC_32W, TRUE );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
@@ -1164,15 +1162,15 @@
  *		DialogBoxIndirectParam16 (USER32.@)
  */
 INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
-                                       HWND16 owner, DLGPROC16 dlgProc,
+                                       HWND16 owner16, DLGPROC16 dlgProc,
                                        LPARAM param )
 {
-    HWND16 hwnd;
+    HWND hwnd, owner = WIN_Handle32( owner16 );
     LPCVOID ptr;
 
     if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
-    hwnd = DIALOG_CreateIndirect( hInst, ptr, FALSE, owner,
-                                  dlgProc, param, WIN_PROC_16, TRUE );
+    hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, (DLGPROC)dlgProc,
+                                  param, WIN_PROC_16, TRUE );
     GlobalUnlock16( dlgTemplate );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
@@ -1186,8 +1184,8 @@
                                        HWND owner, DLGPROC dlgProc,
                                        LPARAM param )
 {
-    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, TRUE, owner,
-                                  (DLGPROC16) dlgProc, param, WIN_PROC_32A, TRUE );
+    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
+                                       dlgProc, param, WIN_PROC_32A, TRUE );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
@@ -1200,8 +1198,8 @@
                                        HWND owner, DLGPROC dlgProc,
                                        LPARAM param )
 {
-    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32W, TRUE );
+    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
+                                       dlgProc, param, WIN_PROC_32W, TRUE );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
@@ -1216,46 +1214,30 @@
     HWND hwnd;
     FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
       hInstance, template, owner, dlgProc, param, x);
-    hwnd = DIALOG_CreateIndirect( hInstance, template, TRUE, owner,
-                                  (DLGPROC16)dlgProc, param, WIN_PROC_32W, TRUE );
+    hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, WIN_PROC_32W, TRUE );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
 
 /***********************************************************************
- *		EndDialog (USER.88)
- */
-BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
-{
-    return EndDialog( hwnd, retval );
-}
-
-
-/***********************************************************************
  *		EndDialog (USER32.@)
  */
 BOOL WINAPI EndDialog( HWND hwnd, INT retval )
 {
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
     BOOL wasEnabled = TRUE;
     DIALOGINFO * dlgInfo;
     HWND owner;
 
     TRACE("%04x %d\n", hwnd, retval );
 
-    if (!wndPtr)
+    if (!(dlgInfo = DIALOG_get_info( hwnd )))
     {
-	ERR("got invalid window handle (%04x); buggy app !?\n", hwnd);
-	return FALSE;
+        ERR("got invalid window handle (%04x); buggy app !?\n", hwnd);
+        return FALSE;
     }
-
-    if ((dlgInfo = (DIALOGINFO *)wndPtr->wExtra))
-    {
-        dlgInfo->idResult = retval;
-        dlgInfo->flags |= DF_END;
-        wasEnabled = (dlgInfo->flags & DF_OWNERENABLED);
-    }
-    WIN_ReleaseWndPtr(wndPtr);
+    dlgInfo->idResult = retval;
+    dlgInfo->flags |= DF_END;
+    wasEnabled = (dlgInfo->flags & DF_OWNERENABLED);
 
     if (wasEnabled && (owner = GetWindow( hwnd, GW_OWNER )))
         DIALOG_EnableOwner( owner );
@@ -1314,7 +1296,7 @@
                     if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX )
                     {
                         /* set focus to the control */
-                        SendMessageA( hwndDlg, WM_NEXTDLGCTL, hwndControl, 1);
+                        SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, 1);
                         /* and bump it on to next */
                         SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
                     }
@@ -1444,7 +1426,7 @@
                 BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP);
                 HWND hwndNext = 
                     GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
-                SendMessageA( hwndDlg, WM_NEXTDLGCTL, hwndNext, 1 );
+                SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
                 return TRUE;
             }
             break;
@@ -1579,15 +1561,6 @@
 
 
 /***********************************************************************
- *		GetDlgCtrlID (USER.277)
- */
-INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
-{
-    return GetDlgCtrlID( hwnd );
-}
-
-
-/***********************************************************************
  *		GetDlgCtrlID (USER32.@)
  */
 INT WINAPI GetDlgCtrlID( HWND hwnd )
@@ -1597,15 +1570,6 @@
 
 
 /***********************************************************************
- *		GetDlgItem (USER.91)
- */
-HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
-{
-    return GetDlgItem( hwndDlg, id );
-}
-
-
-/***********************************************************************
  *		GetDlgItem (USER32.@)
  */
 HWND WINAPI GetDlgItem( HWND hwndDlg, INT id )
@@ -1624,18 +1588,6 @@
 
 
 /*******************************************************************
- *		SendDlgItemMessage (USER.101)
- */
-LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
-                                     WPARAM16 wParam, LPARAM lParam )
-{
-    HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
-    if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
-    else return 0;
-}
-
-
-/*******************************************************************
  *		SendDlgItemMessageA (USER32.@)
  */
 LRESULT WINAPI SendDlgItemMessageA( HWND hwnd, INT id, UINT msg,
@@ -1660,15 +1612,6 @@
 
 
 /*******************************************************************
- *		SetDlgItemText (USER.92)
- */
-void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
-{
-    SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
-}
-
-
-/*******************************************************************
  *		SetDlgItemTextA (USER32.@)
  */
 BOOL WINAPI SetDlgItemTextA( HWND hwnd, INT id, LPCSTR lpString )
@@ -1687,16 +1630,6 @@
 
 
 /***********************************************************************
- *		GetDlgItemText (USER.93)
- */
-INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
-{
-    return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT,
-                                        len, (LPARAM)str );
-}
-
-
-/***********************************************************************
  *		GetDlgItemTextA (USER32.@)
  */
 INT WINAPI GetDlgItemTextA( HWND hwnd, INT id, LPSTR str, UINT len )
@@ -1717,15 +1650,6 @@
 
 
 /*******************************************************************
- *		SetDlgItemInt (USER.94)
- */
-void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
-{
-    SetDlgItemInt( hwnd, (UINT)(UINT16)id, value, fSigned );
-}
-
-
-/*******************************************************************
  *		SetDlgItemInt (USER32.@)
  */
 BOOL WINAPI SetDlgItemInt( HWND hwnd, INT id, UINT value,
@@ -1741,31 +1665,6 @@
 
 
 /***********************************************************************
- *		GetDlgItemInt (USER.95)
- */
-UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated,
-                               BOOL16 fSigned )
-{
-    UINT result;
-    BOOL ok;
-
-    if (translated) *translated = FALSE;
-    result = GetDlgItemInt( hwnd, (UINT)(UINT16)id, &ok, fSigned );
-    if (!ok) return 0;
-    if (fSigned)
-    {
-        if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
-    }
-    else
-    {
-        if (result > 65535) return 0;
-    }
-    if (translated) *translated = TRUE;
-    return (UINT16)result;
-}
-
-
-/***********************************************************************
  *		GetDlgItemInt (USER32.@)
  */
 UINT WINAPI GetDlgItemInt( HWND hwnd, INT id, BOOL *translated,
@@ -1799,16 +1698,6 @@
 
 
 /***********************************************************************
- *		CheckDlgButton (USER.97)
- */
-BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
-{
-    SendDlgItemMessageA( hwnd, id, BM_SETCHECK, check, 0 );
-    return TRUE;
-}
-
-
-/***********************************************************************
  *		CheckDlgButton (USER32.@)
  */
 BOOL WINAPI CheckDlgButton( HWND hwnd, INT id, UINT check )
@@ -1819,15 +1708,6 @@
 
 
 /***********************************************************************
- *		IsDlgButtonChecked (USER.98)
- */
-UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
-{
-    return (UINT16)SendDlgItemMessageA( hwnd, id, BM_GETCHECK, 0, 0 );
-}
-
-
-/***********************************************************************
  *		IsDlgButtonChecked (USER32.@)
  */
 UINT WINAPI IsDlgButtonChecked( HWND hwnd, UINT id )
@@ -1837,16 +1717,6 @@
 
 
 /***********************************************************************
- *		CheckRadioButton (USER.96)
- */
-BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
-                                  UINT16 lastID, UINT16 checkID )
-{
-    return CheckRadioButton( hwndDlg, firstID, lastID, checkID );
-}
-
-
-/***********************************************************************
  *           CheckRB
  * 
  * Callback function used to check/uncheck radio buttons that fall 
@@ -1903,55 +1773,24 @@
 
 
 /***********************************************************************
- *		MapDialogRect (USER.103)
- */
-void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
-{
-    DIALOGINFO * dlgInfo;
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
-    if (!wndPtr) return;
-    dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
-    rect->left   = MulDiv(rect->left, dlgInfo->xBaseUnit, 4);
-    rect->right  = MulDiv(rect->right, dlgInfo->xBaseUnit, 4);
-    rect->top    = MulDiv(rect->top, dlgInfo->yBaseUnit, 8);
-    rect->bottom = MulDiv(rect->bottom, dlgInfo->yBaseUnit, 8);
-    WIN_ReleaseWndPtr(wndPtr);
-}
-
-
-/***********************************************************************
  *		MapDialogRect (USER32.@)
  */
 BOOL WINAPI MapDialogRect( HWND hwnd, LPRECT rect )
 {
     DIALOGINFO * dlgInfo;
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
-    if (!wndPtr) return FALSE;
-    dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
+    if (!(dlgInfo = DIALOG_get_info( hwnd ))) return FALSE;
     rect->left   = MulDiv(rect->left, dlgInfo->xBaseUnit, 4);
     rect->right  = MulDiv(rect->right, dlgInfo->xBaseUnit, 4);
     rect->top    = MulDiv(rect->top, dlgInfo->yBaseUnit, 8);
     rect->bottom = MulDiv(rect->bottom, dlgInfo->yBaseUnit, 8);
-    WIN_ReleaseWndPtr(wndPtr);
     return TRUE;
 }
 
 
 /***********************************************************************
- *		GetNextDlgGroupItem (USER.227)
- */
-HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
-                                     BOOL16 fPrevious )
-{
-    return (HWND16)GetNextDlgGroupItem( hwndDlg, hwndCtrl, fPrevious );
-}
-
-
-/***********************************************************************
  *		GetNextDlgGroupItem (USER32.@)
  */
-HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl,
-                                     BOOL fPrevious )
+HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
 {
     HWND hwnd, retvalue;
 
@@ -2009,15 +1848,6 @@
 
 
 /***********************************************************************
- *		GetNextDlgTabItem (USER.228)
- */
-HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
-                                   BOOL16 fPrevious )
-{
-    return (HWND16)GetNextDlgTabItem( hwndDlg, hwndCtrl, fPrevious );
-}
-
-/***********************************************************************
  *           DIALOG_GetNextTabItem
  *
  * Helper for GetNextDlgTabItem
@@ -2267,33 +2097,6 @@
 
 
 /**********************************************************************
- *		DlgDirSelect (USER.99)
- */
-BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
-{
-    return DlgDirSelectEx16( hwnd, str, 128, id );
-}
-
-
-/**********************************************************************
- *		DlgDirSelectComboBox (USER.194)
- */
-BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
-{
-    return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
-}
-
-
-/**********************************************************************
- *		DlgDirSelectEx (USER.422)
- */
-BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
-{
-    return DlgDirSelectExA( hwnd, str, len, id );
-}
-
-
-/**********************************************************************
  *		DlgDirSelectExA (USER32.@)
  */
 BOOL WINAPI DlgDirSelectExA( HWND hwnd, LPSTR str, INT len, INT id )
@@ -2312,16 +2115,6 @@
 
 
 /**********************************************************************
- *		DlgDirSelectComboBoxEx (USER.423)
- */
-BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
-                                        INT16 id )
-{
-    return DlgDirSelectComboBoxExA( hwnd, str, len, id );
-}
-
-
-/**********************************************************************
  *		DlgDirSelectComboBoxExA (USER32.@)
  */
 BOOL WINAPI DlgDirSelectComboBoxExA( HWND hwnd, LPSTR str, INT len,
@@ -2342,21 +2135,6 @@
 
 
 /**********************************************************************
- *		DlgDirList (USER.100)
- */
-INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
-                           INT16 idStatic, UINT16 attrib )
-{
-    /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
-     * be set automatically (this is different in Win32, and
-     * DIALOG_DlgDirList sends Win32 messages to the control,
-     * so do it here) */
-    if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
-    return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
-}
-
-
-/**********************************************************************
  *		DlgDirListA (USER32.@)
  */
 INT WINAPI DlgDirListA( HWND hDlg, LPSTR spec, INT idLBox,
@@ -2377,16 +2155,6 @@
 
 
 /**********************************************************************
- *		DlgDirListComboBox (USER.195)
- */
-INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
-                                   INT16 idStatic, UINT16 attrib )
-{
-    return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
-}
-
-
-/**********************************************************************
  *		DlgDirListComboBoxA (USER32.@)
  */
 INT WINAPI DlgDirListComboBoxA( HWND hDlg, LPSTR spec, INT idCBox,
diff --git a/windows/focus.c b/windows/focus.c
index 175d39d..09cd85e 100644
--- a/windows/focus.c
+++ b/windows/focus.c
@@ -29,7 +29,7 @@
 {
     PERQDATA_SetFocusWnd( pMsgQ->pQData, hFocusTo );
 
-    if (hFocusFrom) SendMessageA( hFocusFrom, WM_KILLFOCUS, hFocusTo, 0 );
+    if (hFocusFrom) SendMessageA( hFocusFrom, WM_KILLFOCUS, (WPARAM)hFocusTo, 0 );
 
     if( !hFocusTo || hFocusTo != PERQDATA_GetFocusWnd( pMsgQ->pQData ) )
     {
@@ -40,16 +40,7 @@
        has received the keyboard focus. */
     if (USER_Driver.pSetFocus) USER_Driver.pSetFocus(hFocusTo);
 
-    SendMessageA( hFocusTo, WM_SETFOCUS, hFocusFrom, 0 );
-}
-
-
-/*****************************************************************
- *		SetFocus (USER.22)
- */
-HWND16 WINAPI SetFocus16( HWND16 hwnd )
-{
-    return (HWND16)SetFocus( hwnd );
+    SendMessageA( hFocusTo, WM_SETFOCUS, (WPARAM)hFocusFrom, 0 );
 }
 
 
@@ -157,15 +148,6 @@
 
 
 /*****************************************************************
- *		GetFocus (USER.23)
- */
-HWND16 WINAPI GetFocus16(void)
-{
-    return (HWND16)GetFocus();
-}
-
-
-/*****************************************************************
  *		GetFocus (USER32.@)
  */
 HWND WINAPI GetFocus(void)
diff --git a/windows/hook.c b/windows/hook.c
index d0cb579..10ca820 100644
--- a/windows/hook.c
+++ b/windows/hook.c
@@ -99,13 +99,13 @@
 	    LPCWPSTRUCT16   lpcwp16 = MapSL(*plParam);
 	    LPCWPSTRUCT   lpcwp32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcwp32) );
 	    
-	    lpcwp32->hwnd = lpcwp16->hwnd;
+	    lpcwp32->hwnd = WIN_Handle32(lpcwp16->hwnd);
 	    lpcwp32->lParam = lpcwp16->lParam;
 	    
-            if (bA) WINPROC_MapMsg16To32A( lpcwp16->message, lpcwp16->wParam, 
+            if (bA) WINPROC_MapMsg16To32A( lpcwp32->hwnd, lpcwp16->message, lpcwp16->wParam,
                                            &lpcwp32->message, &lpcwp32->wParam,
                                            &lpcwp32->lParam );
-            else WINPROC_MapMsg16To32W( lpcwp16->hwnd,lpcwp16->message, lpcwp16->wParam, 
+            else WINPROC_MapMsg16To32W( lpcwp32->hwnd,lpcwp16->message, lpcwp16->wParam,
                                         &lpcwp32->message, &lpcwp32->wParam,
                                         &lpcwp32->lParam );
 	    *plParam = (LPARAM)lpcwp32;
@@ -143,7 +143,7 @@
 		else
 		    lpcbtcw32->lpcs->lpszClass = (LPCSTR)lpcs16->lpszClass;
 
-		lpcbtcw32->hwndInsertAfter = lpcbtcw16->hwndInsertAfter;
+		lpcbtcw32->hwndInsertAfter = WIN_Handle32( lpcbtcw16->hwndInsertAfter );
 
 		*plParam = (LPARAM)lpcbtcw32;
 		break;
@@ -154,7 +154,7 @@
                 LPCBTACTIVATESTRUCT lpcas32 = HeapAlloc( GetProcessHeap(), 0,
                                                            sizeof(*lpcas32) );
                 lpcas32->fMouse = lpcas16->fMouse;
-                lpcas32->hWndActive = lpcas16->hWndActive;
+                lpcas32->hWndActive = WIN_Handle32(lpcas16->hWndActive);
                 *plParam = (LPARAM)lpcas32;
                 break;
             }
@@ -171,7 +171,7 @@
                 lpms32->wHitTestCode = (INT)((INT16)lpms16->wHitTestCode);
 
                 lpms32->dwExtraInfo = lpms16->dwExtraInfo;
-                lpms32->hwnd = lpms16->hwnd;
+                lpms32->hwnd = WIN_Handle32( lpms16->hwnd );
                 *plParam = (LPARAM)lpms32;
                 break;
             }
@@ -200,7 +200,7 @@
                correct sign extension. Yay. :| */
             lpms32->wHitTestCode = (INT)((INT16)lpms16->wHitTestCode);
             lpms32->dwExtraInfo = lpms16->dwExtraInfo;
-            lpms32->hwnd = lpms16->hwnd;
+            lpms32->hwnd = WIN_Handle32(lpms16->hwnd);
             *plParam = (LPARAM)lpms32;
 	    break;
         } 
@@ -314,7 +314,7 @@
                        HeapFree( GetProcessHeap(), 0, (LPWSTR)lpcbtcw32->lpcs->lpszClass );
 		}
 
-		lpcbtcw16->hwndInsertAfter = lpcbtcw32->hwndInsertAfter;
+		lpcbtcw16->hwndInsertAfter = WIN_Handle16( lpcbtcw32->hwndInsertAfter );
 
 		HeapFree( GetProcessHeap(), 0, lpcbtcw32->lpcs );
 	      } /* fall through */
@@ -406,7 +406,7 @@
           LPCWPSTRUCT   lpcwp32 = (LPCWPSTRUCT)*plParam;
 	  LPCWPSTRUCT16   lpcwp16 = SEGPTR_NEW( CWPSTRUCT16 );
 
-          lpcwp16->hwnd = lpcwp32->hwnd;
+          lpcwp16->hwnd = WIN_Handle16(lpcwp32->hwnd);
           lpcwp16->lParam = lpcwp32->lParam;
 
           if (bA) WINPROC_MapMsg32ATo16( lpcwp32->hwnd, lpcwp32->message,
@@ -428,7 +428,7 @@
 	      LPCBTACTIVATESTRUCT16 lpcas16 =SEGPTR_NEW( CBTACTIVATESTRUCT16 );
 
 	      lpcas16->fMouse     = lpcas32->fMouse;
-	      lpcas16->hWndActive = lpcas32->hWndActive;
+	      lpcas16->hWndActive = WIN_Handle16( lpcas32->hWndActive );
 
 	      *plParam = (LPARAM)SEGPTR_GET( lpcas16 );
 	      break;
@@ -441,7 +441,7 @@
 
 	      CONV_POINT32TO16( &lpms32->pt, &lpms16->pt );
 
-	      lpms16->hwnd         = lpms32->hwnd;
+	      lpms16->hwnd         = WIN_Handle16( lpms32->hwnd );
 	      lpms16->wHitTestCode = lpms32->wHitTestCode;
 	      lpms16->dwExtraInfo  = lpms32->dwExtraInfo;
 
@@ -469,7 +469,7 @@
 
 	  CONV_POINT32TO16( &lpms32->pt, &lpms16->pt );
 
-	  lpms16->hwnd = lpms32->hwnd;
+	  lpms16->hwnd = WIN_Handle16( lpms32->hwnd );
 	  lpms16->wHitTestCode = lpms32->wHitTestCode;
 	  lpms16->dwExtraInfo = lpms32->dwExtraInfo;
 
@@ -531,7 +531,7 @@
 	else
 	  lpcs16->lpszClass = (SEGPTR)lpcbtcw32->lpcs->lpszClass;
 
-	lpcbtcw16->hwndInsertAfter = lpcbtcw32->hwndInsertAfter;
+	lpcbtcw16->hwndInsertAfter = WIN_Handle16( lpcbtcw32->hwndInsertAfter );
 
 	*plParam = (LPARAM)SEGPTR_GET( lpcbtcw16 );
     }
@@ -560,7 +560,7 @@
         cls  = SEGPTR_STRDUP_WtoA( lpcbtcw32->lpcs->lpszClass );
         lpcs16->lpszName  = SEGPTR_GET( name );
         lpcs16->lpszClass = SEGPTR_GET( cls );
-	lpcbtcw16->hwndInsertAfter = lpcbtcw32->hwndInsertAfter;
+        lpcbtcw16->hwndInsertAfter = WIN_Handle16( lpcbtcw32->hwndInsertAfter );
 
 	*plParam = (LPARAM)SEGPTR_GET( lpcbtcw16 );
     }
@@ -628,7 +628,7 @@
                if (HIWORD(lpcs16->lpszClass))
                    SEGPTR_FREE( MapSL(lpcs16->lpszClass) );
 
-	       lpcbtcw32->hwndInsertAfter = lpcbtcw16->hwndInsertAfter;
+               lpcbtcw32->hwndInsertAfter = WIN_Handle32( lpcbtcw16->hwndInsertAfter );
 
                SEGPTR_FREE( lpcs16 );
 	  } /* fall through */
@@ -1372,24 +1372,23 @@
         MSG msg32;
         BOOL16 ret;
 
-        msg32.hwnd		= lpmsg16_32->msg.hwnd;
-        msg32.message	= lpmsg16_32->msg.message;
-        msg32.wParam	=
-                     MAKELONG(lpmsg16_32->msg.wParam, lpmsg16_32->wParamHigh);
-        msg32.lParam	= lpmsg16_32->msg.lParam;
-        msg32.time		= lpmsg16_32->msg.time;
-        msg32.pt.x		= (INT)lpmsg16_32->msg.pt.x;
-        msg32.pt.y      = (INT)lpmsg16_32->msg.pt.y;
-        
+        msg32.hwnd      = WIN_Handle32( lpmsg16_32->msg.hwnd );
+        msg32.message   = lpmsg16_32->msg.message;
+        msg32.wParam    = MAKELONG(lpmsg16_32->msg.wParam, lpmsg16_32->wParamHigh);
+        msg32.lParam    = lpmsg16_32->msg.lParam;
+        msg32.time      = lpmsg16_32->msg.time;
+        msg32.pt.x      = lpmsg16_32->msg.pt.x;
+        msg32.pt.y      = lpmsg16_32->msg.pt.y;
+
         ret = (BOOL16)CallMsgFilterA(&msg32, (INT)code);
 
-        lpmsg16_32->msg.hwnd    = msg32.hwnd;
+        lpmsg16_32->msg.hwnd    = WIN_Handle16( msg32.hwnd );
         lpmsg16_32->msg.message = msg32.message;
         lpmsg16_32->msg.wParam  = LOWORD(msg32.wParam);
         lpmsg16_32->msg.lParam  = msg32.lParam;
         lpmsg16_32->msg.time    = msg32.time;
-        lpmsg16_32->msg.pt.x    = (INT16)msg32.pt.x;
-        lpmsg16_32->msg.pt.y    = (INT16)msg32.pt.y;
+        lpmsg16_32->msg.pt.x    = msg32.pt.x;
+        lpmsg16_32->msg.pt.y    = msg32.pt.y;
         lpmsg16_32->wParamHigh  = HIWORD(msg32.wParam);
 
         return ret;
diff --git a/windows/input.c b/windows/input.c
index 018e669..9887b6d 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -351,7 +351,7 @@
             InputKeyStateTable[VK_CONTROL]             = (keyState & MK_CONTROL ? 0x80 : 0);
         }
         input.u.mi.time = wme->time;
-        input.u.mi.dwExtraInfo = wme->hWnd;
+        input.u.mi.dwExtraInfo = (ULONG_PTR)wme->hWnd;
         queue_mouse_event( &input.u.mi, keyState );
     }
     else
@@ -526,7 +526,7 @@
         }
 
         PERQDATA_SetCaptureWnd( captureWnd, captureHT );
-        if (capturePrev) SendMessageA( capturePrev, WM_CAPTURECHANGED, 0, hwnd );
+        if (capturePrev) SendMessageA( capturePrev, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );
     }
 
 CLEANUP:
@@ -540,15 +540,6 @@
 
 
 /**********************************************************************
- *		SetCapture (USER.18)
- */
-HWND16 WINAPI SetCapture16( HWND16 hwnd )
-{
-    return (HWND16)EVENT_Capture( hwnd, HTCLIENT );
-}
-
-
-/**********************************************************************
  *		SetCapture (USER32.@)
  */
 HWND WINAPI SetCapture( HWND hwnd )
@@ -558,7 +549,6 @@
 
 
 /**********************************************************************
- *		ReleaseCapture (USER.19)
  *		ReleaseCapture (USER32.@)
  */
 BOOL WINAPI ReleaseCapture(void)
@@ -568,14 +558,6 @@
 
 
 /**********************************************************************
- *		GetCapture (USER.236)
- */
-HWND16 WINAPI GetCapture16(void)
-{
-    return (HWND16)GetCapture();
-}
-
-/**********************************************************************
  *		GetCapture (USER32.@)
  */
 HWND WINAPI GetCapture(void)
diff --git a/windows/mdi.c b/windows/mdi.c
index 6822b41..9ce4d2e 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -550,10 +550,10 @@
         cs16->szTitle = SEGPTR_GET(title);
         cs16->szClass = SEGPTR_GET(cls);
 
-	hwnd = CreateWindow16( cs->szClass, cs->szTitle, style, 
-			       cs16->x, cs16->y, cs16->cx, cs16->cy, parent,
-			       (HMENU)wIDmenu, cs16->hOwner,
-                               (LPVOID)SEGPTR_GET(cs16) );
+        hwnd = WIN_Handle32( CreateWindow16( cs->szClass, cs->szTitle, style,
+                                             cs16->x, cs16->y, cs16->cx, cs16->cy,
+                                             WIN_Handle16(parent), (HMENU)wIDmenu,
+                                             cs16->hOwner, (LPVOID)SEGPTR_GET(cs16) ));
         SEGPTR_FREE( title );
         SEGPTR_FREE( cls );
         SEGPTR_FREE( cs16 );
@@ -1287,16 +1287,16 @@
         return MDICascade(hwnd, ci);
 
       case WM_MDICREATE:
-        if (lParam) return MDICreateChild( hwnd, ci,
-                                           (MDICREATESTRUCTA *)lParam, unicode );
-        else return 0;
+        if (lParam)
+            return (LRESULT)MDICreateChild( hwnd, ci, (MDICREATESTRUCTA *)lParam, unicode );
+        return 0;
 
       case WM_MDIDESTROY:
           return MDIDestroyChild( hwnd, ci, WIN_GetFullHandle( (HWND)wParam ), TRUE );
 
       case WM_MDIGETACTIVE:
           if (lParam) *(BOOL *)lParam = (ci->hwndChildMaximized != 0);
-          return ci->hwndActiveChild;
+          return (LRESULT)ci->hwndActiveChild;
 
       case WM_MDIICONARRANGE:
 	ci->mdiFlags |= MDIF_NEEDUPDATE;
@@ -1423,19 +1423,21 @@
     switch (message)
     {
     case WM_SETTEXT:
-        return DefFrameProcA( hwnd, hwndMDIClient, message, wParam, (LPARAM)MapSL(lParam) );
-
+        lParam = (LPARAM)MapSL(lParam);
+        /* fall through */
     case WM_COMMAND:
     case WM_NCACTIVATE:
     case WM_SETFOCUS:
     case WM_SIZE:
-        return DefFrameProcW( hwnd, hwndMDIClient, message, wParam, lParam );
+        return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
+                              message, wParam, lParam );
 
     case WM_NEXTMENU:
         {
             MDINEXTMENU next_menu;
-            DefFrameProcW( hwnd, hwndMDIClient, message, wParam, (LPARAM)&next_menu );
-            return MAKELONG( next_menu.hmenuNext, next_menu.hwndNext );
+            DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
+                           message, wParam, (LPARAM)&next_menu );
+            return MAKELONG( next_menu.hmenuNext, WIN_Handle16(next_menu.hwndNext) );
         }
     default:
         return DefWindowProc16(hwnd, message, wParam, lParam);
@@ -1600,7 +1602,7 @@
         {
             MDINEXTMENU next_menu;
             DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
-            return MAKELONG( next_menu.hmenuNext, next_menu.hwndNext );
+            return MAKELONG( next_menu.hmenuNext, WIN_Handle16(next_menu.hwndNext) );
         }
     default:
         return DefWindowProc16(hwnd, message, wParam, lParam);
@@ -1875,24 +1877,6 @@
 }
 
 /**********************************************************************
- *		TranslateMDISysAccel (USER.451)
- */
-BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
-{
-    if (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
-    {
-        MSG msg32;
-        msg32.hwnd    = msg->hwnd;
-        msg32.message = msg->message;
-        msg32.wParam  = msg->wParam;
-        msg32.lParam  = msg->lParam;
-        /* MDICLIENTINFO is still the same for win32 and win16 ... */
-        return TranslateMDISysAccel(hwndClient, &msg32);
-    }
-    return 0;
-}
-
-/**********************************************************************
  *		TranslateMDISysAccel (USER32.@)
  */
 BOOL WINAPI TranslateMDISysAccel( HWND hwndClient, LPMSG msg )
@@ -1930,14 +1914,6 @@
 }
 
 /***********************************************************************
- *		CalcChildScroll (USER.462)
- */
-void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
-{
-    return CalcChildScroll( hwnd, scroll );
-}
-
-/***********************************************************************
  *		CalcChildScroll (USER32.@)
  */
 void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
@@ -1998,15 +1974,6 @@
 
 
 /***********************************************************************
- *		ScrollChildren (USER.463)
- */
-void WINAPI ScrollChildren16(HWND16 hWnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
-{
-    ScrollChildren( hWnd, uMsg, wParam, lParam );
-}
-
-
-/***********************************************************************
  *		ScrollChildren (USER32.@)
  */
 void WINAPI ScrollChildren(HWND hWnd, UINT uMsg, WPARAM wParam,
@@ -2196,9 +2163,8 @@
                      */
                     HWND hListBox     = GetDlgItem(hDlg, MDI_IDC_LISTBOX);
                     UINT index        = SendMessageW(hListBox, LB_GETCURSEL, 0, 0);
-                    HWND hwnd         = SendMessageW(hListBox, LB_GETITEMDATA, index, 0);
-
-                    EndDialog(hDlg, hwnd);
+                    LRESULT res = SendMessageW(hListBox, LB_GETITEMDATA, index, 0);
+                    EndDialog(hDlg, res);
                     return TRUE;
                 }
                 case IDCANCEL:
diff --git a/windows/msgbox.c b/windows/msgbox.c
index f4616f2..df922c4 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -265,16 +265,6 @@
 
 
 /**************************************************************************
- *		MessageBox (USER.1)
- */
-INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type)
-{
-    WARN("Messagebox\n");
-    return MessageBoxA( hwnd, text, title, type );
-}
-
-
-/**************************************************************************
  *		MessageBoxA (USER32.@)
  *
  * NOTES
@@ -347,38 +337,6 @@
 }
 
 /**************************************************************************
- *		MessageBoxIndirect (USER.827)
- */
-INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
-{
-    LPVOID template;
-    HRSRC hRes;
-    MSGBOXPARAMSA msgbox32;
-
-    WARN("Messagebox\n");    
-    
-    if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA)))
-        return 0;
-    if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes)))
-        return 0;
-
-    msgbox32.cbSize		= msgbox->cbSize;
-    msgbox32.hwndOwner		= msgbox->hwndOwner;
-    msgbox32.hInstance		= msgbox->hInstance;
-    msgbox32.lpszText		= MapSL(msgbox->lpszText);
-    msgbox32.lpszCaption	= MapSL(msgbox->lpszCaption);
-    msgbox32.dwStyle		= msgbox->dwStyle;
-    msgbox32.lpszIcon		= MapSL(msgbox->lpszIcon);
-    msgbox32.dwContextHelpId	= msgbox->dwContextHelpId;
-    msgbox32.lpfnMsgBoxCallback	= msgbox->lpfnMsgBoxCallback;
-    msgbox32.dwLanguageId	= msgbox->dwLanguageId;
-
-    return DialogBoxIndirectParamA( msgbox32.hInstance, template,
-                                      msgbox32.hwndOwner, (DLGPROC)MSGBOX_DlgProc,
-                                      (LPARAM)&msgbox32 );
-}
-
-/**************************************************************************
  *		MessageBoxIndirectA (USER32.@)
  */
 INT WINAPI MessageBoxIndirectA( LPMSGBOXPARAMSA msgbox )
diff --git a/windows/nonclient.c b/windows/nonclient.c
index c3bb72d..1ed679f 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -237,33 +237,6 @@
 }
 
 /***********************************************************************
- *		DrawCaption (USER.660) Draws a caption bar
- *
- * PARAMS
- *     hwnd   [I]
- *     hdc    [I]
- *     lpRect [I]
- *     uFlags [I]
- *
- * RETURNS
- *     Success:
- *     Failure:
- */
-
-BOOL16 WINAPI
-DrawCaption16 (HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 uFlags)
-{
-    RECT rect32;
-
-    if (rect)
-	CONV_RECT16TO32 (rect, &rect32);
-
-    return (BOOL16)DrawCaptionTempA (hwnd, hdc, rect ? &rect32 : NULL,
-				       0, 0, NULL, uFlags & 0x1F);
-}
-
-
-/***********************************************************************
  *		DrawCaption (USER32.@) Draws a caption bar
  *
  * PARAMS
@@ -285,30 +258,6 @@
 
 
 /***********************************************************************
- *		DrawCaptionTemp (USER.657)
- *
- * PARAMS
- *
- * RETURNS
- *     Success:
- *     Failure:
- */
-
-BOOL16 WINAPI
-DrawCaptionTemp16 (HWND16 hwnd, HDC16 hdc, const RECT16 *rect, HFONT16 hFont,
-		   HICON16 hIcon, LPCSTR str, UINT16 uFlags)
-{
-    RECT rect32;
-
-    if (rect)
-	CONV_RECT16TO32(rect,&rect32);
-
-    return (BOOL16)DrawCaptionTempA (hwnd, hdc, rect?&rect32:NULL, hFont,
-				       hIcon, str, uFlags & 0x1F);
-}
-
-
-/***********************************************************************
  *		DrawCaptionTempA (USER32.@)
  *
  * PARAMS
diff --git a/windows/painting.c b/windows/painting.c
index ffcd643..af15f71 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -42,9 +42,6 @@
   /* Last COLOR id */
 #define COLOR_MAX   COLOR_GRADIENTINACTIVECAPTION
 
-  /* Last CTLCOLOR id */
-#define CTLCOLOR_MAX   CTLCOLOR_STATIC
-
 
 /***********************************************************************
  *           add_paint_count
@@ -284,11 +281,11 @@
 /***********************************************************************
  *		BeginPaint (USER.39)
  */
-HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps ) 
+HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
 {
     PAINTSTRUCT ps;
 
-    BeginPaint( hwnd, &ps );
+    BeginPaint( WIN_Handle32(hwnd), &ps );
     lps->hdc            = ps.hdc;
     lps->fErase         = ps.fErase;
     lps->rcPaint.top    = ps.rcPaint.top;
@@ -401,7 +398,7 @@
 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
 {
     ReleaseDC16( hwnd, lps->hdc );
-    ShowCaret( hwnd );
+    ShowCaret16( hwnd );
     return TRUE;
 }
 
@@ -418,66 +415,6 @@
 
 
 /***********************************************************************
- *		FillWindow (USER.324)
- */
-void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
-{
-    RECT rect;
-    RECT16 rc16;
-    GetClientRect( hwnd, &rect );
-    DPtoLP( hdc, (LPPOINT)&rect, 2 );
-    CONV_RECT32TO16( &rect, &rc16 );
-    PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
-}
-
-
-/***********************************************************************
- *	     PAINT_GetControlBrush
- */
-static HBRUSH16 PAINT_GetControlBrush( HWND hParent, HWND hWnd, HDC16 hDC, UINT16 ctlType )
-{
-    HBRUSH16 bkgBrush = (HBRUSH16)SendMessageA( hParent, WM_CTLCOLORMSGBOX + ctlType, 
-							     (WPARAM)hDC, (LPARAM)hWnd );
-    if( !IsGDIObject16(bkgBrush) )
-	bkgBrush = DEFWND_ControlColor( hDC, ctlType );
-    return bkgBrush;
-}
-
-
-/***********************************************************************
- *		PaintRect (USER.325)
- */
-void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
-                       HBRUSH16 hbrush, const RECT16 *rect)
-{
-    if( hbrush <= CTLCOLOR_MAX ) 
-    {
-	if( hwndParent )
-	    hbrush = PAINT_GetControlBrush( hwndParent, hwnd, hdc, (UINT16)hbrush );
-	else 
-	    return;
-    }
-    if( hbrush ) 
-	FillRect16( hdc, rect, hbrush );
-}
-
-
-/***********************************************************************
- *		GetControlBrush (USER.326)
- */
-HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
-{
-    if (ctlType <= CTLCOLOR_MAX)
-    {
-        HWND16 parent = GetParent16( hwnd );
-        if (!parent) parent = hwnd;
-        return PAINT_GetControlBrush( parent, hwnd, hdc, ctlType );
-    }
-    return 0;
-}
-
-
-/***********************************************************************
  * 		RDW_ValidateParent [RDW_UpdateRgns() helper] 
  *
  *  Validate the portions of parents that are covered by a validated child
@@ -975,30 +912,6 @@
 
 
 /***********************************************************************
- *		RedrawWindow (USER.290)
- */
-BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
-                              HRGN16 hrgnUpdate, UINT16 flags )
-{
-    if (rectUpdate)
-    {
-        RECT r;
-        CONV_RECT16TO32( rectUpdate, &r );
-        return (BOOL16)RedrawWindow( (HWND)hwnd, &r, hrgnUpdate, flags );
-    }
-    return RedrawWindow( hwnd, NULL, hrgnUpdate, flags );
-}
-
-
-/***********************************************************************
- *		UpdateWindow (USER.124)
- */
-void WINAPI UpdateWindow16( HWND16 hwnd )
-{
-    RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
-}
-
-/***********************************************************************
  *		UpdateWindow (USER32.@)
  */
 void WINAPI UpdateWindow( HWND hwnd )
@@ -1006,14 +919,6 @@
     RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
 }
 
-/***********************************************************************
- *		InvalidateRgn (USER.126)
- */
-void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
-{
-    RedrawWindow((HWND)hwnd, NULL, (HRGN)hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
-}
-
 
 /***********************************************************************
  *		InvalidateRgn (USER32.@)
@@ -1025,15 +930,6 @@
 
 
 /***********************************************************************
- *		InvalidateRect (USER.125)
- */
-void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
-{
-    RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
-}
-
-
-/***********************************************************************
  *		InvalidateRect (USER32.@)
  */
 BOOL WINAPI InvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
@@ -1043,15 +939,6 @@
 
 
 /***********************************************************************
- *		ValidateRgn (USER.128)
- */
-void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
-{
-    RedrawWindow( (HWND)hwnd, NULL, (HRGN)hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
-}
-
-
-/***********************************************************************
  *		ValidateRgn (USER32.@)
  */
 void WINAPI ValidateRgn( HWND hwnd, HRGN hrgn )
@@ -1061,15 +948,6 @@
 
 
 /***********************************************************************
- *		ValidateRect (USER.127)
- */
-void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
-{
-    RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
-}
-
-
-/***********************************************************************
  *		ValidateRect (USER32.@)
  */
 void WINAPI ValidateRect( HWND hwnd, const RECT *rect )
@@ -1079,21 +957,6 @@
 
 
 /***********************************************************************
- *		GetUpdateRect (USER.190)
- */
-BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
-{
-    RECT r;
-    BOOL16 ret;
-
-    if (!rect) return GetUpdateRect( hwnd, NULL, erase );
-    ret = GetUpdateRect( hwnd, &r, erase );
-    CONV_RECT32TO16( &r, rect );
-    return ret;
-}
-
-
-/***********************************************************************
  *		GetUpdateRect (USER32.@)
  */
 BOOL WINAPI GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
@@ -1139,15 +1002,6 @@
 
 
 /***********************************************************************
- *		GetUpdateRgn (USER.237)
- */
-INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
-{
-    return GetUpdateRgn( hwnd, hrgn, erase );
-}
-
-
-/***********************************************************************
  *		GetUpdateRgn (USER32.@)
  */
 INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
@@ -1183,15 +1037,6 @@
 
 
 /***********************************************************************
- *		ExcludeUpdateRgn (USER.238)
- */
-INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
-{
-    return ExcludeUpdateRgn( hdc, hwnd );
-}
-
-
-/***********************************************************************
  *		ExcludeUpdateRgn (USER32.@)
  */
 INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
@@ -1366,28 +1211,6 @@
     return TRUE;
 }
 
-/**********************************************************************
- *		DrawAnimatedRects (USER.448)
- */
-BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
-                                   const RECT16* lprcFrom,
-                                   const RECT16* lprcTo )
-{
-    RECT rcFrom32, rcTo32;
-
-    rcFrom32.left	= (INT)lprcFrom->left;
-    rcFrom32.top	= (INT)lprcFrom->top;
-    rcFrom32.right	= (INT)lprcFrom->right;
-    rcFrom32.bottom	= (INT)lprcFrom->bottom;
-
-    rcTo32.left		= (INT)lprcTo->left;
-    rcTo32.top		= (INT)lprcTo->top;
-    rcTo32.right	= (INT)lprcTo->right;
-    rcTo32.bottom	= (INT)lprcTo->bottom;
-
-    return DrawAnimatedRects((HWND)hwnd, (INT)idAni, &rcFrom32, &rcTo32);
-}
-
 
 /**********************************************************************
  *		DrawAnimatedRects (USER32.@)
@@ -1681,7 +1504,7 @@
     {
         /* send palette change notification */
         HWND hWnd = WindowFromDC( hDC );
-        if (hWnd) SendMessageA( HWND_BROADCAST, WM_PALETTECHANGED, hWnd, 0L);
+        if (hWnd) SendMessageA( HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0L);
     }
     return realized;
 }
diff --git a/windows/property.c b/windows/property.c
index 4515ca9..7157d40 100644
--- a/windows/property.c
+++ b/windows/property.c
@@ -68,15 +68,6 @@
 
 
 /***********************************************************************
- *		GetProp (USER.25)
- */
-HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
-{
-    return (HANDLE16)GetPropA( hwnd, str );
-}
-
-
-/***********************************************************************
  *		GetPropA (USER32.@)
  */
 HANDLE WINAPI GetPropA( HWND hwnd, LPCSTR str )
@@ -111,15 +102,6 @@
 
 
 /***********************************************************************
- *		SetProp (USER.26)
- */
-BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
-{
-    return (BOOL16)SetPropA( hwnd, str, handle );
-}
-
-
-/***********************************************************************
  *		SetPropA (USER32.@)
  */
 BOOL WINAPI SetPropA( HWND hwnd, LPCSTR str, HANDLE handle )
@@ -176,15 +158,6 @@
 
 
 /***********************************************************************
- *		RemoveProp (USER.24)
- */
-HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
-{
-    return (HANDLE16)RemovePropA( hwnd, str );
-}
-
-
-/***********************************************************************
  *		RemovePropA (USER32.@)
  */
 HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
@@ -282,7 +255,7 @@
     INT16 ret = -1;
 
     TRACE("%04x %08x\n", hwnd, (UINT)func );
-    if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
+    if (!(pWnd = WIN_FindWndPtr16( hwnd ))) return -1;
     for (prop = pWnd->pProp; (prop); prop = next)
     {
         /* Already get the next in case the callback */
diff --git a/windows/queue.c b/windows/queue.c
index 881baa9..b958520 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -463,7 +463,7 @@
     HTASK16 retvalue;
     MESSAGEQUEUE *queue;
 
-    WND *wndPtr = WIN_FindWndPtr( hwnd );
+    WND *wndPtr = WIN_FindWndPtr16( hwnd );
     if (!wndPtr) return 0;
 
     queue = QUEUE_Lock( wndPtr->hmemTaskQ );
diff --git a/windows/scroll.c b/windows/scroll.c
index bf094eb..84e2391 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -19,20 +19,6 @@
 DEFAULT_DEBUG_CHANNEL(scroll);
 
 /*************************************************************************
- *		ScrollWindow (USER.61)
- */
-void WINAPI ScrollWindow16(HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
-                           const RECT16 *clipRect )
-{
-    RECT rect32, clipRect32;
-
-    if (rect) CONV_RECT16TO32( rect, &rect32 );
-    if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
-    ScrollWindow( hwnd, dx, dy, rect ? &rect32 : NULL,
-                    clipRect ? &clipRect32 : NULL );
-}
-
-/*************************************************************************
  *		ScrollWindow (USER32.@)
  *
  */
@@ -82,27 +68,6 @@
 
 
 /*************************************************************************
- *		ScrollWindowEx (USER.319)
- */
-INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
-                               const RECT16 *rect, const RECT16 *clipRect,
-                               HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
-                               UINT16 flags )
-{
-    RECT rect32, clipRect32, rcUpdate32;
-    BOOL16 ret;
-
-    if (rect) CONV_RECT16TO32( rect, &rect32 );
-    if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
-    ret = ScrollWindowEx( hwnd, dx, dy, rect ? &rect32 : NULL,
-                            clipRect ? &clipRect32 : NULL, hrgnUpdate,
-                            (rcUpdate) ? &rcUpdate32 : NULL, flags );
-    if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate );
-    return ret;
-}
-
-
-/*************************************************************************
  *		ScrollWindowEx (USER32.@)
  *
  * NOTE: Use this function instead of ScrollWindow32
diff --git a/windows/spy.c b/windows/spy.c
index 1a39607..41d5ee0 100644
--- a/windows/spy.c
+++ b/windows/spy.c
@@ -1956,8 +1956,8 @@
     {
     case SPY_DISPATCHMESSAGE16:
         TRACE("%*s(%04x) %-16s message [%04x] %s dispatched  wp=%04x lp=%08lx\n",
-                        SPY_IndentLevel, "", hWnd, sp_e.wnd_name, msg,
-                        sp_e.msg_name, wParam, lParam);
+              SPY_IndentLevel, "", WIN_Handle16(hWnd),
+              sp_e.wnd_name, msg, sp_e.msg_name, wParam, lParam);
         break;
 
     case SPY_DISPATCHMESSAGE:
@@ -1970,7 +1970,7 @@
     case SPY_SENDMESSAGE:
         {
             char taskName[30];
-            HTASK16 hTask = GetWindowTask16(hWnd);
+            HTASK16 hTask = GetWindowTask16( WIN_Handle16(hWnd) );
 
             if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
             else if (!hTask) strcpy( taskName, "Wine" );
@@ -1982,8 +1982,8 @@
 
             if (iFlag == SPY_SENDMESSAGE16)
                 TRACE("%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
-			     SPY_IndentLevel, "", hWnd, sp_e.wnd_name, msg, 
-			     sp_e.msg_name, taskName, wParam, lParam );
+                      SPY_IndentLevel, "", WIN_Handle16(hWnd), sp_e.wnd_name, msg,
+                      sp_e.msg_name, taskName, wParam, lParam );
             else
             {   TRACE("%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n",
 			     SPY_IndentLevel, "", hWnd, sp_e.wnd_name, msg,
@@ -1996,8 +1996,7 @@
     case SPY_DEFWNDPROC16:
 	if( SPY_ExcludeDWP ) return;
         TRACE("%*s(%04x)  DefWindowProc16: %s [%04x]  wp=%04x lp=%08lx\n",
-                        SPY_IndentLevel, "", hWnd, sp_e.msg_name,
-                        msg, wParam, lParam );
+              SPY_IndentLevel, "", WIN_Handle16(hWnd), sp_e.msg_name, msg, wParam, lParam );
         break;
 
     case SPY_DEFWNDPROC:
@@ -2036,7 +2035,7 @@
     {
     case SPY_RESULT_DEFWND16:
 	TRACE(" %*s(%04x)  DefWindowProc16: %s [%04x] returned %08lx\n",
-			SPY_IndentLevel, "", hWnd, sp_e.msg_name, msg, lReturn );
+              SPY_IndentLevel, "", WIN_Handle16(hWnd), sp_e.msg_name, msg, lReturn );
 	break;
 
     case SPY_RESULT_DEFWND:
@@ -2046,8 +2045,8 @@
 
     case SPY_RESULT_OK16:
         TRACE(" %*s(%04x) %-16s message [%04x] %s returned %08lx\n",
-                        SPY_IndentLevel, "", hWnd, sp_e.wnd_name, msg,
-                        sp_e.msg_name, lReturn );
+              SPY_IndentLevel, "", WIN_Handle16(hWnd), sp_e.wnd_name, msg,
+              sp_e.msg_name, lReturn );
         break;
 
     case SPY_RESULT_OK:
@@ -2059,8 +2058,7 @@
 
     case SPY_RESULT_INVALIDHWND16:
         WARN(" %*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
-                        SPY_IndentLevel, "", hWnd, sp_e.wnd_name, msg,
-                        sp_e.msg_name );
+             SPY_IndentLevel, "", WIN_Handle16(hWnd), sp_e.wnd_name, msg, sp_e.msg_name );
         break;
 
     case SPY_RESULT_INVALIDHWND:
diff --git a/windows/struct32.c b/windows/struct32.c
index 853ab1f..3638b5f 100644
--- a/windows/struct32.c
+++ b/windows/struct32.c
@@ -5,11 +5,12 @@
  */
 
 #include "struct32.h"
+#include "win.h"
 #include "winerror.h"
 
 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG *msg32)
 {
-	msg32->hwnd=(HWND)msg16->hwnd;
+	msg32->hwnd = WIN_Handle32(msg16->hwnd);
 	msg32->message=msg16->message;
 	msg32->wParam=msg16->wParam;
 	msg32->lParam=msg16->lParam;
@@ -20,7 +21,7 @@
 
 void STRUCT32_MSG32to16(const MSG *msg32,MSG16 *msg16)
 {
-	msg16->hwnd=(HWND16)msg32->hwnd;
+	msg16->hwnd = WIN_Handle16(msg32->hwnd);
 	msg16->message=msg32->message;
 	msg16->wParam=msg32->wParam;
 	msg16->lParam=msg32->lParam;
@@ -49,24 +50,25 @@
 
 void STRUCT32_WINDOWPOS32to16( const WINDOWPOS* from, WINDOWPOS16* to )
 {
-    to->hwnd            = (HWND16)from->hwnd;
-    to->hwndInsertAfter = (HWND16)from->hwndInsertAfter;
-    to->x               = (INT16)from->x;
-    to->y               = (INT16)from->y;
-    to->cx              = (INT16)from->cx;
-    to->cy              = (INT16)from->cy;
-    to->flags           = (UINT16)from->flags;
+    to->hwnd            = WIN_Handle16(from->hwnd);
+    to->hwndInsertAfter = WIN_Handle16(from->hwndInsertAfter);
+    to->x               = from->x;
+    to->y               = from->y;
+    to->cx              = from->cx;
+    to->cy              = from->cy;
+    to->flags           = from->flags;
 }
 
 void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS* to )
 {
-    to->hwnd            = (HWND)from->hwnd;
-    to->hwndInsertAfter = (HWND)from->hwndInsertAfter;
-    to->x               = (INT)from->x;
-    to->y               = (INT)from->y;
-    to->cx              = (INT)from->cx;
-    to->cy              = (INT)from->cy;
-    to->flags           = (UINT)from->flags;
+    to->hwnd            = WIN_Handle32(from->hwnd);
+    to->hwndInsertAfter = (from->hwndInsertAfter == (HWND16)-1) ?
+                           HWND_TOPMOST : WIN_Handle32(from->hwndInsertAfter);
+    to->x               = from->x;
+    to->y               = from->y;
+    to->cx              = from->cx;
+    to->cy              = from->cy;
+    to->flags           = from->flags;
 }
 
 /* The strings are not copied */
@@ -76,11 +78,11 @@
     to->lpCreateParams = from->lpCreateParams;
     to->hInstance      = (HINSTANCE16)from->hInstance;
     to->hMenu          = (HMENU16)from->hMenu;
-    to->hwndParent     = (HWND16)from->hwndParent;
-    to->cy             = (INT16)from->cy;
-    to->cx             = (INT16)from->cx;
-    to->y              = (INT16)from->y;
-    to->x              = (INT16)from->x;
+    to->hwndParent     = WIN_Handle16(from->hwndParent);
+    to->cy             = from->cy;
+    to->cx             = from->cx;
+    to->y              = from->y;
+    to->x              = from->x;
     to->style          = from->style;
     to->dwExStyle      = from->dwExStyle;
 }
@@ -91,11 +93,11 @@
     to->lpCreateParams = from->lpCreateParams;
     to->hInstance      = (HINSTANCE)from->hInstance;
     to->hMenu          = (HMENU)from->hMenu;
-    to->hwndParent     = (HWND)from->hwndParent;
-    to->cy             = (INT)from->cy;
-    to->cx             = (INT)from->cx;
-    to->y              = (INT)from->y;
-    to->x              = (INT)from->x;
+    to->hwndParent     = WIN_Handle32(from->hwndParent);
+    to->cy             = from->cy;
+    to->cx             = from->cx;
+    to->y              = from->y;
+    to->x              = from->x;
     to->style          = from->style;
     to->dwExStyle      = from->dwExStyle;
 }
@@ -105,11 +107,11 @@
                                       MDICREATESTRUCT16* to )
 {
     to->hOwner = (HINSTANCE16)from->hOwner;
-    to->x      = (INT16)from->x;     
-    to->y      = (INT16)from->y;     
-    to->cx     = (INT16)from->cx;    
-    to->cy     = (INT16)from->cy;    
-    to->style  = from->style; 
+    to->x      = from->x;
+    to->y      = from->y;
+    to->cx     = from->cx;
+    to->cy     = from->cy;
+    to->style  = from->style;
     to->lParam = from->lParam;
 }
 
@@ -117,11 +119,11 @@
                                       MDICREATESTRUCTA *to )
 {
     to->hOwner = (HINSTANCE)from->hOwner;
-    to->x      = (INT)from->x;     
-    to->y      = (INT)from->y;     
-    to->cx     = (INT)from->cx;    
-    to->cy     = (INT)from->cy;    
-    to->style  = from->style; 
+    to->x      = from->x;
+    to->y      = from->y;
+    to->cx     = from->cx;
+    to->cy     = from->cy;
+    to->style  = from->style;
     to->lParam = from->lParam;
 }
 
diff --git a/windows/timer.c b/windows/timer.c
index d40b2b3..f0651a2 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -300,16 +300,6 @@
 
 
 /***********************************************************************
- *		KillTimer (USER.12)
- */
-BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
-{
-    TRACE("%04x %d\n", hwnd, id );
-    return TIMER_KillTimer( hwnd, id, FALSE );
-}
-
-
-/***********************************************************************
  *		KillTimer (USER32.@)
  */
 BOOL WINAPI KillTimer( HWND hwnd, UINT id )
@@ -320,16 +310,6 @@
 
 
 /***********************************************************************
- *		KillSystemTimer (USER.182)
- */
-BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
-{
-    TRACE("%04x %d\n", hwnd, id );
-    return TIMER_KillTimer( hwnd, id, TRUE );
-}
-
-
-/***********************************************************************
  *		KillSystemTimer (USER32.@)
  */
 BOOL WINAPI KillSystemTimer( HWND hwnd, UINT id )
diff --git a/windows/win.c b/windows/win.c
index 5684fb9..9aa8dd3 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -34,8 +34,6 @@
 /* Desktop window */
 static WND *pWndDesktop = NULL;
 
-static HWND hwndSysModal = 0;
-
 static WORD wDragWidth = 4;
 static WORD wDragHeight= 3;
 
@@ -80,7 +78,7 @@
 static WND *create_window_handle( BOOL desktop, INT size )
 {
     BOOL res;
-    unsigned int handle = 0;
+    user_handle_t handle = 0;
     WND *win = HeapAlloc( GetProcessHeap(), 0, size );
 
     if (!win) return NULL;
@@ -111,7 +109,7 @@
         return NULL;
     }
     user_handles[LOWORD(handle)] = win;
-    win->hwndSelf = (HWND)handle;
+    win->hwndSelf = handle;
     win->dwMagic = WND_MAGIC;
     win->irefCount = 1;
     return win;
@@ -177,9 +175,11 @@
 HWND WIN_Handle32( HWND16 hwnd16 )
 {
     WND *ptr;
-    HWND hwnd = (HWND)hwnd16;
+    HWND hwnd = (HWND)(ULONG_PTR)hwnd16;
 
-    if (!hwnd || hwnd == HWND_BROADCAST) return hwnd;
+    if (hwnd16 <= 1 || hwnd16 == 0xffff) return hwnd;
+    /* do sign extension for -2 and -3 */
+    if (hwnd16 >= (HWND16)-3) return (HWND)(LONG_PTR)(INT16)hwnd16;
 
     if ((ptr = get_wnd_ptr( hwnd )))
     {
@@ -190,7 +190,7 @@
     {
         SERVER_START_REQ( get_window_info )
         {
-            req->handle = (user_handle_t)hwnd16;
+            req->handle = hwnd;
             if (!SERVER_CALL_ERR()) hwnd = req->full_handle;
         }
         SERVER_END_REQ;
@@ -804,8 +804,10 @@
 
 	cbtc.lpcs = cs;
 	cbtc.hwndInsertAfter = hwndLinkAfter;
-        ret = (type == WIN_PROC_32W) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, hwnd, (LPARAM)&cbtc)
-                      : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, hwnd, (LPARAM)&cbtc);
+        ret = (type == WIN_PROC_32W) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND,
+                                                       (WPARAM)hwnd, (LPARAM)&cbtc)
+                                     : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND,
+                                                       (WPARAM)hwnd, (LPARAM)&cbtc);
         if (ret)
 	{
 	    TRACE("CBT-hook returned 0\n");
@@ -915,7 +917,7 @@
     /* Call WH_SHELL hook */
 
     if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
-        HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
+        HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWCREATED, (WPARAM)hwnd, 0 );
 
     TRACE("created window %04x\n", hwnd);
  end:
@@ -983,13 +985,13 @@
     cs.lpCreateParams = data;
     cs.hInstance      = (HINSTANCE)instance;
     cs.hMenu          = (HMENU)menu;
-    cs.hwndParent     = (HWND)parent;
+    cs.hwndParent     = WIN_Handle32( parent );
     cs.style          = style;
     cs.lpszName       = windowName;
     cs.lpszClass      = className;
     cs.dwExStyle      = exStyle;
 
-    return WIN_CreateWindowEx( &cs, classAtom, WIN_PROC_16 );
+    return WIN_Handle16( WIN_CreateWindowEx( &cs, classAtom, WIN_PROC_16 ));
 }
 
 
@@ -1153,15 +1155,6 @@
 
 
 /***********************************************************************
- *		DestroyWindow (USER.53)
- */
-BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
-{
-    return DestroyWindow(hwnd);
-}
-
-
-/***********************************************************************
  *		DestroyWindow (USER32.@)
  */
 BOOL WINAPI DestroyWindow( HWND hwnd )
@@ -1190,12 +1183,12 @@
 
       /* Call hooks */
 
-    if( HOOK_CallHooksA( WH_CBT, HCBT_DESTROYWND, hwnd, 0L) ) return FALSE;
+    if( HOOK_CallHooksA( WH_CBT, HCBT_DESTROYWND, (WPARAM)hwnd, 0L) ) return FALSE;
 
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
     if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
     {
-        HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWDESTROYED, hwnd, 0L );
+        HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWDESTROYED, (WPARAM)hwnd, 0L );
         /* FIXME: clean up palette - see "Internals" p.352 */
     }
 
@@ -1293,15 +1286,6 @@
 
 
 /***********************************************************************
- *		CloseWindow (USER.43)
- */
-BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
-{
-    return CloseWindow( hwnd );
-}
-
-
-/***********************************************************************
  *		CloseWindow (USER32.@)
  */
 BOOL WINAPI CloseWindow( HWND hwnd )
@@ -1324,15 +1308,6 @@
 
 
 /***********************************************************************
- *		OpenIcon (USER.44)
- */
-BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
-{
-    return OpenIcon( hwnd );
-}
-
-
-/***********************************************************************
  *		OpenIcon (USER32.@)
  */
 BOOL WINAPI OpenIcon( HWND hwnd )
@@ -1399,24 +1374,6 @@
 
 
 /***********************************************************************
- *		FindWindow (USER.50)
- */
-HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
-{
-    return FindWindowA( className, title );
-}
-
-
-/***********************************************************************
- *		FindWindowEx (USER.427)
- */
-HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
-{
-    return FindWindowExA( parent, child, className, title );
-}
-
-
-/***********************************************************************
  *		FindWindowA (USER32.@)
  */
 HWND WINAPI FindWindowA( LPCSTR className, LPCSTR title )
@@ -1487,15 +1444,6 @@
 
 
 /**********************************************************************
- *		GetDesktopWindow (USER.286)
- */
-HWND16 WINAPI GetDesktopWindow16(void)
-{
-    return (HWND16)pWndDesktop->hwndSelf;
-}
-
-
-/**********************************************************************
  *		GetDesktopWindow (USER32.@)
  */
 HWND WINAPI GetDesktopWindow(void)
@@ -1507,27 +1455,6 @@
 }
 
 
-/**********************************************************************
- *		GetDesktopHwnd (USER.278)
- *
- * Exactly the same thing as GetDesktopWindow(), but not documented.
- * Don't ask me why...
- */
-HWND16 WINAPI GetDesktopHwnd16(void)
-{
-    return (HWND16)pWndDesktop->hwndSelf;
-}
-
-
-/*******************************************************************
- *		EnableWindow (USER.34)
- */
-BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
-{
-    return EnableWindow( hwnd, enable );
-}
-
-
 /*******************************************************************
  *		EnableWindow (USER32.@)
  */
@@ -1571,15 +1498,6 @@
 
 
 /***********************************************************************
- *		IsWindowEnabled (USER.35)
- */
-BOOL16 WINAPI IsWindowEnabled16(HWND16 hWnd)
-{
-    return IsWindowEnabled(hWnd);
-}
-
-
-/***********************************************************************
  *		IsWindowEnabled (USER32.@)
  */
 BOOL WINAPI IsWindowEnabled(HWND hWnd)
@@ -1611,15 +1529,6 @@
 
 
 /**********************************************************************
- *		GetWindowWord (USER.133)
- */
-WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
-{
-    return GetWindowWord( hwnd, offset );
-}
-
-
-/**********************************************************************
  *		GetWindowWord (USER32.@)
  */
 WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
@@ -1633,44 +1542,29 @@
         {
             WARN("Invalid offset %d\n", offset );
             retvalue = 0;
-            goto end;
         }
-        retvalue = *(WORD *)(((char *)wndPtr->wExtra) + offset);
-        goto end;
+        else retvalue = *(WORD *)(((char *)wndPtr->wExtra) + offset);
+        WIN_ReleaseWndPtr(wndPtr);
+        return retvalue;
     }
+
+    WIN_ReleaseWndPtr(wndPtr);
     switch(offset)
     {
-    case GWW_ID:
-    	if (HIWORD(wndPtr->wIDmenu))
-    		WARN("GWW_ID: discards high bits of 0x%08x!\n",
-                    wndPtr->wIDmenu);
-        retvalue = (WORD)wndPtr->wIDmenu;
-        goto end;
-    case GWW_HWNDPARENT:
-    	retvalue =  GetParent(hwnd);
-        goto end;
-    case GWW_HINSTANCE:
-    	if (HIWORD(wndPtr->hInstance))
-    		WARN("GWW_HINSTANCE: discards high bits of 0x%08x!\n",
-                    wndPtr->hInstance);
-        retvalue = (WORD)wndPtr->hInstance;
-        goto end;
+    case GWL_HWNDPARENT:
+        return GetWindowLongW( hwnd, offset );
+    case GWL_ID:
+    case GWL_HINSTANCE:
+        {
+            LONG ret = GetWindowLongW( hwnd, offset );
+            if (HIWORD(ret))
+                WARN("%d: discards high bits of 0x%08lx!\n", offset, ret );
+            return LOWORD(ret);
+        }
     default:
         WARN("Invalid offset %d\n", offset );
-        retvalue = 0;
-        goto end;
+        return 0;
     }
-end:
-    WIN_ReleaseWndPtr(wndPtr);
-    return retvalue;
-}
-
-/**********************************************************************
- *		SetWindowWord (USER.134)
- */
-WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
-{
-    return SetWindowWord( hwnd, offset, newval );
 }
 
 
@@ -1687,27 +1581,27 @@
         if (offset + sizeof(WORD) > wndPtr->cbWndExtra)
         {
             WARN("Invalid offset %d\n", offset );
-            retval = 0;
-            goto end;
+            WIN_ReleaseWndPtr(wndPtr);
+            return 0;
         }
         ptr = (WORD *)(((char *)wndPtr->wExtra) + offset);
+        retval = *ptr;
+        *ptr = newval;
+        WIN_ReleaseWndPtr(wndPtr);
+        return retval;
     }
-    else switch(offset)
-    {
-	case GWW_ID:        ptr = (WORD *)&wndPtr->wIDmenu; break;
-	case GWW_HINSTANCE: ptr = (WORD *)&wndPtr->hInstance; break;
-        case GWW_HWNDPARENT: retval = SetParent( hwnd, newval );
-                             goto end;
-	default:
-            WARN("Invalid offset %d\n", offset );
-            retval = 0;
-            goto end;
-    }
-    retval = *ptr;
-    *ptr = newval;
-end:
+
     WIN_ReleaseWndPtr(wndPtr);
-    return retval;
+    switch(offset)
+    {
+    case GWL_ID:
+    case GWL_HINSTANCE:
+    case GWL_HWNDPARENT:
+        return SetWindowLongW( hwnd, offset, (UINT)newval );
+    default:
+        WARN("Invalid offset %d\n", offset );
+        return 0;
+    }
 }
 
 
@@ -1751,7 +1645,7 @@
         case GWL_WNDPROC:    retvalue = (LONG)WINPROC_GetProc( wndPtr->winproc,
                                                            type );
                              goto end;
-        case GWL_HWNDPARENT: retvalue = GetParent(hwnd);
+        case GWL_HWNDPARENT: retvalue = (LONG)GetParent(hwnd);
                              goto end;
         case GWL_HINSTANCE:  retvalue = wndPtr->hInstance;
                              goto end;
@@ -1870,7 +1764,7 @@
  */
 LONG WINAPI GetWindowLong16( HWND16 hwnd, INT16 offset )
 {
-    return WIN_GetWindowLong( (HWND)hwnd, offset, WIN_PROC_16 );
+    return WIN_GetWindowLong( WIN_Handle32(hwnd), offset, WIN_PROC_16 );
 }
 
 
@@ -1897,7 +1791,7 @@
  */
 LONG WINAPI SetWindowLong16( HWND16 hwnd, INT16 offset, LONG newval )
 {
-    return WIN_SetWindowLong( hwnd, offset, newval, WIN_PROC_16 );
+    return WIN_SetWindowLong( WIN_Handle32(hwnd), offset, newval, WIN_PROC_16 );
 }
 
 
@@ -1995,15 +1889,6 @@
 
 
 /*******************************************************************
- *		GetWindowText (USER.36)
- */
-INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
-{
-    return (INT16)SendMessage16(hwnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
-}
-
-
-/*******************************************************************
  *		GetWindowTextA (USER32.@)
  */
 INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
@@ -2037,15 +1922,6 @@
 
 
 /*******************************************************************
- *		SetWindowText (USER.37)
- */
-BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
-{
-    return (BOOL16)SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
-}
-
-
-/*******************************************************************
  *		SetWindowText  (USER32.@)
  *		SetWindowTextA (USER32.@)
  */
@@ -2065,15 +1941,6 @@
 
 
 /*******************************************************************
- *		GetWindowTextLength (USER.38)
- */
-INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
-{
-    return (INT16)GetWindowTextLengthA( hwnd );
-}
-
-
-/*******************************************************************
  *		GetWindowTextLengthA (USER32.@)
  */
 INT WINAPI GetWindowTextLengthA( HWND hwnd )
@@ -2091,16 +1958,6 @@
 
 
 /*******************************************************************
- *		IsWindow (USER.47)
- */
-BOOL16 WINAPI IsWindow16( HWND16 hwnd )
-{
-    CURRENT_STACK16->es = USER_HeapSel;
-    return IsWindow( hwnd );
-}
-
-
-/*******************************************************************
  *		IsWindow (USER32.@)
  */
 BOOL WINAPI IsWindow( HWND hwnd )
@@ -2167,15 +2024,6 @@
 
 
 /*****************************************************************
- *		GetParent (USER.46)
- */
-HWND16 WINAPI GetParent16( HWND16 hwnd )
-{
-    return (HWND16)GetParent( hwnd );
-}
-
-
-/*****************************************************************
  *		GetParent (USER32.@)
  */
 HWND WINAPI GetParent( HWND hwnd )
@@ -2234,15 +2082,6 @@
 
 
 /*****************************************************************
- *		SetParent (USER.233)
- */
-HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
-{
-    return SetParent( hwndChild, hwndNewParent );
-}
-
-
-/*****************************************************************
  *		SetParent (USER32.@)
  */
 HWND WINAPI SetParent( HWND hwnd, HWND parent )
@@ -2302,15 +2141,6 @@
 
 
 /*******************************************************************
- *		IsChild (USER.48)
- */
-BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
-{
-    return IsChild(parent,child);
-}
-
-
-/*******************************************************************
  *		IsChild (USER32.@)
  */
 BOOL WINAPI IsChild( HWND parent, HWND child )
@@ -2329,15 +2159,6 @@
 
 
 /***********************************************************************
- *		IsWindowVisible (USER.49)
- */
-BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
-{
-    return IsWindowVisible(hwnd);
-}
-
-
-/***********************************************************************
  *		IsWindowVisible (USER32.@)
  */
 BOOL WINAPI IsWindowVisible( HWND hwnd )
@@ -2384,15 +2205,6 @@
 
 
 /*******************************************************************
- *		GetTopWindow (USER.229)
- */
-HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
-{
-    return GetTopWindow(hwnd);
-}
-
-
-/*******************************************************************
  *		GetTopWindow (USER32.@)
  */
 HWND WINAPI GetTopWindow( HWND hwnd )
@@ -2403,15 +2215,6 @@
 
 
 /*******************************************************************
- *		GetWindow (USER.262)
- */
-HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
-{
-    return GetWindow( hwnd,rel );
-}
-
-
-/*******************************************************************
  *		GetWindow (USER32.@)
  */
 HWND WINAPI GetWindow( HWND hwnd, WORD rel )
@@ -2484,15 +2287,6 @@
 }
 
 
-/*******************************************************************
- *		GetNextWindow (USER.230)
- */
-HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
-{
-    if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
-    return GetWindow16( hwnd, flag );
-}
-
 /***********************************************************************
  *           WIN_InternalShowOwnedPopups
  *
@@ -2558,15 +2352,6 @@
 }
 
 /*******************************************************************
- *		ShowOwnedPopups (USER.265)
- */
-void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
-{
-    ShowOwnedPopups( owner, fShow );
-}
-
-
-/*******************************************************************
  *		ShowOwnedPopups (USER32.@)
  */
 BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL fShow )
@@ -2618,14 +2403,6 @@
 
 
 /*******************************************************************
- *		GetLastActivePopup (USER.287)
- */
-HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
-{
-    return GetLastActivePopup( hwnd );
-}
-
-/*******************************************************************
  *		GetLastActivePopup (USER32.@)
  */
 HWND WINAPI GetLastActivePopup( HWND hwnd )
@@ -2873,15 +2650,6 @@
 
 
 /*******************************************************************
- *		FlashWindow (USER.105)
- */
-BOOL16 WINAPI FlashWindow16( HWND16 hWnd, BOOL16 bInvert )
-{
-    return FlashWindow( hWnd, bInvert );
-}
-
-
-/*******************************************************************
  *		FlashWindow (USER32.@)
  */
 BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
@@ -2927,27 +2695,6 @@
 
 
 /*******************************************************************
- *		SetSysModalWindow (USER.188)
- */
-HWND16 WINAPI SetSysModalWindow16( HWND16 hWnd )
-{
-    HWND hWndOldModal = hwndSysModal;
-    hwndSysModal = hWnd;
-    FIXME("EMPTY STUB !! SetSysModalWindow(%04x) !\n", hWnd);
-    return hWndOldModal;
-}
-
-
-/*******************************************************************
- *		GetSysModalWindow (USER.189)
- */
-HWND16 WINAPI GetSysModalWindow16(void)
-{
-    return hwndSysModal;
-}
-
-
-/*******************************************************************
  *		GetWindowContextHelpId (USER32.@)
  */
 DWORD WINAPI GetWindowContextHelpId( HWND hwnd )
@@ -3044,16 +2791,6 @@
 
 
 /*******************************************************************
- *		DragDetect (USER.465)
- */
-BOOL16 WINAPI DragDetect16( HWND16 hWnd, POINT16 pt )
-{
-    POINT pt32;
-    CONV_POINT16TO32( &pt, &pt32 );
-    return DragDetect( hWnd, pt32 );
-}
-
-/*******************************************************************
  *		DragDetect (USER32.@)
  */
 BOOL WINAPI DragDetect( HWND hWnd, POINT pt )
diff --git a/windows/winhelp.c b/windows/winhelp.c
index 362b516..c0e2d66 100644
--- a/windows/winhelp.c
+++ b/windows/winhelp.c
@@ -11,6 +11,7 @@
 #include "wingdi.h"
 #include "wine/winuser16.h"
 #include "wine/winbase16.h"
+#include "win.h"
 #include "heap.h"
 
 DEFAULT_DEBUG_CHANNEL(win);
@@ -39,13 +40,13 @@
   /* We might call WinExec() */
   ReleaseThunkLock( &mutex_count );
 
-  if (!(ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)MapSL(dwData) )))
+  if (!(ret = WinHelpA( WIN_Handle32(hWnd), lpHelpFile, wCommand, (DWORD)MapSL(dwData) )))
   {
       /* try to start the 16-bit winhelp */
       if (WinExec( "winhelp.exe -x", SW_SHOWNORMAL ) >= 32)
       {
           K32WOWYield16();
-          ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)MapSL(dwData) );
+          ret = WinHelpA( WIN_Handle32(hWnd), lpHelpFile, wCommand, (DWORD)MapSL(dwData) );
       }
   }
 
diff --git a/windows/winpos.c b/windows/winpos.c
index 05b2d69..1779348 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -117,13 +117,6 @@
 }
 
 /***********************************************************************
- *		ArrangeIconicWindows (USER.170)
- */
-UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent) 
-{
-    return ArrangeIconicWindows(parent);
-}
-/***********************************************************************
  *		ArrangeIconicWindows (USER32.@)
  */
 UINT WINAPI ArrangeIconicWindows( HWND parent )
@@ -165,15 +158,6 @@
 
 
 /***********************************************************************
- *		SwitchToThisWindow (USER.172)
- */
-void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
-{
-    SwitchToThisWindow( hwnd, restore );
-}
-
-
-/***********************************************************************
  *		SwitchToThisWindow (USER32.@)
  */
 void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
@@ -183,21 +167,6 @@
 
 
 /***********************************************************************
- *		GetWindowRect (USER.32)
- */
-void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect ) 
-{
-    RECT rect32;
-
-    GetWindowRect( hwnd, &rect32 );
-    rect->left   = rect32.left;
-    rect->top    = rect32.top;
-    rect->right  = rect32.right;
-    rect->bottom = rect32.bottom;
-}
-
-
-/***********************************************************************
  *		GetWindowRect (USER32.@)
  */
 BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect ) 
@@ -273,34 +242,6 @@
     return ret;
 }
 
-/***********************************************************************
- *		SetWindowRgn (USER.668)
- */
-INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn,BOOL16 bRedraw)
-
-{
-
-  FIXME("SetWindowRgn16: stub\n"); 
-  return TRUE;
-}
-
-
-/***********************************************************************
- *		GetClientRect (USER.33)
- */
-void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect ) 
-{
-    WND * wndPtr = WIN_FindWndPtr( hwnd );
-
-    rect->left = rect->top = rect->right = rect->bottom = 0;
-    if (wndPtr) 
-    {
-	rect->right  = wndPtr->rectClient.right - wndPtr->rectClient.left;
-	rect->bottom = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
-    }
-    WIN_ReleaseWndPtr(wndPtr);
-}
-
 
 /***********************************************************************
  *		GetClientRect (USER32.@)
@@ -322,15 +263,6 @@
 
 
 /*******************************************************************
- *		ClientToScreen (USER.28)
- */
-void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
-{
-    MapWindowPoints16( hwnd, 0, lppnt, 1 );
-}
-
-
-/*******************************************************************
  *		ClientToScreen (USER32.@)
  */
 BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
@@ -341,15 +273,6 @@
 
 
 /*******************************************************************
- *		ScreenToClient (USER.29)
- */
-void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
-{
-    MapWindowPoints16( 0, hwnd, lppnt, 1 );
-}
-
-
-/*******************************************************************
  *		ScreenToClient (USER32.@)
  */
 BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
@@ -490,18 +413,6 @@
 
 
 /*******************************************************************
- *		WindowFromPoint (USER.30)
- */
-HWND16 WINAPI WindowFromPoint16( POINT16 pt )
-{
-    POINT pt32;
-
-    CONV_POINT16TO32( &pt, &pt32 );
-    return WindowFromPoint( pt32 );
-}
-
-
-/*******************************************************************
  *		WindowFromPoint (USER32.@)
  */
 HWND WINAPI WindowFromPoint( POINT pt )
@@ -512,17 +423,6 @@
 
 
 /*******************************************************************
- *		ChildWindowFromPoint (USER.191)
- */
-HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
-{
-    POINT pt32;
-    CONV_POINT16TO32( &pt, &pt32 );
-    return (HWND16)ChildWindowFromPoint( hwndParent, pt32 );
-}
-
-
-/*******************************************************************
  *		ChildWindowFromPoint (USER32.@)
  */
 HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
@@ -531,17 +431,6 @@
 }
 
 /*******************************************************************
- *		ChildWindowFromPointEx (USER.399)
- */
-HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
-{
-    POINT pt32;
-    CONV_POINT16TO32( &pt, &pt32 );
-    return (HWND16)ChildWindowFromPointEx( hwndParent, pt32, uFlags );
-}
-
-
-/*******************************************************************
  *		ChildWindowFromPointEx (USER32.@)
  */
 HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt, UINT uFlags)
@@ -666,15 +555,6 @@
 
 
 /***********************************************************************
- *		IsIconic (USER.31)
- */
-BOOL16 WINAPI IsIconic16(HWND16 hWnd)
-{
-    return IsIconic(hWnd);
-}
-
-
-/***********************************************************************
  *		IsIconic (USER32.@)
  */
 BOOL WINAPI IsIconic(HWND hWnd)
@@ -686,15 +566,6 @@
     WIN_ReleaseWndPtr(wndPtr);
     return retvalue;
 }
- 
- 
-/***********************************************************************
- *		IsZoomed (USER.272)
- */
-BOOL16 WINAPI IsZoomed16(HWND16 hWnd)
-{
-    return IsZoomed(hWnd);
-}
 
 
 /***********************************************************************
@@ -712,14 +583,6 @@
 
 
 /*******************************************************************
- *		GetActiveWindow (USER.60)
- */
-HWND16 WINAPI GetActiveWindow16(void)
-{
-    return (HWND16)GetActiveWindow();
-}
-
-/*******************************************************************
  *		GetActiveWindow (USER32.@)
  */
 HWND WINAPI GetActiveWindow(void)
@@ -749,15 +612,6 @@
 
 
 /*******************************************************************
- *		SetActiveWindow (USER.59)
- */
-HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
-{
-    return SetActiveWindow(hwnd);
-}
-
-
-/*******************************************************************
  *		SetActiveWindow (USER32.@)
  */
 HWND WINAPI SetActiveWindow( HWND hwnd )
@@ -811,24 +665,6 @@
 
 
 /*******************************************************************
- *		GetForegroundWindow (USER.608)
- */
-HWND16 WINAPI GetForegroundWindow16(void)
-{
-    return (HWND16)GetForegroundWindow();
-}
-
-
-/*******************************************************************
- *		SetForegroundWindow (USER.609)
- */
-BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
-{
-    return SetForegroundWindow( hwnd );
-}
-
-
-/*******************************************************************
  *		GetForegroundWindow (USER32.@)
  */
 HWND WINAPI GetForegroundWindow(void)
@@ -880,14 +716,6 @@
 
 
 /*******************************************************************
- *		GetShellWindow (USER.600)
- */
-HWND16 WINAPI GetShellWindow16(void)
-{
-    return GetShellWindow();
-}
-
-/*******************************************************************
  *		SetShellWindow (USER32.@)
  */
 HWND WINAPI SetShellWindow(HWND hwndshell)
@@ -909,15 +737,6 @@
 
 
 /***********************************************************************
- *		BringWindowToTop (USER.45)
- */
-BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
-{
-    return BringWindowToTop(hwnd);
-}
-
-
-/***********************************************************************
  *		BringWindowToTop (USER32.@)
  */
 BOOL WINAPI BringWindowToTop( HWND hwnd )
@@ -927,16 +746,6 @@
 
 
 /***********************************************************************
- *		MoveWindow (USER.56)
- */
-BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy,
-                            BOOL16 repaint )
-{
-    return MoveWindow(hwnd,x,y,cx,cy,repaint);
-}
-
-
-/***********************************************************************
  *		MoveWindow (USER32.@)
  */
 BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
@@ -1116,15 +925,6 @@
 
 
 /***********************************************************************
- *		ShowWindow (USER.42)
- */
-BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd ) 
-{    
-    return ShowWindow(hwnd,cmd);
-}
-
-
-/***********************************************************************
  *		ShowWindow (USER32.@)
  */
 BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
@@ -1166,36 +966,6 @@
     return 0;
 }
 
-/***********************************************************************
- *		GetWindowPlacement (USER.370)
- */
-BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wndpl )
-{
-    WND *pWnd = WIN_FindWndPtr( hwnd );
-    LPINTERNALPOS lpPos;
-    
-    if(!pWnd ) return FALSE;
-
-    lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
-			     *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
-	wndpl->length  = sizeof(*wndpl);
-	if( pWnd->dwStyle & WS_MINIMIZE )
-	    wndpl->showCmd = SW_SHOWMINIMIZED;
-	else 
-	    wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE )
-			     ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
-	if( pWnd->flags & WIN_RESTORE_MAX )
-	    wndpl->flags = WPF_RESTORETOMAXIMIZED;
-	else
-	    wndpl->flags = 0;
-	wndpl->ptMinPosition = lpPos->ptIconPos;
-	wndpl->ptMaxPosition = lpPos->ptMaxPos;
-	wndpl->rcNormalPosition = lpPos->rectNormal;
-
-    WIN_ReleaseWndPtr(pWnd);
-	return TRUE;
-    }
-
 
 /***********************************************************************
  *		GetWindowPlacement (USER32.@)
@@ -1203,32 +973,35 @@
  * Win95:
  * Fails if wndpl->length of Win95 (!) apps is invalid.
  */
-BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *pwpl32 )
+BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
 {
-    if( pwpl32 )
-    {
-	WINDOWPLACEMENT16 wpl;
-	wpl.length = sizeof(wpl);
-        if( GetWindowPlacement16( hwnd, &wpl ) )
-	{
-	    pwpl32->length = sizeof(*pwpl32);
-	    pwpl32->flags = wpl.flags;
-	    pwpl32->showCmd = wpl.showCmd;
-	    CONV_POINT16TO32( &wpl.ptMinPosition, &pwpl32->ptMinPosition );
-	    CONV_POINT16TO32( &wpl.ptMaxPosition, &pwpl32->ptMaxPosition );
-	    CONV_RECT16TO32( &wpl.rcNormalPosition, &pwpl32->rcNormalPosition );
-	    return TRUE;
-	}
-    }
-    return FALSE;
+    WND *pWnd = WIN_FindWndPtr( hwnd );
+    LPINTERNALPOS lpPos;
+
+    if(!pWnd ) return FALSE;
+
+    lpPos = WINPOS_InitInternalPos( pWnd, *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
+    wndpl->length  = sizeof(*wndpl);
+    if( pWnd->dwStyle & WS_MINIMIZE )
+        wndpl->showCmd = SW_SHOWMINIMIZED;
+    else
+        wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
+    if( pWnd->flags & WIN_RESTORE_MAX )
+        wndpl->flags = WPF_RESTORETOMAXIMIZED;
+    else
+        wndpl->flags = 0;
+    CONV_POINT16TO32( &lpPos->ptIconPos, &wndpl->ptMinPosition );
+    CONV_POINT16TO32( &lpPos->ptMaxPos, &wndpl->ptMaxPosition );
+    CONV_RECT16TO32( &lpPos->rectNormal, &wndpl->rcNormalPosition );
+    WIN_ReleaseWndPtr(pWnd);
+    return TRUE;
 }
 
 
 /***********************************************************************
  *           WINPOS_SetPlacement
  */
-static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
-						UINT flags )
+static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
 {
     WND *pWnd = WIN_FindWndPtr( hwnd );
     if( pWnd )
@@ -1236,9 +1009,9 @@
 	LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
 			     *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
 
-	if( flags & PLACE_MIN ) lpPos->ptIconPos = wndpl->ptMinPosition;
-	if( flags & PLACE_MAX ) lpPos->ptMaxPos = wndpl->ptMaxPosition;
-	if( flags & PLACE_RECT) lpPos->rectNormal = wndpl->rcNormalPosition;
+	if( flags & PLACE_MIN ) CONV_POINT32TO16( &wndpl->ptMinPosition, &lpPos->ptIconPos );
+	if( flags & PLACE_MAX ) CONV_POINT32TO16( &wndpl->ptMaxPosition, &lpPos->ptMaxPos );
+	if( flags & PLACE_RECT) CONV_RECT32TO16( &wndpl->rcNormalPosition, &lpPos->rectNormal );
 
 	if( pWnd->dwStyle & WS_MINIMIZE )
 	{
@@ -1275,75 +1048,19 @@
 
 
 /***********************************************************************
- *		SetWindowPlacement (USER.371)
- */
-BOOL16 WINAPI SetWindowPlacement16(HWND16 hwnd, const WINDOWPLACEMENT16 *wndpl)
-{
-    return WINPOS_SetPlacement( hwnd, wndpl,
-                                PLACE_MIN | PLACE_MAX | PLACE_RECT );
-}
-
-/***********************************************************************
  *		SetWindowPlacement (USER32.@)
  *
  * Win95:
  * Fails if wndpl->length of Win95 (!) apps is invalid.
  */
-BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *pwpl32 )
+BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl )
 {
-    if( pwpl32 )
-    {
-	WINDOWPLACEMENT16 wpl;
-
-	wpl.length = sizeof(WINDOWPLACEMENT16);
-	wpl.flags = pwpl32->flags;
-	wpl.showCmd = pwpl32->showCmd;
-	wpl.ptMinPosition.x = pwpl32->ptMinPosition.x;
-	wpl.ptMinPosition.y = pwpl32->ptMinPosition.y;
-	wpl.ptMaxPosition.x = pwpl32->ptMaxPosition.x;
-	wpl.ptMaxPosition.y = pwpl32->ptMaxPosition.y;
-	wpl.rcNormalPosition.left = pwpl32->rcNormalPosition.left;
-	wpl.rcNormalPosition.top = pwpl32->rcNormalPosition.top;
-	wpl.rcNormalPosition.right = pwpl32->rcNormalPosition.right;
-	wpl.rcNormalPosition.bottom = pwpl32->rcNormalPosition.bottom;
-
-        return WINPOS_SetPlacement( hwnd, &wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
-    }
-    return FALSE;
+    if (!wpl) return FALSE;
+    return WINPOS_SetPlacement( hwnd, wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
 }
 
 
 /***********************************************************************
- *		SetInternalWindowPos (USER.461)
- */
-void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd,
-                                    LPRECT16 rect, LPPOINT16 pt )
-{
-    if( IsWindow16(hwnd) )
-    {
-	WINDOWPLACEMENT16 wndpl;
-	UINT flags;
-
-	wndpl.length  = sizeof(wndpl);
-	wndpl.showCmd = showCmd;
-	wndpl.flags = flags = 0;
-
-	if( pt )
-	{
-	    flags |= PLACE_MIN;
-	    wndpl.flags |= WPF_SETMINPOSITION;
-	    wndpl.ptMinPosition = *pt;
-	}
-	if( rect )
-	{
-	    flags |= PLACE_RECT;
-	    wndpl.rcNormalPosition = *rect;
-	}
-	WINPOS_SetPlacement( hwnd, &wndpl, flags );
-    }
-}
-
-/***********************************************************************
  *		AnimateWindow (USER32.@)
  *		Shows/Hides a window with an animation
  *		NO ANIMATION YET
@@ -1376,7 +1093,7 @@
 {
     if( IsWindow(hwnd) )
     {
-	WINDOWPLACEMENT16 wndpl;
+        WINDOWPLACEMENT wndpl;
 	UINT flags;
 
 	wndpl.length  = sizeof(wndpl);
@@ -1387,12 +1104,12 @@
 	{
             flags |= PLACE_MIN;
             wndpl.flags |= WPF_SETMINPOSITION;
-            CONV_POINT32TO16( pt, &wndpl.ptMinPosition );
+            wndpl.ptMinPosition = *pt;
 	}
 	if( rect )
 	{
             flags |= PLACE_RECT;
-            CONV_RECT32TO16( rect, &wndpl.rcNormalPosition );
+            wndpl.rcNormalPosition = *rect;
 	}
         WINPOS_SetPlacement( hwnd, &wndpl, flags );
     }
@@ -1450,7 +1167,7 @@
         CBTACTIVATESTRUCT cbt;
         cbt.fMouse     = fMouse;
         cbt.hWndActive = hwndActive;
-        if (HOOK_CallHooksA( WH_CBT, HCBT_ACTIVATE, hWnd, (LPARAM)&cbt )) goto CLEANUP_END;
+        if (HOOK_CallHooksA( WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd, (LPARAM)&cbt )) goto CLEANUP_END;
     }
 
     /* set prev active wnd to current active wnd and send notification */
@@ -1460,8 +1177,7 @@
         
         if (!SendMessageA( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 ))
         {
-	    if (GetSysModalWindow16() != hWnd) 
-		goto CLEANUP_END;
+            if (GetSysModalWindow16() != WIN_Handle16(hWnd)) goto CLEANUP_END;
 	    /* disregard refusal if hWnd is sysmodal */
         }
 
@@ -1819,14 +1535,6 @@
     return 0;
 }
 
-/***********************************************************************
- *		SetWindowPos (USER.232)
- */
-BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
-                              INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
-{
-    return SetWindowPos(hwnd,(INT)(INT16)hwndInsertAfter,x,y,cx,cy,flags);
-}
 
 /***********************************************************************
  *		SetWindowPos (USER32.@)
@@ -1848,15 +1556,6 @@
 
 
 /***********************************************************************
- *		BeginDeferWindowPos (USER.259)
- */
-HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
-{
-    return BeginDeferWindowPos( count );
-}
-
-
-/***********************************************************************
  *		BeginDeferWindowPos (USER32.@)
  */
 HDWP WINAPI BeginDeferWindowPos( INT count )
@@ -1885,18 +1584,6 @@
 
 
 /***********************************************************************
- *		DeferWindowPos (USER.260)
- */
-HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
-                                INT16 x, INT16 y, INT16 cx, INT16 cy,
-                                UINT16 flags )
-{
-    return DeferWindowPos( hdwp, hwnd, (INT)(INT16)hwndAfter,
-                             x, y, cx, cy, flags );
-}
-
-
-/***********************************************************************
  *		DeferWindowPos (USER32.@)
  */
 HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
@@ -1989,15 +1676,6 @@
 
 
 /***********************************************************************
- *		EndDeferWindowPos (USER.261)
- */
-BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
-{
-    return EndDeferWindowPos( hdwp );
-}
-
-
-/***********************************************************************
  *		EndDeferWindowPos (USER32.@)
  */
 BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
@@ -2037,7 +1715,7 @@
 /***********************************************************************
  *		SetProgmanWindow (USER32.@)
  */
-HRESULT WINAPI SetProgmanWindow ( HWND hwnd )
+HWND WINAPI SetProgmanWindow ( HWND hwnd )
 {
 	hGlobalProgmanWindow = hwnd;
 	return hGlobalProgmanWindow;
@@ -2046,7 +1724,7 @@
 /***********************************************************************
  *		GetProgmanWindow (USER32.@)
  */
-HRESULT WINAPI GetProgmanWindow ( )
+HWND WINAPI GetProgmanWindow(void)
 {
 	return hGlobalProgmanWindow;
 }
@@ -2062,7 +1740,7 @@
  *                |   
  *                |-> ProxyTarget
  */
-HRESULT WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
+HWND WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
 {
 	FIXME("0x%08x 0x%08x stub\n",hwndProgman ,hwndListView );
 	hGlobalShellWindow = hwndProgman;
@@ -2076,7 +1754,7 @@
  *   hwnd = MSTaskSwWClass 
  *          |-> SysTabControl32
  */
-HRESULT WINAPI SetTaskmanWindow ( HWND hwnd )
+HWND WINAPI SetTaskmanWindow ( HWND hwnd )
 {
 	hGlobalTaskmanWindow = hwnd;
 	return hGlobalTaskmanWindow;
@@ -2085,7 +1763,7 @@
 /***********************************************************************
  *		GetTaskmanWindow (USER32.@)
  */
-HRESULT WINAPI GetTaskmanWindow ( )
-{	
+HWND WINAPI GetTaskmanWindow(void)
+{
 	return hGlobalTaskmanWindow;
 }
diff --git a/windows/winproc.c b/windows/winproc.c
index 0219135..e4a96ce 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -190,7 +190,6 @@
     CONTEXT86 context;
     LRESULT ret;
     WORD *args;
-    WND *wndPtr = WIN_FindWndPtr( hwnd );
     DWORD offset = 0;
     TEB *teb = NtCurrentTeb();
     int iWndsLocks;
@@ -199,14 +198,12 @@
 
     memset(&context, '\0', sizeof(context));
     context.SegDs = context.SegEs = SELECTOROF(teb->cur_stack);
-    context.Eax   = wndPtr ? wndPtr->hInstance : context.SegDs;
+    if (!(context.Eax = GetWindowWord16( hwnd, GWL_HINSTANCE ))) context.Eax = context.SegDs;
     context.SegCs = SELECTOROF(proc);
     context.Eip   = OFFSETOF(proc);
     context.Ebp   = OFFSETOF(teb->cur_stack)
                         + (WORD)&((STACK16FRAME*)0)->bp;
 
-    WIN_ReleaseWndPtr(wndPtr);
-
     if (lParam)
     {
         /* Some programs (eg. the "Undocumented Windows" examples, JWP) only
@@ -1059,7 +1056,7 @@
  * Map a message from 16- to 32-bit Ansi.
  * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
  */
-INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
+INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
                              WPARAM *pwparam32, LPARAM *plparam )
 {
     *pmsg32 = (UINT)msg16;
@@ -1071,18 +1068,18 @@
     case WM_COMMAND:
     case WM_VKEYTOITEM:
         *pwparam32 = MAKEWPARAM( wParam16, HIWORD(*plparam) );
-        *plparam   = (LPARAM)(HWND)LOWORD(*plparam);
+        *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
         return 0;
     case WM_HSCROLL:
     case WM_VSCROLL:
         *pwparam32 = MAKEWPARAM( wParam16, LOWORD(*plparam) );
-        *plparam   = (LPARAM)(HWND)HIWORD(*plparam);
+        *plparam   = (LPARAM)WIN_Handle32( HIWORD(*plparam) );
         return 0;
     case WM_CTLCOLOR:
     	if ( HIWORD(*plparam) > CTLCOLOR_STATIC ) return -1;
         *pmsg32    = WM_CTLCOLORMSGBOX + HIWORD(*plparam);
         *pwparam32 = (WPARAM)(HDC)wParam16;
-        *plparam   = (LPARAM)(HWND)LOWORD(*plparam);
+        *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
         return 0;
     case WM_COMPAREITEM:
         {
@@ -1092,7 +1089,7 @@
             if (!cis) return -1;
             cis->CtlType    = cis16->CtlType;
             cis->CtlID      = cis16->CtlID;
-            cis->hwndItem   = cis16->hwndItem;
+            cis->hwndItem   = WIN_Handle32( cis16->hwndItem );
             cis->itemID1    = cis16->itemID1;
             cis->itemData1  = cis16->itemData1;
             cis->itemID2    = cis16->itemID2;
@@ -1109,7 +1106,7 @@
             if (!dis) return -1;
             dis->CtlType  = dis16->CtlType;
             dis->CtlID    = dis16->CtlID;
-            dis->hwndItem = dis16->hwndItem;
+            dis->hwndItem = WIN_Handle32( dis16->hwndItem );
             dis->itemData = dis16->itemData;
             *plparam = (LPARAM)dis;
         }
@@ -1142,7 +1139,8 @@
             dis->itemID     = dis16->itemID;
             dis->itemAction = dis16->itemAction;
             dis->itemState  = dis16->itemState;
-            dis->hwndItem   = dis16->hwndItem;
+            dis->hwndItem   = (dis->CtlType == ODT_MENU) ? (HWND)(HMENU)dis16->hwndItem
+                                                         : WIN_Handle32( dis16->hwndItem );
             dis->hDC        = dis16->hDC;
             dis->itemData   = dis16->itemData;
             CONV_RECT16TO32( &dis16->rcItem, &dis->rcItem );
@@ -1206,8 +1204,8 @@
     case WM_MDIACTIVATE:
 	if( *plparam )
 	{
-	    *pwparam32 = (WPARAM)(HWND)HIWORD(*plparam);
-	    *plparam   = (LPARAM)(HWND)LOWORD(*plparam);
+            *pwparam32 = (WPARAM)WIN_Handle32( HIWORD(*plparam) );
+            *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
 	}
 	else /* message sent to MDI client */
 	    *pwparam32 = wParam16;
@@ -1252,7 +1250,7 @@
         if ((wParam16 == WM_CREATE) || (wParam16 == WM_DESTROY))
         {
             *pwparam32 = MAKEWPARAM( wParam16, HIWORD(*plparam) );
-            *plparam   = (LPARAM)(HWND)LOWORD(*plparam);
+            *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
         }
         return 0;
     case WM_WINDOWPOSCHANGING:
@@ -1273,12 +1271,12 @@
             LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) );
 
             if (!msg32) return -1;
-            msg32->hwnd = msg16->hwnd;
+            msg32->hwnd = WIN_Handle32( msg16->hwnd );
             msg32->lParam = msg16->lParam;
             msg32->time = msg16->time;
             CONV_POINT16TO32(&msg16->pt,&msg32->pt);
             /* this is right, right? */
-            if (WINPROC_MapMsg16To32A(msg16->message,msg16->wParam,
+            if (WINPROC_MapMsg16To32A( msg32->hwnd, msg16->message,msg16->wParam,
                                      &msg32->message,&msg32->wParam,
                                      &msg32->lParam)<0) {
                 HeapFree( GetProcessHeap(), 0, msg32 );
@@ -1328,7 +1326,7 @@
  *
  * Unmap a message that was mapped from 16- to 32-bit Ansi.
  */
-LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
+LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
                                  LRESULT result )
 {
     switch(msg)
@@ -1420,7 +1418,7 @@
     case WM_NEXTMENU:
         {
             MDINEXTMENU *next = (MDINEXTMENU *)lParam;
-            result = MAKELONG( next->hmenuNext, next->hwndNext );
+            result = MAKELONG( next->hmenuNext, WIN_Handle16(next->hwndNext) );
             HeapFree( GetProcessHeap(), 0, next );
         }
         break;
@@ -1435,8 +1433,8 @@
  * Map a message from 16- to 32-bit Unicode.
  * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
  */
-INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
-                             WPARAM *pwparam32, LPARAM *plparam )
+INT WINPROC_MapMsg16To32W( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
+                           WPARAM *pwparam32, LPARAM *plparam )
 {
     char ch;
     WCHAR wch;
@@ -1503,7 +1501,7 @@
             LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) );
 
             if (!msg32) return -1;
-            msg32->hwnd = msg16->hwnd;
+            msg32->hwnd = WIN_Handle32( msg16->hwnd );
             msg32->lParam = msg16->lParam;
             msg32->time = msg16->time;
             CONV_POINT16TO32(&msg16->pt,&msg32->pt);
@@ -1523,7 +1521,7 @@
         ch = wParam16;
         MultiByteToWideChar( CP_ACP, 0, &ch, 1, &wch, 1);
         *pwparam32 = MAKEWPARAM( wch, HIWORD(*plparam) );
-        *plparam   = (LPARAM)(HWND)LOWORD(*plparam);
+        *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
         return 0;
     case WM_MENUCHAR:
         ch = wParam16;
@@ -1541,7 +1539,7 @@
         return 0;
 
     default:  /* No Unicode translation needed */
-        return WINPROC_MapMsg16To32A( msg16, wParam16, pmsg32,
+        return WINPROC_MapMsg16To32A( hwnd, msg16, wParam16, pmsg32,
                                       pwparam32, plparam );
     }
 }
@@ -1552,7 +1550,7 @@
  *
  * Unmap a message that was mapped from 16- to 32-bit Unicode.
  */
-LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
+LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
                                  LRESULT result )
 {
     switch(msg)
@@ -1830,7 +1828,7 @@
             if (!cis) return -1;
             cis->CtlType    = (UINT16)cis32->CtlType;
             cis->CtlID      = (UINT16)cis32->CtlID;
-            cis->hwndItem   = (HWND16)cis32->hwndItem;
+            cis->hwndItem   = WIN_Handle16( cis32->hwndItem );
             cis->itemID1    = (UINT16)cis32->itemID1;
             cis->itemData1  = cis32->itemData1;
             cis->itemID2    = (UINT16)cis32->itemID2;
@@ -1846,7 +1844,8 @@
             dis->CtlType  = (UINT16)dis32->CtlType;
             dis->CtlID    = (UINT16)dis32->CtlID;
             dis->itemID   = (UINT16)dis32->itemID;
-            dis->hwndItem = (HWND16)dis32->hwndItem;
+            dis->hwndItem = (dis->CtlType == ODT_MENU) ? (HWND16)LOWORD(dis32->hwndItem)
+                                                       : WIN_Handle16( dis32->hwndItem );
             dis->itemData = dis32->itemData;
             *plparam = (LPARAM)SEGPTR_GET(dis);
         }
@@ -1861,7 +1860,7 @@
             dis->itemID     = (UINT16)dis32->itemID;
             dis->itemAction = (UINT16)dis32->itemAction;
             dis->itemState  = (UINT16)dis32->itemState;
-            dis->hwndItem   = (HWND16)dis32->hwndItem;
+            dis->hwndItem   = WIN_Handle16( dis32->hwndItem );
             dis->hDC        = (HDC16)dis32->hDC;
             dis->itemData   = dis32->itemData;
             CONV_RECT32TO16( &dis32->rcItem, &dis->rcItem );
@@ -1949,7 +1948,7 @@
         }
         else
         {
-            *pwparam16 = (HWND)wParam32;
+            *pwparam16 = WIN_Handle16( (HWND)wParam32 );
             *plparam = 0;
         }
         return 0;
@@ -2027,7 +2026,7 @@
             LPMSG16 msg16 = (LPMSG16) SEGPTR_NEW( MSG16 );
 
             if (!msg16) return -1;
-            msg16->hwnd = msg32->hwnd;
+            msg16->hwnd = WIN_Handle16( msg32->hwnd );
             msg16->lParam = msg32->lParam;
             msg16->time = msg32->time;
             CONV_POINT32TO16(&msg32->pt,&msg16->pt);
@@ -2168,7 +2167,7 @@
         break;
     case WM_MDIGETACTIVE:
         if (lParam) *(BOOL *)lParam = (BOOL16)HIWORD(p16->lResult);
-        p16->lResult = (HWND)LOWORD(p16->lResult);
+        p16->lResult = (LRESULT)WIN_Handle32( LOWORD(p16->lResult) );
         break;
     case WM_NCCALCSIZE:
         {
@@ -2225,7 +2224,7 @@
         {
             MDINEXTMENU *next = (MDINEXTMENU *)lParam;
             next->hmenuNext = LOWORD(p16->lResult);
-            next->hwndNext = HIWORD(p16->lResult);
+            next->hwndNext = WIN_Handle32( HIWORD(p16->lResult) );
             p16->lResult = 0;
         }
         break;
@@ -2449,11 +2448,12 @@
     LRESULT result;
     UINT msg32;
     WPARAM wParam32;
+    HWND hwnd32 = WIN_Handle32( hwnd );
 
-    if (WINPROC_MapMsg16To32A( msg, wParam, &msg32, &wParam32, &lParam ) == -1)
+    if (WINPROC_MapMsg16To32A( hwnd32, msg, wParam, &msg32, &wParam32, &lParam ) == -1)
         return 0;
-    result = WINPROC_CallWndProc( func, hwnd, msg32, wParam32, lParam );
-    return WINPROC_UnmapMsg16To32A( hwnd, msg32, wParam32, lParam, result );
+    result = WINPROC_CallWndProc( func, hwnd32, msg32, wParam32, lParam );
+    return WINPROC_UnmapMsg16To32A( hwnd32, msg32, wParam32, lParam, result );
 }
 
 /**********************************************************************
@@ -2482,13 +2482,12 @@
     LRESULT result;
     UINT msg32;
     WPARAM wParam32;
+    HWND hwnd32 = WIN_Handle32( hwnd );
 
-    if (WINPROC_MapMsg16To32W( hwnd, msg, wParam, &msg32, &wParam32, &lParam ) == -1)
+    if (WINPROC_MapMsg16To32W( hwnd32, msg, wParam, &msg32, &wParam32, &lParam ) == -1)
         return 0;
-
-    result = WINPROC_CallWndProc( func, hwnd, msg32, wParam32, lParam );
-    
-    return WINPROC_UnmapMsg16To32W( hwnd, msg32, wParam32, lParam, result );
+    result = WINPROC_CallWndProc( func, hwnd32, msg32, wParam32, lParam );
+    return WINPROC_UnmapMsg16To32W( hwnd32, msg32, wParam32, lParam, result );
 }
 
 /**********************************************************************
@@ -2517,10 +2516,9 @@
     MSGPARAM16 mp16;
 
     mp16.lParam = lParam;
-    if (WINPROC_MapMsg32ATo16( hwnd, msg, wParam, 
-                               &msg16, &mp16.wParam, &mp16.lParam ) == -1)
+    if (WINPROC_MapMsg32ATo16( hwnd, msg, wParam, &msg16, &mp16.wParam, &mp16.lParam ) == -1)
         return 0;
-    mp16.lResult = WINPROC_CallWndProc16( func, hwnd, msg16,
+    mp16.lResult = WINPROC_CallWndProc16( func, WIN_Handle16(hwnd), msg16,
                                           mp16.wParam, mp16.lParam );
     WINPROC_UnmapMsg32ATo16( hwnd, msg, wParam, lParam, &mp16 );
     return mp16.lResult;
@@ -2543,7 +2541,7 @@
     if (WINPROC_MapMsg32WTo16( hwnd, msg, wParam, &msg16, &mp16.wParam,
                                &mp16.lParam ) == -1)
         return 0;
-    mp16.lResult = WINPROC_CallWndProc16( func, hwnd, msg16,
+    mp16.lResult = WINPROC_CallWndProc16( func, WIN_Handle16(hwnd), msg16,
                                           mp16.wParam, mp16.lParam );
     WINPROC_UnmapMsg32WTo16( hwnd, msg, wParam, lParam, &mp16 );
     return mp16.lResult;