Release 960521

Tue May 21 14:06:07 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/button.c]
	Made ButtonWndProc a 32-bit window procedure.

	* [controls/desktop.c]
	Made DesktopWndProc a 32-bit window procedure.
	Added handling of WM_SETCURSOR.

	* [controls/menu.c]
	Allocate menu items and strings on the 32-bit system heap.
	Implemented Win32 versions for ChangeMenu, InsertMenu, ModifyMenu,
	AppendMenu and LoadMenuIndirect.

	* [controls/widgets.c]
	Added possibility to have 32-bit built-in classes.

	* [files/drive.c]
	Implemented GetLogicalDrive() and GetLogicalDriveStrings().

	* [misc/spy.c] [include/spy.h]
	Added support for spying Win32 messages.

	* [loader/builtin.c]
	Fixed bug in -dll option parsing.

	* [memory/local.c]
	Added back the change by Huw D. M. Davies to free the block in
	LocalRealloc() before allocating the new one.

	* [objects/bitmap.c] [objects/cursoricon.c] [objects/oembitmap.c]
	Fixed bug in bitmap size that caused memory corruption for 24bpp.

	* [windows/defwnd.c]
	Implemented Win32 version of DefWindowProc().

	* [windows/dialog.c]
	Implemented Win32 version of SendDlgItemMessage,
	Get/SetDlgItemText and Get/SetDlgItemInt.

	* [windows/mdi.c]
	Implemented Win32 version of DefFrameProc() and DefMDIChildProc().
	Don't make a copy of the OBM bitmaps for every MDI window.

	* [windows/message.c]
	Implemented Win32 version of SendMessage().
	
	* [windows/winproc.c] [windows/class.c] [windows/win.c]
	New scheme for 32-bit window procedures to replace aliases. All
	32-bit window procedure get a 16-bit address pointing to a
	WINDOWPROC structure.
	Implemented Ansi<->Unicode translation for CallWindowProc().
	Added translation of WM_DRAWITEM between Win16 and Win32.

	* [windows/win.c] [include/callback.h]
	Added ugly hack to build CREATESTRUCT on the stack when sending
	WM_NCCREATE.
	Implemented Win32 version of Get/SetWindowWord/Long and
	Get/SetWindowText.
	
Fri May 17 10:20:16 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [controls/button.c]
	Avoid gray text on gray background in disabled push buttons
	using a b/w raster and some raster operations (PatBlt,BitBlt).

	* [objects/text.c]
	DrawText(): don't draw an underbar anymore if DT_CALCRECT is set.
diff --git a/controls/button.c b/controls/button.c
index 60558ec..7e24f64 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -6,22 +6,18 @@
  */
 
 #include "win.h"
-#include "user.h"
 #include "syscolor.h"
 #include "graphics.h"
 #include "button.h"
-#include "heap.h"
-
-extern void DEFWND_SetText( WND *wndPtr, LPSTR text );  /* windows/defwnd.c */
 
 static void PB_Paint( WND *wndPtr, HDC hDC, WORD action );
+static void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT16 *rc,char *text);
 static void CB_Paint( WND *wndPtr, HDC hDC, WORD action );
 static void GB_Paint( WND *wndPtr, HDC hDC, WORD action );
 static void UB_Paint( WND *wndPtr, HDC hDC, WORD action );
 static void OB_Paint( WND *wndPtr, HDC hDC, WORD action );
 static void BUTTON_CheckAutoRadioButton( WND *wndPtr );
 
-
 #define MAX_BTN_TYPE  12
 
 static WORD maxCheckState[MAX_BTN_TYPE] =
@@ -64,213 +60,188 @@
          (btnPaintFunc[style])(wndPtr,hdc,action); \
          ReleaseDC( (wndPtr)->hwndSelf, hdc ); }
 
-#ifdef WINELIB32
 #define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \
-    SendMessage( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
-                 (hdc), (wndPtr)->hwndSelf )
-#else
-#define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \
-    SendMessage( GetParent((wndPtr)->hwndSelf), WM_CTLCOLOR, (hdc), \
-                 MAKELPARAM((wndPtr)->hwndSelf, CTLCOLOR_BTN) )
-#endif
+    SendMessage32A( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
+                    (hdc), (wndPtr)->hwndSelf )
 
 static HBITMAP hbitmapCheckBoxes = 0;
 static WORD checkBoxWidth = 0, checkBoxHeight = 0;
 
 
-LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+/***********************************************************************
+ *           ButtonWndProc
+ */
+LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
 {
-        RECT16 rect;
-	LONG lResult = 0;
-	WND *wndPtr = WIN_FindWndPtr(hWnd);
-	LONG style = wndPtr->dwStyle & 0x0000000F;
-        BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
+    RECT16 rect;
+    WND *wndPtr = WIN_FindWndPtr(hWnd);
+    BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
+    LONG style = wndPtr->dwStyle & 0x0f;
 
-	switch (uMsg) {
-	case WM_GETDLGCODE:
-                switch(style)
-                {
-                case BS_PUSHBUTTON:
-                    return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON;
-                case BS_DEFPUSHBUTTON:
-                    return DLGC_BUTTON | DLGC_DEFPUSHBUTTON;
-                case BS_RADIOBUTTON:
-                case BS_AUTORADIOBUTTON:
-                    return DLGC_BUTTON | DLGC_RADIOBUTTON;
-                default:
-                    return DLGC_BUTTON;
-                }
+    switch (uMsg)
+    {
+    case WM_GETDLGCODE:
+        switch(style)
+        {
+        case BS_PUSHBUTTON:      return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON;
+        case BS_DEFPUSHBUTTON:   return DLGC_BUTTON | DLGC_DEFPUSHBUTTON;
+        case BS_RADIOBUTTON:
+        case BS_AUTORADIOBUTTON: return DLGC_BUTTON | DLGC_RADIOBUTTON;
+        default:                 return DLGC_BUTTON;
+        }
 
-	case WM_ENABLE:
-                PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
-		break;
+    case WM_ENABLE:
+        PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+        break;
 
-	case WM_CREATE:
-		if (!hbitmapCheckBoxes)
-		{
-		    BITMAP bmp;
-		    hbitmapCheckBoxes = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CHECKBOXES) );
-		    GetObject( hbitmapCheckBoxes, sizeof(bmp), (LPSTR)&bmp );
-		    checkBoxWidth  = bmp.bmWidth / 4;
-		    checkBoxHeight = bmp.bmHeight / 3;
-		}
-		
-		if (style < 0L || style >= MAX_BTN_TYPE)
-		    lResult = -1L;
-		else
-		{
-                    infoPtr->state = BUTTON_UNCHECKED;
-                    infoPtr->hFont = 0;
-		    lResult = 0L;
-		}
-		break;
+    case WM_CREATE:
+        if (!hbitmapCheckBoxes)
+        {
+            BITMAP bmp;
+            hbitmapCheckBoxes = LoadBitmap(0, MAKEINTRESOURCE(OBM_CHECKBOXES));
+            GetObject( hbitmapCheckBoxes, sizeof(bmp), (LPSTR)&bmp );
+            checkBoxWidth  = bmp.bmWidth / 4;
+            checkBoxHeight = bmp.bmHeight / 3;
+        }
+        if (style < 0L || style >= MAX_BTN_TYPE) return -1; /* abort */
+        infoPtr->state = BUTTON_UNCHECKED;
+        infoPtr->hFont = 0;
+        return 0;
 
-        case WM_ERASEBKGND:
+    case WM_ERASEBKGND:
+        break;
+
+    case WM_PAINT:
+        if (btnPaintFunc[style])
+        {
+            PAINTSTRUCT16 ps;
+            HDC hdc = BeginPaint16( hWnd, &ps );
+            (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
+            EndPaint16( hWnd, &ps );
+        }
+        break;
+
+    case WM_LBUTTONDOWN:
+        SendMessage32A( hWnd, BM_SETSTATE32, TRUE, 0 );
+        SetFocus( hWnd );
+        SetCapture( hWnd );
+        break;
+
+    case WM_LBUTTONUP:
+        ReleaseCapture();
+        if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
+        SendMessage16( hWnd, BM_SETSTATE16, FALSE, 0 );
+        GetClientRect16( hWnd, &rect );
+        if (PtInRect16( &rect, MAKEPOINT16(lParam) ))
+        {
+            switch(style)
+            {
+            case BS_AUTOCHECKBOX:
+                SendMessage32A( hWnd, BM_SETCHECK32,
+                                !(infoPtr->state & BUTTON_CHECKED), 0 );
                 break;
-
-	case WM_PAINT:
-                if (btnPaintFunc[style])
-                {
-                    PAINTSTRUCT16 ps;
-                    HDC hdc = BeginPaint16( hWnd, &ps );
-                    (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
-                    EndPaint16( hWnd, &ps );
-                }
-		break;
-
-	case WM_LBUTTONDOWN:
-                SendMessage( hWnd, BM_SETSTATE16, TRUE, 0 );
-                SetFocus( hWnd );
-                SetCapture( hWnd );
-		break;
-
-	case WM_LBUTTONUP:
-	        ReleaseCapture();
-	        if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
-                SendMessage( hWnd, BM_SETSTATE16, FALSE, 0 );
-                GetClientRect16( hWnd, &rect );
-                if (PtInRect16( &rect, MAKEPOINT16(lParam) ))
-                {
-                    switch(style)
-                    {
-                    case BS_AUTOCHECKBOX:
-                        SendMessage( hWnd, BM_SETCHECK16,
-                                    !(infoPtr->state & BUTTON_CHECKED), 0 );
-                        break;
-                    case BS_AUTORADIOBUTTON:
-                        SendMessage( hWnd, BM_SETCHECK16, TRUE, 0 );
-                        break;
-                    case BS_AUTO3STATE:
-                        SendMessage( hWnd, BM_SETCHECK16,
-                                     (infoPtr->state & BUTTON_3STATE) ? 0 :
-                                     ((infoPtr->state & 3) + 1), 0 );
-                        break;
-                    }
-#ifdef WINELIB32
-                    SendMessage( GetParent(hWnd), WM_COMMAND,
-                                 MAKEWPARAM(wndPtr->wIDmenu,BN_CLICKED), hWnd);
-#else
-                    SendMessage( GetParent(hWnd), WM_COMMAND,
-                                 wndPtr->wIDmenu, MAKELPARAM(hWnd,BN_CLICKED));
-#endif
-                }
-		break;
-
-        case WM_MOUSEMOVE:
-                if (GetCapture() == hWnd)
-                {
-                    GetClientRect16( hWnd, &rect );
-                    SendMessage(hWnd, BM_SETSTATE16,
-                                PtInRect16( &rect,MAKEPOINT16(lParam) ), 0 );
-                }
+            case BS_AUTORADIOBUTTON:
+                SendMessage32A( hWnd, BM_SETCHECK32, TRUE, 0 );
                 break;
-
-        case WM_NCHITTEST:
-                if(style == BS_GROUPBOX) return HTTRANSPARENT;
-                lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
+            case BS_AUTO3STATE:
+                SendMessage32A( hWnd, BM_SETCHECK32,
+                                (infoPtr->state & BUTTON_3STATE) ? 0 :
+                                ((infoPtr->state & 3) + 1), 0 );
                 break;
+            }
+            SendMessage32A( GetParent(hWnd), WM_COMMAND,
+                            MAKEWPARAM( wndPtr->wIDmenu, BN_CLICKED ), hWnd);
+        }
+        break;
 
-        case WM_SETTEXT:
-		DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) );
-                PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
-		return 0;
+    case WM_MOUSEMOVE:
+        if (GetCapture() == hWnd)
+        {
+            GetClientRect16( hWnd, &rect );
+            SendMessage32A( hWnd, BM_SETSTATE32,
+                            PtInRect16( &rect,MAKEPOINT16(lParam) ), 0 );
+        }
+        break;
 
-        case WM_SETFONT:
-                infoPtr->hFont = (HFONT) wParam;
-                if (lParam)
-                    PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
-                break;
+    case WM_NCHITTEST:
+        if(style == BS_GROUPBOX) return HTTRANSPARENT;
+        return DefWindowProc32A( hWnd, uMsg, wParam, lParam );
 
-        case WM_GETFONT:
-                return infoPtr->hFont;
+    case WM_SETTEXT:
+        DEFWND_SetText( wndPtr, (LPSTR)lParam );
+        PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+        return 0;
 
-	case WM_SETFOCUS:
-                infoPtr->state |= BUTTON_HASFOCUS;
-                PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
-		break;
+    case WM_SETFONT:
+        infoPtr->hFont = (HFONT) wParam;
+        if (lParam) PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+        break;
 
-	case WM_KILLFOCUS:
-                infoPtr->state &= ~BUTTON_HASFOCUS;
-                PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
-		break;
+    case WM_GETFONT:
+        return infoPtr->hFont;
 
-	case WM_SYSCOLORCHANGE:
-		InvalidateRect32( hWnd, NULL, FALSE );
-		break;
+    case WM_SETFOCUS:
+        infoPtr->state |= BUTTON_HASFOCUS;
+        PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
+        break;
 
-	case BM_SETSTYLE16:
-	case BM_SETSTYLE32:
-		if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
-		wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0) 
-		                   | (wParam & 0x0000000f);
-                style = wndPtr->dwStyle & 0x0000000f;
-                PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
-		break;
+    case WM_KILLFOCUS:
+        infoPtr->state &= ~BUTTON_HASFOCUS;
+        PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
+        break;
 
