Index: trunk/src/user32/new/initterm.cpp
===================================================================
--- trunk/src/user32/new/initterm.cpp	(revision 301)
+++ trunk/src/user32/new/initterm.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: initterm.cpp,v 1.1 1999-07-14 08:35:34 sandervl Exp $ */
+/* $Id: initterm.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
 
 /*
@@ -27,5 +27,5 @@
 #define  INCL_DOSMODULEMGR
 #define  INCL_DOSPROCESS
-#include <os2wrap.h>	//Odin32 OS/2 api wrappers
+#include <os2wrap.h>    //Odin32 OS/2 api wrappers
 #include <stdlib.h>
 #include <stdio.h>
@@ -95,5 +95,5 @@
          if (CRT_init() == -1)
             return 0UL;
-     	 _ctordtorInit();
+         _ctordtorInit();
 
          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
@@ -105,20 +105,20 @@
          rc = DosExitList(0x0000FF00|EXLST_ADD, cleanup);
          if(rc)
-        	return 0UL;
+                return 0UL;
 
          rc = DosExitList(0x00008000|EXLST_ADD, cleanupQueue);
          if(rc)
-        	return 0UL;
+                return 0UL;
 
          //SvL: 18-7-'98, Register system window classes (button, listbox etc etc)
-     	 RegisterSystemClasses(hModule);
+         RegisterSystemClasses(hModule);
 
-	 //SvL: Try to start communication with our message spy queue server
-	 InitSpyQueue();
+         //SvL: Try to start communication with our message spy queue server
+         InitSpyQueue();
 
-	 //SvL: Init win32 PM classes
-	 if(InitPM() == FALSE) {
-		return 0UL;
-	 }
+         //SvL: Init win32 PM classes
+         if(InitPM() == FALSE) {
+                return 0UL;
+         }
          break;
       case 1 :
Index: trunk/src/user32/new/menu.cpp
===================================================================
--- trunk/src/user32/new/menu.cpp	(revision 301)
+++ trunk/src/user32/new/menu.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: menu.cpp,v 1.1 1999-07-14 08:35:35 sandervl Exp $ */
+/* $Id: menu.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
 
 /*
@@ -17,4 +17,5 @@
  */
 #include <os2win.h>
+#include <stdlib.h>
 
 //******************************************************************************
@@ -88,8 +89,8 @@
     free(astring);
     if(rc) {
-		dprintf(("USER32: OS2GetMenuStringW %s\n", astring));
-		AsciiToUnicode(astring, lpsz);
+                dprintf(("USER32: OS2GetMenuStringW %s\n", astring));
+                AsciiToUnicode(astring, lpsz);
     }
-    else	lpsz[0] = 0;
+    else        lpsz[0] = 0;
     return(rc);
 }
@@ -158,5 +159,5 @@
 #endif
   if(lpPM->cbSize != 0)
-	rect = &lpPM->rcExclude;
+        rect = &lpPM->rcExclude;
 
   return O32_TrackPopupMenu(hmenu, flags, X, Y, 0, hwnd, rect);
@@ -165,5 +166,5 @@
 //******************************************************************************
 BOOL WIN32API AppendMenuA(HMENU hMenu, UINT uFlags, UINT ulDNewItem,
-			     LPCSTR lpNewItem)
+                             LPCSTR lpNewItem)
 {
 #ifdef DEBUG
@@ -173,5 +174,5 @@
 
     if(uFlags & MF_STRING || uFlags == 0)
-	    WriteLog("USER32:  OS2AppendMenuA %s\n", lpNewItem);
+            WriteLog("USER32:  OS2AppendMenuA %s\n", lpNewItem);
 
     rc = O32_AppendMenu(hMenu, uFlags, ulDNewItem, lpNewItem);
@@ -358,5 +359,5 @@
 //******************************************************************************
 BOOL WIN32API CheckMenuRadioItem(HMENU hmenu, UINT idFirst, UINT idLast,
-				    UINT idCheck, UINT uFlags)
+                                    UINT idCheck, UINT uFlags)
 {
 #ifdef DEBUG
@@ -407,5 +408,5 @@
 //******************************************************************************
 BOOL WIN32API SetMenuItemInfoA(HMENU hmenu, UINT par1, BOOL par2,
-			       const MENUITEMINFOA * lpMenuItemInfo)
+                               const MENUITEMINFOA * lpMenuItemInfo)
 {
 #ifdef DEBUG
Index: trunk/src/user32/new/oslibwin.cpp
===================================================================
--- trunk/src/user32/new/oslibwin.cpp	(revision 301)
+++ trunk/src/user32/new/oslibwin.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.1 1999-07-14 08:35:35 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -24,5 +24,5 @@
   if(hwndParent == OSLIB_HWND_DESKTOP)
   {
-	hwndParent = HWND_DESKTOP;
+        hwndParent = HWND_DESKTOP;
   }
 
@@ -40,26 +40,26 @@
 
   if(hwndParent == 0) {
-	hwndParent = HWND_DESKTOP;
+        hwndParent = HWND_DESKTOP;
   }
   if(WinQueryWindowRect(hwndParent, &rectl) == 0) {
-	y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
+        y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
   }
   if(dwFrameStyle) {
-	dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
-  	hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, 
-				       &dwFrameStyle, WIN32_STDCLASS,
+        dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
+        hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
+                                       &dwFrameStyle, WIN32_STDCLASS,
                                        "", 0, 0, 0, &hwndClient) != 0;
-	if(hwndFrame) {
-		if(pszName) {
-			WinSetWindowText(hwndFrame, pszName);
-		}
-  		WinSetWindowPos(hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP,  
-                   		x, y, cx, cy, SWP_SIZE | SWP_MOVE);
+        if(hwndFrame) {
+                if(pszName) {
+                        WinSetWindowText(hwndFrame, pszName);
+                }
+                WinSetWindowPos(hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP,
+                                x, y, cx, cy, SWP_SIZE | SWP_MOVE);
 
-		return hwndFrame;
-	}
-	return 0;
+                return hwndFrame;
+        }
+        return 0;
   }
-  else 	return WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy,
+  else  return WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy,
                                Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
                                NULL);
@@ -74,38 +74,38 @@
   /* Window styles */
   if(dwStyle & WINWS_MINIMIZE)
-	*OSWinStyle |= WS_MINIMIZED;
+        *OSWinStyle |= WS_MINIMIZED;
   if(dwStyle & WINWS_VISIBLE)
-	*OSWinStyle |= WS_VISIBLE;
+        *OSWinStyle |= WS_VISIBLE;
   if(dwStyle & WINWS_DISABLED)
-	*OSWinStyle |= WS_DISABLED;
+        *OSWinStyle |= WS_DISABLED;
   if(dwStyle & WINWS_CLIPSIBLINGS)
-	*OSWinStyle |= WS_CLIPSIBLINGS;
+        *OSWinStyle |= WS_CLIPSIBLINGS;
   if(dwStyle & WINWS_CLIPCHILDREN)
-	*OSWinStyle |= WS_CLIPCHILDREN;
+        *OSWinStyle |= WS_CLIPCHILDREN;
   if(dwStyle & WINWS_MAXIMIZE)
-	*OSWinStyle |= WS_MAXIMIZED;
+        *OSWinStyle |= WS_MAXIMIZED;
   if(dwStyle & WINWS_GROUP)
-	*OSWinStyle |= WS_GROUP;
+        *OSWinStyle |= WS_GROUP;
   if(dwStyle & WINWS_TABSTOP)
-	*OSWinStyle |= WS_TABSTOP;
+        *OSWinStyle |= WS_TABSTOP;
 
   if(dwStyle & WINWS_CAPTION)
-	*OSFrameStyle |= FCF_TITLEBAR;
+        *OSFrameStyle |= FCF_TITLEBAR;
   if(dwStyle & WINWS_BORDER)
-	*OSFrameStyle |= FCF_BORDER;
+        *OSFrameStyle |= FCF_BORDER;
   if(dwStyle & WINWS_DLGFRAME)
-	*OSFrameStyle |= FCF_DLGBORDER;
+        *OSFrameStyle |= FCF_DLGBORDER;
   if(dwStyle & WINWS_VSCROLL)
-	*OSFrameStyle |= FCF_VERTSCROLL;
+        *OSFrameStyle |= FCF_VERTSCROLL;
   if(dwStyle & WINWS_HSCROLL)
-	*OSFrameStyle |= FCF_HORZSCROLL;
+        *OSFrameStyle |= FCF_HORZSCROLL;
   if(dwStyle & WINWS_SYSMENU)