-	case BM_GETCHECK16:
-	case BM_GETCHECK32:
-		lResult = infoPtr->state & 3;
-		break;
+    case WM_SYSCOLORCHANGE:
+        InvalidateRect32( hWnd, NULL, FALSE );
+        break;
 
-	case BM_SETCHECK16:
-	case BM_SETCHECK32:
-                if (wParam > maxCheckState[style])
-                    wParam = maxCheckState[style];
-		if ((infoPtr->state & 3) != wParam)
-                {
-                    infoPtr->state = (infoPtr->state & ~3) | wParam;
-                    PAINT_BUTTON( wndPtr, style, ODA_SELECT );
-                }
-		if(style == BS_AUTORADIOBUTTON && wParam==BUTTON_CHECKED)
-			BUTTON_CheckAutoRadioButton( wndPtr );
-                break;
+    case BM_SETSTYLE16:
+    case BM_SETSTYLE32:
+        if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
+        wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0) 
+                           | (wParam & 0x0000000f);
+        style = wndPtr->dwStyle & 0x0000000f;
+        PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+        break;
 
-	case BM_GETSTATE16:
-	case BM_GETSTATE32:
-		lResult = infoPtr->state;
-		break;
+    case BM_GETCHECK16:
+    case BM_GETCHECK32:
+        return infoPtr->state & 3;
 
-	case BM_SETSTATE16:
-	case BM_SETSTATE32:
-                if (wParam)
-                {
-                    if (infoPtr->state & BUTTON_HIGHLIGHTED) break;
-                    infoPtr->state |= BUTTON_HIGHLIGHTED;
-                }
-                else
-                {
-                    if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
-                    infoPtr->state &= ~BUTTON_HIGHLIGHTED;
-                }
-                PAINT_BUTTON( wndPtr, style, ODA_SELECT );
-                break;
+    case BM_SETCHECK16:
+    case BM_SETCHECK32:
+        if (wParam > maxCheckState[style]) wParam = maxCheckState[style];
+        if ((infoPtr->state & 3) != wParam)
+        {
+            infoPtr->state = (infoPtr->state & ~3) | wParam;
+            PAINT_BUTTON( wndPtr, style, ODA_SELECT );
+        }
+        if ((style == BS_AUTORADIOBUTTON) && (wParam == BUTTON_CHECKED))
+            BUTTON_CheckAutoRadioButton( wndPtr );
+        break;
 
-	default:
-		lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
-		break;
-	}
+    case BM_GETSTATE16:
+    case BM_GETSTATE32:
+        return infoPtr->state;
 
-	return lResult;
+    case BM_SETSTATE16:
+    case BM_SETSTATE32:
+        if (wParam)
+        {
+            if (infoPtr->state & BUTTON_HIGHLIGHTED) break;
+            infoPtr->state |= BUTTON_HIGHLIGHTED;
+        }
+        else
+        {
+            if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
+            infoPtr->state &= ~BUTTON_HIGHLIGHTED;
+        }
+        PAINT_BUTTON( wndPtr, style, ODA_SELECT );
+        break;
+
+    default:
+        return DefWindowProc32A(hWnd, uMsg, wParam, lParam);
+    }
+    return 0;
 }
 
 