-	*OSFrameStyle |= FCF_SYSMENU;
+        *OSFrameStyle |= FCF_SYSMENU;
   if(dwStyle & WINWS_THICKFRAME)
-	*OSFrameStyle |= FCF_SIZEBORDER;	//??
+        *OSFrameStyle |= FCF_SIZEBORDER;        //??
   if(dwStyle & WINWS_MINIMIZEBOX)
-	*OSFrameStyle |= FCF_MINBUTTON;
+        *OSFrameStyle |= FCF_MINBUTTON;
   if(dwStyle & WINWS_MAXIMIZEBOX)
-	*OSFrameStyle |= FCF_MAXBUTTON;
+        *OSFrameStyle |= FCF_MAXBUTTON;
 
   return TRUE;
@@ -115,5 +115,5 @@
 BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
 {
-  return WinSetWindowULong(hwnd, offset, value) == 0;
+  return WinSetWindowULong(hwnd, offset, value);
 }
 //******************************************************************************
@@ -121,5 +121,5 @@
 ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
 {
-  return WinGetWindowULong(hwnd, offset);
+  return WinQueryWindowULong(hwnd, offset);
 }
 //******************************************************************************
Index: trunk/src/user32/new/pmwindow.cpp
===================================================================
--- trunk/src/user32/new/pmwindow.cpp	(revision 301)
+++ trunk/src/user32/new/pmwindow.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.2 1999-07-14 08:35:35 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.3 1999-07-14 21:05:58 cbratschi Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -36,6 +36,17 @@
 
   if(!hab || !hmq) {
-	dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
-	return(FALSE);
+        UINT error;
+
+        //CB: only fail on real error
+        error = WinGetLastError(hab) & 0xFFFF; //error code
+        if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
+        {
+          dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
+          dprintf((" Error = %x",error));
+          return(FALSE);
+        } else
+        {
+          //CB: get queue handle (todo)
+        }
   }
 
@@ -46,6 +57,6 @@
      CS_SIZEREDRAW,                     /* Class style                  */
      8)) {
-	dprintf(("WinRegisterClass Win32Window failed"));
-	return(FALSE);
+        dprintf(("WinRegisterClass Win32Window failed"));
+        return(FALSE);
    }
 
@@ -68,42 +79,42 @@
 
   if(msg != WM_CREATE && win32wnd == NULL && magic != WIN32PM_MAGIC) {
-	dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
-	goto RunDefWndProc;
+        dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
+        goto RunDefWndProc;
   }
   switch( msg )
-  {	
+  {
     case WM_CREATE:
-	//Processing is done in after WinCreateWindow returns
-      	break;
-	
+        //Processing is done in after WinCreateWindow returns
+        break;
+
     case WM_QUIT:
-	if(win32wnd->MsgQuit()) {
-		goto RunDefWndProc;
-	}
-      	break;
-	
+        if(win32wnd->MsgQuit()) {
+                goto RunDefWndProc;
+        }
+        break;
+
     case WM_CLOSE:
-	if(win32wnd->MsgClose()) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgClose()) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_DESTROY:
-	if(win32wnd->MsgDestroy()) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgDestroy()) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_ENABLE:
-	if(win32wnd->MsgEnable((ULONG)mp1)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgEnable((ULONG)mp1)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_SHOW:
-	if(win32wnd->MsgShow((ULONG)mp1)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgShow((ULONG)mp1)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_MOVE:
@@ -114,61 +125,61 @@
      ULONG  xScreen, yScreen, yParent, xParent;
 
-	rc = WinQueryWindowRect(hwnd, &rectl);
-	if(rc == TRUE) {
-		point.x = rectl.xLeft;
-		point.y = rectl.yBottom;
-
-		//If the window has a parent, calculate position relative to that window
-		if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) {
-			rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1);
-			if(rc == FALSE) {
-				dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!"));
-				break;
-			}
-			rc = WinQueryWindowRect(hwndParent, &rectl2);
-			if(rc == FALSE) {
-				dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
-				break;
-			}
-			yParent = point.x;
-			yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);
-		}
-		else	xParent = yParent = -1;
-
-		point.x = rectl.xLeft;
-		point.y = rectl.yBottom;
-
-		rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1);
-		if(rc == FALSE) {
-			dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!"));
-			break;
-		}
-		rc = WinQueryWindowRect(HWND_DESKTOP, &rectl);
-		if(rc == FALSE) {
-			dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
-			break;
-		}
-		xScreen = point.x;
-		yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y);
-
-		if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) {
-			goto RunDefWndProc;
-		}
-	}
-	else {
-		dprintf(("WM_MOVE: WinQueryWindowRect failed!"));
-	}
-	break;
+        rc = WinQueryWindowRect(hwnd, &rectl);
+        if(rc == TRUE) {
+                point.x = rectl.xLeft;
+                point.y = rectl.yBottom;
+
+                //If the window has a parent, calculate position relative to that window
+                if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) {
+                        rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1);
+                        if(rc == FALSE) {
+                                dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!"));
+                                break;
+                        }
+                        rc = WinQueryWindowRect(hwndParent, &rectl2);
+                        if(rc == FALSE) {
+                                dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
+                                break;
+                        }
+                        yParent = point.x;
+                        yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);
+                }
+                else    xParent = yParent = -1;
+
+                point.x = rectl.xLeft;
+                point.y = rectl.yBottom;
+
+                rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1);
+                if(rc == FALSE) {
+                        dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!"));
+                        break;
+                }
+                rc = WinQueryWindowRect(HWND_DESKTOP, &rectl);
+                if(rc == FALSE) {
+                        dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));
+                        break;
+                }
+                xScreen = point.x;
+                yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y);
+
+                if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) {
+                        goto RunDefWndProc;
+                }
+        }
+        else {
+                dprintf(("WM_MOVE: WinQueryWindowRect failed!"));
+        }
+        break;
     }
 
     case WM_WINDOWPOSCHANGED:
     {
-	break;
+        break;
     }
 
     case WM_ADJUSTWINDOWPOS:
     {
-//	if(win32wnd->MsgWindowPosChanging(0, 0)) {
-	break;
+//      if(win32wnd->MsgWindowPosChanging(0, 0)) {
+        break;
     }
 
@@ -177,16 +188,16 @@
      HPS hps;
 
-	hps = WinGetPS(hwnd);
-	if(win32wnd->MsgEraseBackGround((ULONG)hps))
+        hps = WinGetPS(hwnd);
+        if(win32wnd->MsgEraseBackGround((ULONG)hps))
         {
-	        /*
-	         * Return TRUE to request PM to paint the window background
-	         * in SYSCLR_WINDOW.
-	         */
-		WinReleasePS(hps);
-	       	return (MRESULT)( TRUE );
-	}
-	WinReleasePS(hps);
-	return (MRESULT) FALSE;
+                /*
+                 * Return TRUE to request PM to paint the window background
+                 * in SYSCLR_WINDOW.
+                 */
+                WinReleasePS(hps);
+                return (MRESULT)( TRUE );
+        }
+        WinReleasePS(hps);
+        return (MRESULT) FALSE;
     }
     case WM_SIZE:
@@ -194,17 +205,17 @@
      SWP swp;
 
-	rc = WinQueryWindowPos(hwnd, &swp);
-	if(rc == FALSE) {
-		dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
-		break;
-	}
-	if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), 
-		                (swp.fl & SWP_MINIMIZE) != 0, 
-                                (swp.fl & SWP_MAXIMIZE) != 0)) 
+        rc = WinQueryWindowPos(hwnd, &swp);
+        if(rc == FALSE) {
+                dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
+                break;
+        }
+        if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
+                                (swp.fl & SWP_MINIMIZE) != 0,
+                                (swp.fl & SWP_MAXIMIZE) != 0))
         {
-		goto RunDefWndProc;
-	}
-
-	break;
+                goto RunDefWndProc;
+        }
+
+        break;
     }
 
@@ -213,16 +224,16 @@
       HWND hwndActivate = (HWND)mp1;
 
-	if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
-		//another (non-win32) application's window
-		//set to NULL (allowed according to win32 SDK) to avoid problems
-		hwndActivate = NULL;
-	}
-	if(win32wnd->MsgActivate(1, hwndActivate)) {
-		goto RunDefWndProc;
-	}
-    	break;
+        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
+                //another (non-win32) application's window
+                //set to NULL (allowed according to win32 SDK) to avoid problems
+                hwndActivate = NULL;
+        }
+        if(win32wnd->MsgActivate(1, hwndActivate)) {
+                goto RunDefWndProc;
+        }
+        break;
     }
     case WM_FOCUSCHANGE:
-	break;
+        break;
 
     case WM_SETFOCUS:
@@ -230,17 +241,17 @@
       HWND hwndFocus = (HWND)mp1;
 
-	if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
-		//another (non-win32) application's window
-		//set to NULL (allowed according to win32 SDK) to avoid problems
-		hwndFocus = NULL;
-	}
-	if((ULONG)mp2 == TRUE) {
-		rc = win32wnd->MsgSetFocus(hwndFocus);
-	}
-	else	rc = win32wnd->MsgKillFocus(hwndFocus);
-	if(rc) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
+                //another (non-win32) application's window
+                //set to NULL (allowed according to win32 SDK) to avoid problems
+                hwndFocus = NULL;
+        }
+        if((ULONG)mp2 == TRUE) {
+                rc = win32wnd->MsgSetFocus(hwndFocus);
+        }
+        else    rc = win32wnd->MsgKillFocus(hwndFocus);
+        if(rc) {
+                goto RunDefWndProc;
+        }
+        break;
     }
     //**************************************************************************
@@ -248,33 +259,33 @@
     //**************************************************************************
     case WM_BUTTON1DOWN:
-	if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON1UP:
-	if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON1DBLCLK:
-	if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2DOWN:
-	if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2UP:
-	if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2DBLCLK:
-	if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
+                goto RunDefWndProc;
+        }
+        break;
     case WM_BUTTON2MOTIONSTART:
     case WM_BUTTON2MOTIONEND:
@@ -289,8 +300,8 @@
     case WM_BUTTON3MOTIONEND:
     case WM_BUTTON3CLICK:
-	break;
+        break;
 
     case WM_MOUSEMOVE:
-	break;
+        break;
 
     //**************************************************************************
@@ -298,17 +309,17 @@
     //**************************************************************************
     case WM_VSCROLL:
-	break;
+        break;
     case WM_HSCROLL:
-	break;
+        break;
 
     case WM_CONTROL:
-	break;
+        break;
 
     case WM_COMMAND:
     case WM_SYSCOMMAND:
-	break;
+        break;
 
     case WM_CHAR:
-	break;
+        break;
 
     case WM_INITMENU:
@@ -316,18 +327,18 @@
     case WM_MENUEND:
     case WM_NEXTMENU:
-	break;
+        break;
 
     case WM_TIMER:
-	break;
+        break;
 
     case WM_PAINT:
-	if(win32wnd->MsgPaint(0, 0)) {
-		goto RunDefWndProc;
-	}
-	break;
+        if(win32wnd->MsgPaint(0, 0)) {
+                goto RunDefWndProc;
+        }
+        break;
 
     case WM_SYSCOLORCHANGE:
     case WM_SYSVALUECHANGED:
-	break;
+        break;
 
     case WM_CALCVALIDRECTS:
@@ -353,14 +364,14 @@
     case WM_SAVEAPPLICATION:
     case WM_SEMANTICEVENT:
-	break;
+        break;
     default:
-	RestoreOS2TIB();	
-	return WinDefWindowProc( hwnd, msg, mp1, mp2 );
+        RestoreOS2TIB();
+        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
   }
-  RestoreOS2TIB();	
+  RestoreOS2TIB();
   return (MRESULT)FALSE;
 
 RunDefWndProc:
-  RestoreOS2TIB();	
+  RestoreOS2TIB();
   return WinDefWindowProc( hwnd, msg, mp1, mp2 );
 } /* End of Win32WindowProc */