@@ -283,7 +254,6 @@
     RECT16 rc;
     HPEN16 hOldPen;
     HBRUSH hOldBrush;
-    char *text;
     DWORD dwTextSize;
     TEXTMETRIC tm;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
@@ -324,18 +294,25 @@
     else GRAPH_DrawReliefRect( hDC, &rc, 2, 2, FALSE );
     
     /* draw button label, if any: */
-    text = (char*) USER_HEAP_LIN_ADDR( wndPtr->hText );
-    if (text && text[0])
+    if (wndPtr->text && wndPtr->text[0])
     {
+     LOGBRUSH lb;
+     GetObject(sysColorObjects.hbrushBtnFace,sizeof(LOGBRUSH),(LPSTR)&lb);
+     if (wndPtr->dwStyle & WS_DISABLED &&
+         GetSysColor(COLOR_GRAYTEXT)==lb.lbColor)
+         /* don't write gray text on gray bkg */
+         PB_PaintGrayOnGray(hDC,infoPtr->hFont,&rc,wndPtr->text);
+     else
+     {
         SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
                      GetSysColor(COLOR_GRAYTEXT) : GetSysColor(COLOR_BTNTEXT));
-        DrawText16( hDC, text, -1, &rc,
+        DrawText16( hDC, wndPtr->text, -1, &rc,
                     DT_SINGLELINE | DT_CENTER | DT_VCENTER );
         /* do we have the focus? */
         if (infoPtr->state & BUTTON_HASFOCUS)
         {
             short xdelta, ydelta;
-            dwTextSize = GetTextExtent( hDC, text, strlen(text) );
+            dwTextSize = GetTextExtent(hDC,wndPtr->text,strlen(wndPtr->text));
             GetTextMetrics( hDC, &tm );
             xdelta = ((rc.right - rc.left) - LOWORD(dwTextSize) - 1) / 2;
             ydelta = ((rc.bottom - rc.top) - tm.tmHeight - 1) / 2;
@@ -344,6 +321,7 @@
             InflateRect16( &rc, -xdelta, -ydelta );
             DrawFocusRect16( hDC, &rc );
         }
+     }   
     }
 
     SelectObject( hDC, hOldPen );
@@ -352,6 +330,40 @@
 
 
 /**********************************************************************
+ *   Push Button sub function                               [internal]
+ *   using a raster brush to avoid gray text on gray background
+ */
+
+void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT16 *rc,char *text)
+{
+    static int Pattern[] = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55};
+    HBITMAP hbm  = CreateBitmap(8, 8, 1, 1, Pattern);
+    HDC hdcMem   = CreateCompatibleDC(hDC);
+    HBITMAP hbmMem;
+    HBRUSH hBr;
+    RECT16 rect,rc2;
+
+    rect=*rc;
+    DrawText16( hDC, text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
+    rc2=rect;
+    rect.left=(rc->right-rect.right)/2;       /* for centering text bitmap */
+    rect.top=(rc->bottom-rect.bottom)/2;
+    hbmMem = CreateCompatibleBitmap( hDC,rect.right,rect.bottom);
+    SelectObject( hdcMem, hbmMem);
+    hBr = SelectObject( hdcMem,CreatePatternBrush(hbm));
+    DeleteObject( hbm);
+    PatBlt( hdcMem,0,0,rect.right,rect.bottom,WHITENESS);
+    if (hFont) SelectObject( hdcMem, hFont);
+    DrawText16( hdcMem, text, -1, &rc2, DT_SINGLELINE);  
+    PatBlt( hdcMem,0,0,rect.right,rect.bottom,0xFA0089);
+    DeleteObject( SelectObject( hdcMem,hBr));
+    BitBlt( hDC,rect.left,rect.top,rect.right,rect.bottom,hdcMem,0,0,0x990000);
+    DeleteDC( hdcMem);
+    DeleteObject( hbmMem);
+}
+
+
+/**********************************************************************
  *       Check Box & Radio Button Functions
  */
 
@@ -360,7 +372,6 @@
     RECT16 rc;
     HBRUSH hBrush;
     int textlen, delta, x, y;