Index: trunk/src/user32/new/win32class.cpp
===================================================================
--- trunk/src/user32/new/win32class.cpp	(revision 301)
+++ trunk/src/user32/new/win32class.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: win32class.cpp,v 1.2 1999-07-14 08:35:36 sandervl Exp $ */
+/* $Id: win32class.cpp,v 1.3 1999-07-14 21:05:58 cbratschi Exp $ */
 /*
  * Win32 Window Class Managment Code for OS/2
@@ -23,30 +23,34 @@
 {
   if(HIWORD(wndclass->lpszClassName)) {
-	if(isUnicode) {
-	  	classNameA = (PCHAR)malloc(lstrlenW((LPWSTR)wndclass->lpszClassName)+1);
-	  	classNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)wndclass->lpszClassName)+1)*sizeof(WCHAR));
-	}
-	else {
-	  	classNameA = (PCHAR)malloc(strlen(wndclass->lpszClassName)+1);
-	  	classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR));
-	}
-	if(classNameA == NULL || classNameW == NULL) {
-		dprintf(("Win32Class ctr; classNameA/classNameW == NULL"));
-		exit(1);
-	}
-	if(isUnicode) {
-		lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName);
-		UnicodeToAscii(classNameW, classNameA);
-	}
-	else {
-		strcpy((char *)classNameA, wndclass->lpszClassName);
-		AsciiToUnicode(classNameA, classNameW);
-	}
-	classAtom    	= GlobalAddAtomA(classNameA);
+        if(isUnicode) {
+                INT len = lstrlenW((LPWSTR)wndclass->lpszClassName)+1;
+
+                classNameA = (PCHAR)malloc(len);
+                classNameW = (WCHAR *)malloc(len*sizeof(WCHAR));
+        }
+        else {
+                INT len = strlen(wndclass->lpszClassName)+1;
+
+                classNameA = (PCHAR)malloc(len);
+                classNameW = (WCHAR *)malloc(len*sizeof(WCHAR));
+        }
+        if(classNameA == NULL || classNameW == NULL) {
+                dprintf(("Win32Class ctr; classNameA/classNameW == NULL"));
+                exit(1);
+        }
+        if(isUnicode) {
+                lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName);
+                UnicodeToAscii(classNameW, classNameA);
+        }
+        else {
+                strcpy((char *)classNameA, wndclass->lpszClassName);
+                AsciiToUnicode(classNameA, classNameW);
+        }
+        classAtom       = GlobalAddAtomA(classNameA);
   }
   else {
-	classNameA 	= NULL;
-	classNameW      = NULL;
-	classAtom	= (DWORD)wndclass->lpszClassName;
+        classNameA      = NULL;
+        classNameW      = NULL;
+        classAtom       = (DWORD)wndclass->lpszClassName;
   }
   this->isUnicode       = isUnicode;
@@ -62,6 +66,6 @@
   dprintf(("USER32:  wndclass->hbrBackground %X\n", wndclass->hbrBackground));
   if(HIWORD(wndclass->lpszClassName))
-       dprintf(("USER32:  wndclass->lpszClassName %X\n", wndclass->lpszClassName));
-  else dprintf(("USER32:  wndclass->lpszClassName %s\n", wndclass->lpszClassName));
+       dprintf(("USER32:  wndclass->lpszClassName %s\n", wndclass->lpszClassName));
+  else dprintf(("USER32:  wndclass->lpszClassName %X\n", wndclass->lpszClassName));
 
   if(HIWORD(wndclass->lpszMenuName)) {//convert string name identifier to numeric id
@@ -70,10 +74,10 @@
   else dprintf(("USER32:  wndclass->lpszMenuName %X\n", wndclass->lpszMenuName));
 
-  nrExtraClassWords	= wndclass->cbClsExtra;
-  nrExtraWindowWords	= wndclass->cbWndExtra;
-  backgroundBrush	= wndclass->hbrBackground;	//TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
-  hCursor		= wndclass->hCursor;
-  hIcon			= wndclass->hIcon;
-  hInstance		= wndclass->hInstance;
+  nrExtraClassWords     = wndclass->cbClsExtra;
+  nrExtraWindowWords    = wndclass->cbWndExtra;
+  backgroundBrush       = wndclass->hbrBackground;      //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
+  hCursor               = wndclass->hCursor;
+  hIcon                 = wndclass->hIcon;
+  hInstance             = wndclass->hInstance;
 
   menuNameA = 0;
@@ -81,17 +85,17 @@
   setMenuName((LPSTR)wndclass->lpszMenuName);
 
-  windowStyle		= wndclass->style;
-  windowProc		= wndclass->lpfnWndProc;
+  windowStyle           = wndclass->style;
+  windowProc            = wndclass->lpfnWndProc;
 
   //User data class words/longs
   if(nrExtraClassWords) {
-	userClassLong = (ULONG *)malloc(nrExtraClassWords);
-	if(userClassLong == NULL) {
-		dprintf(("Win32Class ctr: userClassLong == NULL!"));
-		exit(1);
-	}
-	memset(userClassLong, 0, nrExtraClassWords);
-  }
-  else	userClassLong = NULL;
+        userClassLong = (ULONG *)malloc(nrExtraClassWords);
+        if(userClassLong == NULL) {
+                dprintf(("Win32Class ctr: userClassLong == NULL!"));
+                exit(1);
+        }
+        memset(userClassLong, 0, nrExtraClassWords);
+  }
+  else  userClassLong = NULL;
 
   cWindows = 0;
@@ -102,11 +106,11 @@
 Win32WndClass::~Win32WndClass()
 {
-  if(userClassLong)	free(userClassLong);
-  if(classNameA)	free(classNameA);
-  if(classNameW)	free(classNameW);
+  if(userClassLong)     free(userClassLong);
+  if(classNameA)        free(classNameA);
+  if(classNameW)        free(classNameW);
   if(menuNameA && HIWORD(menuNameA)) {
-	free(menuNameA);
-	assert(menuNameW);
-	free(menuNameW);
+        free(menuNameA);
+        assert(menuNameW);
+        free(menuNameW);
   }
 }
@@ -117,33 +121,33 @@
   Win32WndClass *wndclass = (Win32WndClass *)wndclasses;
 
-  if(wndclass == NULL)	return(NULL);
+  if(wndclass == NULL)  return(NULL);
 
   if(HIWORD(id) != 0) {
-	if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
-		return(wndclass);
-	}
-	else {
-		wndclass = (Win32WndClass *)wndclass->GetNext();
-		while(wndclass != NULL) {
-			if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
-				return(wndclass);
-			}
-			wndclass = (Win32WndClass *)wndclass->GetNext();
-	        }
-	}
+        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
+                return(wndclass);
+        }
+        else {
+                wndclass = (Win32WndClass *)wndclass->GetNext();
+                while(wndclass != NULL) {
+                        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
+                                return(wndclass);
+                        }
+                        wndclass = (Win32WndClass *)wndclass->GetNext();
+                }
+        }
   }
   else {
-	if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
-		return(wndclass);
-	}
-	else {
-		wndclass = (Win32WndClass *)wndclass->GetNext();
-		while(wndclass != NULL) {
-			if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
-				return(wndclass);
-			}
-			wndclass = (Win32WndClass *)wndclass->GetNext();
-	        }
-	}
+        if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
+                return(wndclass);
+        }
+        else {
+                wndclass = (Win32WndClass *)wndclass->GetNext();
+                while(wndclass != NULL) {
+                        if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
+                                return(wndclass);
+                        }
+                        wndclass = (Win32WndClass *)wndclass->GetNext();
+                }
+        }
   }
   dprintf(("Class %X (inst %X) not found!", id, hInstance));
@@ -157,12 +161,12 @@
   wndclass->cbWndExtra    = nrExtraWindowWords;
   wndclass->hbrBackground = backgroundBrush;
-  wndclass->hCursor	  = hCursor;
+  wndclass->hCursor       = hCursor;
   wndclass->hIcon         = hIcon;
   wndclass->hInstance     = hInstance;
   wndclass->lpszMenuName  = (LPCTSTR)menuNameA;
   wndclass->lpszClassName = (classNameA) ? (LPCTSTR)classNameA : (LPCTSTR)classAtom;
-  wndclass->style	  = windowStyle;
-  wndclass->lpfnWndProc	  = windowProc;
-  wndclass->hIconSm	  = hIconSm;
+  wndclass->style         = windowStyle;
+  wndclass->lpfnWndProc   = windowProc;
+  wndclass->hIconSm       = hIconSm;
   return(TRUE);
 }
@@ -174,12 +178,12 @@
   wndclass->cbWndExtra    = nrExtraWindowWords;
   wndclass->hbrBackground = backgroundBrush;
-  wndclass->hCursor	  = hCursor;
+  wndclass->hCursor       = hCursor;
   wndclass->hIcon         = hIcon;
   wndclass->hInstance     = hInstance;
   wndclass->lpszMenuName  = (LPCWSTR)menuNameW;
   wndclass->lpszClassName = (classNameW) ? (LPCWSTR)classNameW : (LPCWSTR)classAtom;
-  wndclass->style	  = windowStyle;
-  wndclass->lpfnWndProc	  = windowProc;
-  wndclass->hIconSm	  = hIconSm;
+  wndclass->style         = windowStyle;
+  wndclass->lpfnWndProc   = windowProc;
+  wndclass->hIconSm       = hIconSm;
   return(TRUE);
 }
@@ -189,6 +193,6 @@
 {
   if(HIWORD(classNameA)) {
-	strncpy(lpszClassName, classNameA, cchClassName-1);
-	return strlen(lpszClassName);
+        strncpy(lpszClassName, classNameA, cchClassName-1);
+        return strlen(lpszClassName);
   }
   *(ULONG *)lpszClassName = classAtom;
@@ -202,6 +206,6 @@
 
   if(HIWORD(classNameW)) {
-	lstrcpyW(lpszClassName, classNameW);
-	return lstrlenW(lpszClassName)*sizeof(WCHAR);
+        lstrcpyW(lpszClassName, classNameW);
+        return lstrlenW(lpszClassName)*sizeof(WCHAR);
   }
   *(ULONG *)lpszClassName = classAtom;
@@ -213,34 +217,34 @@
 {
   if(HIWORD(menuNameA)) {
-	free(menuNameA);
-	free(menuNameW);
-	menuNameA = 0;
+        free(menuNameA);
+        free(menuNameW);
+        menuNameA = 0;
         menuNameW = 0;
   }
   if(HIWORD(newMenuName)) {
-	if(isUnicode) {
-	  	menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1);
-	  	menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));
-	}
-	else {
-	  	menuNameA = (PCHAR)malloc(strlen(newMenuName)+1);
-	  	menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR));
-	}
-	if(menuNameA == NULL || menuNameW == NULL) {
-		dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));
-		exit(1);
-	}
-	if(isUnicode) {
-		lstrcpyW(menuNameW, (LPWSTR)newMenuName);
-		UnicodeToAscii(menuNameW, menuNameA);
-	}
-	else {
-		strcpy((char *)menuNameA, newMenuName);
-		AsciiToUnicode(menuNameA, menuNameW);
-	}
+        if(isUnicode) {
+                menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1);
+                menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));
+        }
+        else {
+                menuNameA = (PCHAR)malloc(strlen(newMenuName)+1);
+                menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR));
+        }
+        if(menuNameA == NULL || menuNameW == NULL) {
+                dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));
+                exit(1);
+        }
+        if(isUnicode) {
+                lstrcpyW(menuNameW, (LPWSTR)newMenuName);
+                UnicodeToAscii(menuNameW, menuNameA);
+        }
+        else {
+                strcpy((char *)menuNameA, newMenuName);
+                AsciiToUnicode(menuNameA, menuNameW);
+        }
   }
   else {//id
-	menuNameA = (PCHAR)newMenuName;
-	menuNameW = (WCHAR *)newMenuName;
+        menuNameA = (PCHAR)newMenuName;
+        menuNameW = (WCHAR *)newMenuName;
   }
 }
@@ -250,31 +254,31 @@
 {
   switch(index) {
-	case GCL_CBCLSEXTRA:
-		return nrExtraClassWords;
-	case GCL_CBWNDEXTRA:
-		return nrExtraWindowWords;
-	case GCL_HBRBACKGROUND:
-		return backgroundBrush;
-	case GCL_HCURSOR:
-		return hCursor;
-	case GCL_HICON:
-		return hIcon;
-	case GCL_HMODULE:
-		return hInstance;
-	case GCL_MENUNAME:
-		return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA;
-	case GCL_STYLE:
-		return windowStyle;
-	case GCL_WNDPROC:
-		return (ULONG)windowProc;
-	case GCW_ATOM: //TODO: does this really happen in windows?
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
-	default:
-		if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
-			return userClassLong[index];
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GCL_CBCLSEXTRA:
+                return nrExtraClassWords;
+        case GCL_CBWNDEXTRA:
+                return nrExtraWindowWords;
+        case GCL_HBRBACKGROUND:
+                return backgroundBrush;
+        case GCL_HCURSOR:
+                return hCursor;
+        case GCL_HICON:
+                return hIcon;
+        case GCL_HMODULE:
+                return hInstance;
+        case GCL_MENUNAME:
+                return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA;
+        case GCL_STYLE:
+                return windowStyle;
+        case GCL_WNDPROC:
+                return (ULONG)windowProc;
+        case GCW_ATOM: //TODO: does this really happen in windows?
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
+        default:
+                if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
+                        return userClassLong[index];
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
   }
 }
@@ -284,12 +288,12 @@
 {
   switch(index) {
-	case GCW_ATOM: 
-		return (WORD)classAtom;
-	default:
-		if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
-			return ((WORD *)userClassLong)[index];
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GCW_ATOM:
+                return (WORD)classAtom;
+        default:
+                if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
+                        return ((WORD *)userClassLong)[index];
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
   }
 }
@@ -302,51 +306,51 @@
 
   switch(index) {
-	case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?)
-		rc = nrExtraClassWords;
-//		nrExtraClassWords = lNewVal;
-		break;
-	case GCL_CBWNDEXTRA:
-		rc = nrExtraWindowWords;
-		nrExtraWindowWords = lNewVal;
-		break;
-	case GCL_HBRBACKGROUND:
-		rc = backgroundBrush;
-		backgroundBrush = lNewVal;
-		break;
-	case GCL_HCURSOR:
-		rc = hCursor;
-		hCursor = lNewVal;
-		break;
-	case GCL_HICON:
-		rc = hIcon;
-		hIcon = lNewVal;
-		break;
-	case GCL_HMODULE:
-		rc = hInstance;
-		hInstance = lNewVal;
-		break;
-	case GCL_MENUNAME:
-		rc = 0;	//old value is meaningless (according to Wine)
-		setMenuName((LPSTR)lNewVal);
-		break;
-	case GCL_STYLE:
-		rc = windowStyle;
-		windowStyle = lNewVal;
-		break;
-	case GCL_WNDPROC:
-		rc = (ULONG)windowProc;
-		windowProc = (WNDPROC)lNewVal;
-		break;
-	case GCW_ATOM: //TODO: does this really happen in windows?
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
-	default:
-		if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
-			rc = userClassLong[index];
-			userClassLong[index] = lNewVal;
-			return(rc);
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?)
+                rc = nrExtraClassWords;
+//              nrExtraClassWords = lNewVal;
+                break;
+        case GCL_CBWNDEXTRA:
+                rc = nrExtraWindowWords;
+                nrExtraWindowWords = lNewVal;
+                break;
+        case GCL_HBRBACKGROUND:
+                rc = backgroundBrush;
+                backgroundBrush = lNewVal;
+                break;
+        case GCL_HCURSOR:
+                rc = hCursor;
+                hCursor = lNewVal;
+                break;
+        case GCL_HICON:
+                rc = hIcon;
+                hIcon = lNewVal;
+                break;
+        case GCL_HMODULE:
+                rc = hInstance;
+                hInstance = lNewVal;
+                break;
+        case GCL_MENUNAME:
+                rc = 0; //old value is meaningless (according to Wine)
+                setMenuName((LPSTR)lNewVal);
+                break;
+        case GCL_STYLE:
+                rc = windowStyle;
+                windowStyle = lNewVal;
+                break;
+        case GCL_WNDPROC:
+                rc = (ULONG)windowProc;
+                windowProc = (WNDPROC)lNewVal;
+                break;
+        case GCW_ATOM: //TODO: does this really happen in windows?
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
+        default:
+                if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
+                        rc = userClassLong[index];
+                        userClassLong[index] = lNewVal;
+                        return(rc);
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
   }
   return(rc);
@@ -359,16 +363,16 @@
 
   switch(index) {
-	case GCW_ATOM: 
-		rc = (WORD)classAtom;
-		classAtom = wNewVal;
-		return(rc);
-	default:
-		if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
-			rc = ((WORD *)userClassLong)[index];
-			((WORD *)userClassLong)[index] = wNewVal;
-			return(rc);
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GCW_ATOM:
+                rc = (WORD)classAtom;
+                classAtom = wNewVal;
+                return(rc);
+        default:
+                if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
+                        rc = ((WORD *)userClassLong)[index];
+                        ((WORD *)userClassLong)[index] = wNewVal;
+                        return(rc);
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
   }
 }
@@ -383,6 +387,6 @@
   wndclass = FindClass(hinst, id);
   if(wndclass) {
-	delete wndclass;
-	return;
+        delete wndclass;
+        return;
   }
   dprintf(("::UnregisterClass, couldn't find class %X!!\n", id));
Index: trunk/src/user32/new/win32wnd.cpp
===================================================================
--- trunk/src/user32/new/win32wnd.cpp	(revision 301)
+++ trunk/src/user32/new/win32wnd.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: win32wnd.cpp,v 1.1 1999-07-14 08:35:37 sandervl Exp $ */
+/* $Id: win32wnd.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */
 /*
  * Win32 Window Code for OS/2
@@ -45,5 +45,5 @@
 //******************************************************************************
 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
-			: GenericObject(&windows, OBJTYPE_WINDOW)
+                        : GenericObject(&windows, OBJTYPE_WINDOW)
 {
   Init();
@@ -57,11 +57,11 @@
   isUnicode        = FALSE;
 
-  *windowName      = NULL;
+  windowName       = NULL;
   wndNameLength    = 0;
 
-  *windowText      = NULL;;
+  windowText       = NULL;;
   wndTextLength    = 0;
-	
-  *userWindowLong  = NULL;;
+
+  userWindowLong   = NULL;;
   nrUserWindowLong = 0;
 
@@ -69,8 +69,10 @@
   OS2Hwnd          = 0;
   Win32Hwnd        = 0;
-  if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0) 
-  {
-	dprintf(("Win32Window::Init HMHandleAllocate failed!!"));
-	DebugInt3();
+
+  //CB: what does this code? Win32Hwnd is always 0!
+  if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0)
+  {
+        dprintf(("Win32Window::Init HMHandleAllocate failed!!"));
+        DebugInt3();
   }
   posx = posy      = 0;
@@ -78,9 +80,9 @@
 
   dwExStyle        = 0;
-  dwStyle	   = 0;
+  dwStyle          = 0;
   win32wndproc     = 0;
   hInstance        = 0;
   parent           = 0;
-  windowId         = 0xFFFFFFFF;	//default = -1
+  windowId         = 0xFFFFFFFF;        //default = -1
   userData         = 0;
 
@@ -95,11 +97,11 @@
 {
   if(Win32Hwnd)
-	HMHandleFree(Win32Hwnd);
+        HMHandleFree(Win32Hwnd);
   if(windowName)
-	free(windowName);
+        free(windowName);
   if(windowText)
-	free(windowText);
+        free(windowText);
   if(userWindowLong)
-	free(userWindowLong);
+        free(userWindowLong);
 }
 //******************************************************************************
@@ -109,5 +111,5 @@
  char  buffer[256];
  DWORD tmp;
- INT   sw = SW_SHOW; 
+ INT   sw = SW_SHOW;
  POINT maxSize, maxPos, minTrack, maxTrack;
 
@@ -117,16 +119,16 @@
   if (cs->hwndParent)
   {
-	/* Make sure parent is valid */
+        /* Make sure parent is valid */
         if (!IsWindow( cs->hwndParent ))
         {
-            	dprintf(("Bad parent %04x\n", cs->hwndParent ));
-		SetLastError(ERROR_INVALID_PARAMETER);
-	    	return FALSE;
-	}
-  } 
-  else 
+                dprintf(("Bad parent %04x\n", cs->hwndParent ));
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return FALSE;
+        }
+  }
+  else
   if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
         dprintf(("No parent for child window\n" ));
-	SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
   }
@@ -141,16 +143,16 @@
   }
 
-  /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX 
-   * with an atom as the class name, put some programs expect to have a *REAL* string in 
-   * lpszClass when the CREATESTRUCT is sent with WM_CREATE 
+  /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
+   * with an atom as the class name, put some programs expect to have a *REAL* string in
+   * lpszClass when the CREATESTRUCT is sent with WM_CREATE
    */
-  if (!HIWORD(cs->lpszClass) ) {	
+  if (!HIWORD(cs->lpszClass) ) {
         if (isUnicode) {
-	   	GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
-	} 
-	else {
-	   	GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
-	}
-	cs->lpszClass = buffer;
+                GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
+        }
+        else {
+                GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
+        }
+        cs->lpszClass = buffer;
   }
 
@@ -160,18 +162,18 @@
 //        PDB *pdb = PROCESS_Current();
 
-       /* Never believe Microsoft's documentation... CreateWindowEx doc says 
-        * that if an overlapped window is created with WS_VISIBLE style bit 
+       /* Never believe Microsoft's documentation... CreateWindowEx doc says
+        * that if an overlapped window is created with WS_VISIBLE style bit
         * set and the x parameter is set to CW_USEDEFAULT, the system ignores
         * the y parameter. However, disassembling NT implementation (WIN32K.SYS)
         * reveals that
         *
-        * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16 
-        * 2) it does not ignore the y parameter as the docs claim; instead, it 
+        * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
+        * 2) it does not ignore the y parameter as the docs claim; instead, it
         *    uses it as second parameter to ShowWindow() unless y is either
         *    CW_USEDEFAULT or CW_USEDEFAULT16.
-        * 
+        *
         * The fact that we didn't do 2) caused bogus windows pop up when wine
-        * was running apps that were using this obscure feature. Example - 
-        * calc.exe that comes with Win98 (only Win98, it's different from 
+        * was running apps that were using this obscure feature. Example -
+        * calc.exe that comes with Win98 (only Win98, it's different from
         * the one that comes with Win95 and NT)
         */