-    char *text;
     TEXTMETRIC tm;
     SIZE16 size;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
@@ -385,20 +396,21 @@
                       x, y, checkBoxWidth, checkBoxHeight );
     rc.left += checkBoxWidth + tm.tmAveCharWidth / 2;
 
-    if (!(text = (char*) USER_HEAP_LIN_ADDR( wndPtr->hText ))) return;
-    textlen = strlen( text );
+    if (!wndPtr->text) return;
+    textlen = strlen( wndPtr->text );
 
     if (action == ODA_DRAWENTIRE)
     {
         if (wndPtr->dwStyle & WS_DISABLED)
             SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
-        DrawText16( hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER );
+        DrawText16( hDC, wndPtr->text, textlen, &rc,
+                    DT_SINGLELINE | DT_VCENTER );
     }
     
     if ((action == ODA_FOCUS) ||
         ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
     {
-        GetTextExtentPoint16( hDC, text, textlen, &size );
+        GetTextExtentPoint16( hDC, wndPtr->text, textlen, &size );
         if (delta > 1)
         {
             rc.top += delta - 1;
@@ -424,7 +436,7 @@
     for(sibling = GetNextDlgGroupItem(parent,wndPtr->hwndSelf,FALSE);
         sibling != wndPtr->hwndSelf;
         sibling = GetNextDlgGroupItem(parent,sibling,FALSE))
-	    SendMessage( sibling, BM_SETCHECK16, BUTTON_UNCHECKED, 0 );
+	    SendMessage32A( sibling, BM_SETCHECK32, BUTTON_UNCHECKED, 0 );
 }
 
 
@@ -435,7 +447,6 @@
 static void GB_Paint( WND *wndPtr, HDC hDC, WORD action )
 {
     RECT16 rc;
-    char *text;
     SIZE16 size;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
 
@@ -453,14 +464,14 @@
     LineTo( hDC, rc.left, rc.bottom-1 );
     LineTo( hDC, rc.left, rc.top+2 );
 
-    if (!(text = (char*) USER_HEAP_LIN_ADDR( wndPtr->hText ))) return;
-    GetTextExtentPoint16( hDC, text, strlen(text), &size );
+    if (!wndPtr->text) return;
+    GetTextExtentPoint16( hDC, wndPtr->text, strlen(wndPtr->text), &size );
     rc.left  += 10;
     rc.right  = rc.left + size.cx + 1;
     rc.bottom = size.cy;
     if (wndPtr->dwStyle & WS_DISABLED)
         SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
-    DrawText16( hDC, text, -1, &rc, DT_SINGLELINE );
+    DrawText16( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE );
 }
 
 
@@ -494,22 +505,19 @@
 
 static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
 {
-    DRAWITEMSTRUCT16 *dis;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
+    DRAWITEMSTRUCT32 dis;
 
-    if (!(dis = SEGPTR_NEW(DRAWITEMSTRUCT16))) return;
-    dis->CtlType    = ODT_BUTTON;
-    dis->CtlID      = wndPtr->wIDmenu;
-    dis->itemID     = 0;
-    dis->itemAction = action;
-    dis->itemState  = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 |
+    dis.CtlType    = ODT_BUTTON;
+    dis.CtlID      = wndPtr->wIDmenu;
+    dis.itemID     = 0;
+    dis.itemAction = action;
+    dis.itemState  = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 |
                      (infoPtr->state & BUTTON_HIGHLIGHTED) ? ODS_SELECTED : 0 |
                      (wndPtr->dwStyle & WS_DISABLED) ? ODS_DISABLED : 0;
-    dis->hwndItem   = wndPtr->hwndSelf;
-    dis->hDC        = hDC;
-    GetClientRect16( wndPtr->hwndSelf, &dis->rcItem );
-    dis->itemData   = 0;
-    SendMessage( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, 1,
-                 (LPARAM)SEGPTR_GET(dis) );
-    SEGPTR_FREE(dis);
+    dis.hwndItem   = wndPtr->hwndSelf;
+    dis.hDC        = hDC;
+    dis.itemData   = 0;
+    GetClientRect32( wndPtr->hwndSelf, &dis.rcItem );
+    SendMessage32A( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, 1, (LPARAM)&dis);
 }