@@ -212,32 +214,32 @@
   nrUserWindowLong = windowClass->getExtraWndWords();
   if(nrUserWindowLong) {
-	userWindowLong = (ULONG *)malloc(nrUserWindowLong);
-	memset(userWindowLong, 0, nrUserWindowLong);
+        userWindowLong = (ULONG *)malloc(nrUserWindowLong);
+        memset(userWindowLong, 0, nrUserWindowLong);
   }
 
   if ((cs->style & WS_CHILD) && cs->hwndParent)
   {
-	if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)
-    	{
-		dprintf(("HMHandleTranslateToOS2 couldn't find parent window %x!!!", cs->hwndParent));
-		return FALSE;
-    	}
-    	parent = (Win32Window *)tmp;
+        if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)
+        {
+                dprintf(("HMHandleTranslateToOS2 couldn't find parent window %x!!!", cs->hwndParent));
+                return FALSE;
+        }
+        parent = (Win32Window *)tmp;
   }
   else
   {
-        parent = NULL;	//desktop
+        parent = NULL;  //desktop
         if (!cs->hwndParent) {
-            	owner = NULL;
-	}
+                owner = NULL;
+        }
         else
         {
-		if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)
-    		{
-			dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
-			return FALSE;
-    		}
-            	owner = (Win32Window *)tmp;
-	}
+                if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)
+                {
+                        dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
+                        return FALSE;
+                }
+                owner = (Win32Window *)tmp;
+        }
   }
 
@@ -256,10 +258,10 @@
   if (!(cs->style & WS_CHILD))
   {
-	dwStyle |= WS_CLIPSIBLINGS;
-	if (!(cs->style & WS_POPUP))
-	{
+        dwStyle |= WS_CLIPSIBLINGS;
+        if (!(cs->style & WS_POPUP))
+        {
             dwStyle |= WS_CAPTION;
             flags |= WIN_NEED_SIZE;
-	}
+        }
   }
   if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
@@ -300,11 +302,11 @@
         else
         {
-            	if (windowClass->getMenuNameA()) {
-	               	cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());
-        	        if (cs->hMenu) SetMenu( getWindowHandle(), cs->hMenu );
-		}
-        }
-  }
-  else 	windowId = (UINT)cs->hMenu;
+                if (windowClass->getMenuNameA()) {
+                        cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());
+                        if (cs->hMenu) SetMenu( getWindowHandle(), cs->hMenu );
+                }
+        }
+  }
+  else  windowId = (UINT)cs->hMenu;
 
   DWORD dwOSWinStyle, dwOSFrameStyle;
@@ -314,21 +316,22 @@
   OS2Hwnd = OSLibWinCreateWindow((parent) ? parent->getOS2WindowHandle() : 0,
                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
-                                 cs->x, cs->y, cs->cx, cs->cy, 
-		   	         (owner) ? owner->getOS2WindowHandle() : 0,
+                                 cs->x, cs->y, cs->cx, cs->cy,
+                                 (owner) ? owner->getOS2WindowHandle() : 0,
                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE);
 
   if(OS2Hwnd == 0) {
-	dprintf(("Window creation failed!!"));
-	return FALSE;
+        dprintf(("Window creation failed!!"));
+        return FALSE;
   }
   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
-	dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
-	return FALSE;
+        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
+        return FALSE;
   }
   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
- 	dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
-	return FALSE;
-  }
-
+        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
+        return FALSE;
+  }
+
+  return TRUE;
 }
 /*******************************************************************
@@ -338,5 +341,5 @@
  */
 void Win32Window::GetMinMaxInfo(POINT *maxSize, POINT *maxPos,
-		                POINT *minTrack, POINT *maxTrack )
+                                POINT *minTrack, POINT *maxTrack )
 {
     MINMAXINFO MinMax;
@@ -378,5 +381,5 @@
     lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );
     if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
-	CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
+        CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
     else
     {
@@ -454,13 +457,13 @@
 {
  WORD fwSizeType = 0;
-  
+
   if(fMinimize) {
-	fwSizeType = SIZE_MINIMIZED;
+        fwSizeType = SIZE_MINIMIZED;
   }
   else
   if(fMaximize) {
-	fwSizeType = SIZE_MAXIMIZED;
-  }
-  else	fwSizeType = SIZE_RESTORED;
+        fwSizeType = SIZE_MAXIMIZED;
+  }
+  else  fwSizeType = SIZE_RESTORED;
 
   return SendMessageA(WM_SIZE, fwSizeType, MAKELONG((USHORT)width, (USHORT)height));
@@ -491,25 +494,25 @@
 
   switch(msg) {
-	case BUTTON_LEFTDOWN:
-		win32msg = WM_LBUTTONDOWN;
-		break;
-	case BUTTON_LEFTUP:
-		win32msg = WM_LBUTTONUP;
-		break;
-	case BUTTON_LEFTDBLCLICK:
-		win32msg = WM_LBUTTONDBLCLK;
-		break;
-	case BUTTON_RIGHTUP:
-		win32msg = WM_RBUTTONUP;
-		break;
-	case BUTTON_RIGHTDOWN:
-		win32msg = WM_RBUTTONDOWN;
-		break;
-	case BUTTON_RIGHTDBLCLICK:
-		win32msg = WM_RBUTTONDBLCLK;
-		break;
-	default:
-		dprintf(("Win32Window::Button: invalid msg!!!!"));
-		return 1;
+        case BUTTON_LEFTDOWN:
+                win32msg = WM_LBUTTONDOWN;
+                break;
+        case BUTTON_LEFTUP:
+                win32msg = WM_LBUTTONUP;
+                break;
+        case BUTTON_LEFTDBLCLICK:
+                win32msg = WM_LBUTTONDBLCLK;
+                break;
+        case BUTTON_RIGHTUP:
+                win32msg = WM_RBUTTONUP;
+                break;
+        case BUTTON_RIGHTDOWN:
+                win32msg = WM_RBUTTONDOWN;
+                break;
+        case BUTTON_RIGHTDBLCLICK:
+                win32msg = WM_RBUTTONDBLCLK;
+                break;
+        default:
+                dprintf(("Win32Window::Button: invalid msg!!!!"));
+                return 1;
   }
   return SendMessageA(win32msg, 0, MAKELONG(x, OS2TOWIN32POINT(height, y)));
@@ -532,5 +535,5 @@
 {
   if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
-	dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
+        dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
 
   if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
@@ -539,30 +542,30 @@
   switch(Msg)
   {
-	case WM_CREATE:
-	{
+        case WM_CREATE:
+        {
                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
-                       	dprintf(("WM_NCCREATE returned FALSE\n"));
-                       	return(0); //don't create window
+                        dprintf(("WM_NCCREATE returned FALSE\n"));
+                        return(0); //don't create window
                 }
                 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
-                       	dprintf(("WM_CREATE returned FALSE\n"));
-                       	return(0); //don't create window
-                }
-		NotifyParent(Msg, wParam, lParam);
-
-		return(1);
-	}
-	case WM_LBUTTONDOWN:
-	case WM_MBUTTONDOWN:
-	case WM_RBUTTONDOWN:
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-
-	case WM_DESTROY:
-		win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
-		NotifyParent(Msg, wParam, lParam);
-		return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-	default:
-		return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+                        dprintf(("WM_CREATE returned FALSE\n"));
+                        return(0); //don't create window
+                }
+                NotifyParent(Msg, wParam, lParam);
+
+                return(1);
+        }
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
+
+        case WM_DESTROY:
+                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
+                NotifyParent(Msg, wParam, lParam);
+                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
+        default:
+                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
   }
 }
@@ -574,20 +577,20 @@
  Win32Window *parentwindow;
 
-   while(window) 
+   while(window)
    {
-	if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
-	{
-		/* Notify the parent window only */
-		parentwindow = window->getParent();
-		if(parentwindow) {
-			if(Msg == WM_CREATE || Msg == WM_DESTROY) {
-				parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
-			}
-			else	parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
-		}
-	}
-	else	break;
-
-	window = parentwindow;
+        if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
+        {
+                /* Notify the parent window only */
+                parentwindow = window->getParent();
+                if(parentwindow) {
+                        if(Msg == WM_CREATE || Msg == WM_DESTROY) {
+                                parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
+                        }
+                        else    parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
+                }
+        }
+        else    break;
+
+        window = parentwindow;
    }
 }
@@ -599,60 +602,60 @@
 
    switch(index) {
-	case GWL_EXSTYLE:
-		oldval = dwExStyle;
-		dwExStyle = value;
-		return oldval;
-	case GWL_STYLE:
-		oldval = dwStyle;
-		dwStyle = value;
-		return oldval;
-	case GWL_WNDPROC:
-		oldval = (LONG)getWindowProc();
-		setWindowProc((WNDPROC)value);
-		return oldval;
-	case GWL_HINSTANCE:
-		oldval = hInstance;
-		hInstance = value;
-		return oldval;
-	case GWL_HWNDPARENT:
-	{
- 	 ULONG tmp;
-
-		if(getParent()) {
-			oldval = getParent()->getWindowHandle();
-		}
-		else	oldval = 0;
-
-		if(value == 0) {//desktop window = parent
-			setParent(NULL);
-			OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
-			return oldval;
-		}
-		if(HMHandleTranslateToOS2(value, &tmp) == NO_ERROR)
-		{
-			setParent((Win32Window *)tmp);
-			OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
-			return oldval;
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
-	}
-	case GWL_ID:
-		oldval = getWindowId();
-		setWindowId(value);
-		return oldval;
-	case GWL_USERDATA:
-		oldval = userData;
-		userData = value;
-		return oldval;
-	default:
-		if(index >= 0 && index/4 < nrUserWindowLong)
-		{
-			oldval = userWindowLong[index/4];
-			userWindowLong[index/4] = value;
-			return oldval;
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GWL_EXSTYLE:
+                oldval = dwExStyle;
+                dwExStyle = value;
+                return oldval;
+        case GWL_STYLE:
+                oldval = dwStyle;
+                dwStyle = value;
+                return oldval;
+        case GWL_WNDPROC:
+                oldval = (LONG)getWindowProc();
+                setWindowProc((WNDPROC)value);
+                return oldval;
+        case GWL_HINSTANCE:
+                oldval = hInstance;
+                hInstance = value;
+                return oldval;
+        case GWL_HWNDPARENT:
+        {
+         ULONG tmp;
+
+                if(getParent()) {
+                        oldval = getParent()->getWindowHandle();
+                }
+                else    oldval = 0;
+
+                if(value == 0) {//desktop window = parent
+                        setParent(NULL);
+                        OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
+                        return oldval;
+                }
+                if(HMHandleTranslateToOS2(value, &tmp) == NO_ERROR)
+                {
+                        setParent((Win32Window *)tmp);
+                        OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
+                        return oldval;
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
+        }
+        case GWL_ID:
+                oldval = getWindowId();
+                setWindowId(value);
+                return oldval;
+        case GWL_USERDATA:
+                oldval = userData;
+                userData = value;
+                return oldval;
+        default:
+                if(index >= 0 && index/4 < nrUserWindowLong)
+                {
+                        oldval = userWindowLong[index/4];
+                        userWindowLong[index/4] = value;
+                        return oldval;
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
    }
 }
@@ -662,28 +665,28 @@
 {
    switch(index) {
-	case GWL_EXSTYLE:
-		return dwExStyle;
-	case GWL_STYLE:
-		return dwStyle;
-	case GWL_WNDPROC:
-		return (ULONG)getWindowProc();
-	case GWL_HINSTANCE:
-		return hInstance;
-	case GWL_HWNDPARENT:
-		if(getParent()) {
-			return getParent()->getWindowHandle();
-		}
-		else	return 0;
-	case GWL_ID:
-		return getWindowId();
-	case GWL_USERDATA:
-		return userData;
-	default:
-		if(index >= 0 && index/4 < nrUserWindowLong)
-		{
-			return userWindowLong[index/4];
-		}
-		SetLastError(ERROR_INVALID_PARAMETER);
-		return 0;
+        case GWL_EXSTYLE:
+                return dwExStyle;
+        case GWL_STYLE:
+                return dwStyle;
+        case GWL_WNDPROC:
+                return (ULONG)getWindowProc();
+        case GWL_HINSTANCE:
+                return hInstance;
+        case GWL_HWNDPARENT:
+                if(getParent()) {
+                        return getParent()->getWindowHandle();
+                }
+                else    return 0;
+        case GWL_ID:
+                return getWindowId();
+        case GWL_USERDATA:
+                return userData;
+        default:
+                if(index >= 0 && index/4 < nrUserWindowLong)
+                {
+                        return userWindowLong[index/4];
+                }
+                SetLastError(ERROR_INVALID_PARAMETER);
+                return 0;
    }
 }
@@ -696,7 +699,7 @@
    if(index >= 0 && index/4 < nrUserWindowLong)
    {
-	oldval = ((WORD *)userWindowLong)[index/2];
-	((WORD *)userWindowLong)[index/2] = value;
-	return oldval;
+        oldval = ((WORD *)userWindowLong)[index/2];
+        ((WORD *)userWindowLong)[index/2] = value;
+        return oldval;
    }
    SetLastError(ERROR_INVALID_PARAMETER);
@@ -709,5 +712,5 @@
    if(index >= 0 && index/4 < nrUserWindowLong)
    {
-	return ((WORD *)userWindowLong)[index/2];
+        return ((WORD *)userWindowLong)[index/2];
    }
    SetLastError(ERROR_INVALID_PARAMETER);
Index: trunk/src/user32/new/window.cpp
===================================================================
--- trunk/src/user32/new/window.cpp	(revision 301)
+++ trunk/src/user32/new/window.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: window.cpp,v 1.1 1999-07-14 08:35:37 sandervl Exp $ */
+/* $Id: window.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */
 /*
  * Win32 window apis for OS/2
@@ -37,8 +37,8 @@
         dprintf(("CreateWindowEx32A: bad class name "));
         if (!HIWORD(className)) {
-		dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
-	}
-        else 	dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
-	SetLastError(ERROR_INVALID_PARAMETER);
+                dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
+        }
+        else    dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
+        SetLastError(ERROR_INVALID_PARAMETER);
         return 0;
     }
@@ -58,13 +58,14 @@
     cs.dwExStyle      = exStyle;
     window = new Win32Window( &cs, classAtom, FALSE );
-    if(window == NULL) 
+    if(window == NULL)
     {
-	dprintf(("Win32Window creation failed!!"));
-	return 0;
+        dprintf(("Win32Window creation failed!!"));
+        return 0;
     }
     if(GetLastError() != 0)
     {
-	delete window;
-	return 0;
+        dprintf(("Win32Window error found!!"));
+        delete window;
+        return 0;
     }
     return window->getWindowHandle();
Index: trunk/src/user32/new/windowclass.cpp
===================================================================
--- trunk/src/user32/new/windowclass.cpp	(revision 301)
+++ trunk/src/user32/new/windowclass.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: windowclass.cpp,v 1.1 1999-07-14 08:35:37 sandervl Exp $ */
+/* $Id: windowclass.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */
 /*
  * Win32 Window Class Code for OS/2
@@ -37,11 +37,13 @@
  Win32WndClass *wclass;
 
-   memcpy(&wc, lpWndClass, sizeof(WNDCLASSA));
+   //CB: size new in ex structure
+   wc.cbSize = sizeof(wc);
+   memcpy(&wc.style, lpWndClass, sizeof(WNDCLASSA));
    wc.hIconSm = 0;
-    
-   wclass = new Win32WndClass(&wc);
+
+   wclass = new Win32WndClass(&wc,FALSE);
    if(wclass == NULL) {
-	dprintf(("RegisterClassA wclass == NULL!"));
-	return(0);
+        dprintf(("RegisterClassA wclass == NULL!"));
+        return(0);
    }
    return(wclass->getAtom());
@@ -53,12 +55,13 @@
  Win32WndClass *wclass;
 
-   wclass = new Win32WndClass((WNDCLASSEXA *)lpWndClass);
+   wclass = new Win32WndClass((WNDCLASSEXA *)lpWndClass,FALSE);
    if(wclass == NULL) {
-	dprintf(("RegisterClassExA wclass == NULL!"));
-	return(0);
+        dprintf(("RegisterClassExA wclass == NULL!"));
+        return(0);
    }
    return(wclass->getAtom());
 }
 //******************************************************************************
+//CB: update to unicode!
 //******************************************************************************
 WORD WIN32API RegisterClassW(CONST WNDCLASSW *lpwc)
@@ -68,22 +71,25 @@
 
     dprintf(("RegisterClassW\n"));
-    memcpy(&wclass, lpwc, sizeof(WNDCLASSA));
+    //CB: size new in ex structure
+    wclass.cbSize = sizeof(wclass);
+    memcpy(&wclass.style, lpwc, sizeof(WNDCLASSA));
     if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
-	wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
+        wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
     }
     if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
-	wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
+        wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
     }
     rc = RegisterClassA((CONST WNDCLASSA *)&wclass);
 
     if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
-	FreeAsciiString((char *)wclass.lpszMenuName);
+        FreeAsciiString((char *)wclass.lpszMenuName);
     }
     if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
-	FreeAsciiString((char *)wclass.lpszClassName);
+        FreeAsciiString((char *)wclass.lpszClassName);
     }
     return(rc);
 }
 //******************************************************************************
+//CB: update to unicode!
 //******************************************************************************
 ATOM WIN32API RegisterClassExW(CONST WNDCLASSEXW *lpwc)
@@ -95,16 +101,16 @@
     memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
     if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
-	wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
+        wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
     }
     if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
-	wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
+        wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
     }
     rc = RegisterClassExA((CONST WNDCLASSEXA *)&wclass);
 
     if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
-	FreeAsciiString((char *)wclass.lpszMenuName);
+        FreeAsciiString((char *)wclass.lpszMenuName);
     }
     if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
-	FreeAsciiString((char *)wclass.lpszClassName);
+        FreeAsciiString((char *)wclass.lpszClassName);
     }
     return(rc);
@@ -121,4 +127,5 @@
 }
 //******************************************************************************
+//CB:update to unicode!
 //******************************************************************************
 BOOL WIN32API UnregisterClassW(LPCWSTR lpszClassName, HINSTANCE hinst)
@@ -128,11 +135,11 @@
   dprintf(("USER32:  UnregisterClassW\n"));
   if((ULONG)lpszClassName >> 16 != 0) {
-	astring = UnicodeToAsciiString((LPWSTR)lpszClassName);
-  }
-  else 	astring = (char *)lpszClassName;
+        astring = UnicodeToAsciiString((LPWSTR)lpszClassName);
+  }
+  else  astring = (char *)lpszClassName;
 
   Win32WndClass::UnregisterClassA(hinst, (LPSTR)astring);
-  if((ULONG)astring >> 16 != 0)	
-	FreeAsciiString((char *)astring);
+  if((ULONG)astring >> 16 != 0)
+        FreeAsciiString((char *)astring);
   //Spintest returns FALSE in dll termination, so pretend it succeeded
   return(TRUE);
@@ -150,11 +157,12 @@
   wndclass = Win32WndClass::FindClass(hInstance, (LPSTR)lpszClass);
   if(wndclass) {
-	wndclass->getClassInfo(&wc);
-	memcpy(lpwc, &wc, sizeof(WNDCLASSA));
-	return(TRUE);
-  }
-  return(FALSE);  
-}
-//******************************************************************************
+        wndclass->getClassInfo(&wc);
+        memcpy(lpwc, &wc, sizeof(WNDCLASSA));
+        return(TRUE);
+  }
+  return(FALSE);
+}
+//******************************************************************************
+//CB: update to unicode!
 //******************************************************************************
 BOOL WIN32API GetClassInfoW(HINSTANCE  hinst, LPCWSTR lpszClass, WNDCLASSW *lpwc)
@@ -168,17 +176,17 @@
 
   if((ULONG)lpszClass >> 16 != 0) {
-	astring = UnicodeToAsciiString((LPWSTR)lpszClass);
+        astring = UnicodeToAsciiString((LPWSTR)lpszClass);
   }
   else  astring = (char *)lpszClass;
 
   wndclass = Win32WndClass::FindClass(hinst, astring);
-  if((ULONG)astring >> 16 != 0)	
-	FreeAsciiString((char *)astring);
+  if((ULONG)astring >> 16 != 0)
+        FreeAsciiString((char *)astring);
   if(wndclass) {
-	wndclass->getClassInfo(&wc);
-	memcpy(lpwc, &wc, sizeof(WNDCLASSW));
-	return(TRUE);
-  }
-  return(FALSE);  
+        wndclass->getClassInfo(&wc);
+        memcpy(lpwc, &wc, sizeof(WNDCLASSW));
+        return(TRUE);
+  }
+  return(FALSE);
 }
 /****************************************************************************
@@ -203,16 +211,16 @@
  BOOL           rc;
  Win32WndClass *wndclass;
-  
+
   dprintf(("USER32:GetClassInfoExA (%08xh,%x,%08x).\n",
          hInstance,
          lpszClass,
          lpwcx));
-  
+
   wndclass = Win32WndClass::FindClass(hInstance, (LPSTR)lpszClass);
   if(wndclass) {
-	wndclass->getClassInfo(lpwcx);
-	return(TRUE);
-  }
-  return(FALSE);  
+        wndclass->getClassInfo(lpwcx);
+        return(TRUE);
+  }
+  return(FALSE);
 }
 /*****************************************************************************
@@ -243,16 +251,16 @@
 
   if((ULONG)lpszClass >> 16 != 0) {
-	astring = UnicodeToAsciiString((LPWSTR)lpszClass);
+        astring = UnicodeToAsciiString((LPWSTR)lpszClass);
   }
   else  astring = (char *)lpszClass;
 
   wndclass = Win32WndClass::FindClass(hInstance, astring);
-  if((ULONG)astring >> 16 != 0)	
-	FreeAsciiString((char *)astring);
+  if((ULONG)astring >> 16 != 0)
+        FreeAsciiString((char *)astring);
   if(wndclass) {
-	wndclass->getClassInfo(lpwcx);
-	return(TRUE);
-  }
-  return(FALSE);  
+        wndclass->getClassInfo(lpwcx);
+        return(TRUE);
+  }
+  return(FALSE);
 }
 //******************************************************************************
@@ -265,6 +273,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("GetClassNameA wnd == NULL"));
-	return(0);
+        dprintf(("GetClassNameA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
@@ -279,6 +287,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("GetClassNameA wnd == NULL"));
-	return(0);
+        dprintf(("GetClassNameA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
@@ -293,6 +301,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("SetClassLongA wnd == NULL"));
-	return(0);
+        dprintf(("SetClassLongA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->setClassLongA(nIndex, lNewVal);
@@ -307,6 +315,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("SetClassLongW wnd == NULL"));
-	return(0);
+        dprintf(("SetClassLongW wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->setClassLongW(nIndex, lNewVal);
@@ -321,6 +329,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("SetClassWordA wnd == NULL"));
-	return(0);
+        dprintf(("SetClassWordA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->setClassWord(nIndex, wNewVal);
@@ -335,6 +343,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("GetClassWordA wnd == NULL"));
-	return(0);
+        dprintf(("GetClassWordA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->getClassWord(nIndex);
@@ -349,6 +357,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("GetClassLongA wnd == NULL"));
-	return(0);
+        dprintf(("GetClassLongA wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->getClassLongA(nIndex);
@@ -363,6 +371,6 @@
     wnd = WIN2OS2HWND(hwnd);
     if(wnd == NULL) {
-	dprintf(("GetClassLongW wnd == NULL"));
-	return(0);
+        dprintf(("GetClassLongW wnd == NULL"));
+        return(0);
     }
     return (wnd->getClass())->getClassLongW(nIndex);
Index: trunk/src/user32/new/windowmsg.cpp
===================================================================
--- trunk/src/user32/new/windowmsg.cpp	(revision 301)
+++ trunk/src/user32/new/windowmsg.cpp	(revision 304)
@@ -1,3 +1,3 @@
-/* $Id: windowmsg.cpp,v 1.1 1999-07-14 08:35:37 sandervl Exp $ */
+/* $Id: windowmsg.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */
 /*
  * Win32 window message APIs for OS/2
@@ -37,5 +37,5 @@
     dprintf(("USER32:  PostQuitMessage\n"));
 
-    O32_PostQuitMessage(arg1);
+    O32_PostQuitMessage(nExitCode);
 }
 //******************************************************************************
