Index: trunk/src/user32/win32class.cpp
===================================================================
--- trunk/src/user32/win32class.cpp	(revision 3701)
+++ trunk/src/user32/win32class.cpp	(revision 3702)
@@ -1,3 +1,3 @@
-/* $Id: win32class.cpp,v 1.16 2000-03-18 16:13:37 cbratschi Exp $ */
+/* $Id: win32class.cpp,v 1.17 2000-06-13 21:26:29 sandervl Exp $ */
 /*
  * Win32 Window Class Managment Code for OS/2
@@ -240,4 +240,23 @@
   dprintf(("Class %X (inst %X) not found!", id, hInstance));
   return(NULL);
+}
+//******************************************************************************
+//******************************************************************************
+Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPWSTR id)
+{
+ LPSTR          lpszClassName;
+ Win32WndClass *winclass;
+
+  if(HIWORD(id)) {
+	lpszClassName = UnicodeToAsciiString((LPWSTR)id);
+  }
+  else	lpszClassName = (LPSTR)id;
+
+  winclass = FindClass(hInstance, lpszClassName);
+
+  if(HIWORD(id)) {
+        FreeAsciiString((char *)lpszClassName);
+  }
+  return winclass;
 }
 //******************************************************************************
Index: trunk/src/user32/win32class.h
===================================================================
--- trunk/src/user32/win32class.h	(revision 3701)
+++ trunk/src/user32/win32class.h	(revision 3702)
@@ -1,3 +1,3 @@
-/* $Id: win32class.h,v 1.11 2000-03-18 16:13:38 cbratschi Exp $ */
+/* $Id: win32class.h,v 1.12 2000-06-13 21:26:30 sandervl Exp $ */
 /*
  * Win32 Window Class Managment Code for OS/2
@@ -68,4 +68,6 @@
 
  static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
+ static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id);
+
  static  void   DestroyAll();
 
Index: trunk/src/user32/windowclass.cpp
===================================================================
--- trunk/src/user32/windowclass.cpp	(revision 3701)
+++ trunk/src/user32/windowclass.cpp	(revision 3702)
@@ -1,3 +1,3 @@
-/* $Id: windowclass.cpp,v 1.10 2000-05-28 16:43:48 sandervl Exp $ */
+/* $Id: windowclass.cpp,v 1.11 2000-06-13 21:26:30 sandervl Exp $ */
 /*
  * Win32 Window Class Code for OS/2
@@ -45,5 +45,5 @@
  Win32WndClass *wclass;
 
-    dprintf(("RegisterClassA\n"));
+   dprintf(("RegisterClassA\n"));
    //CB: size new in ex structure
    wc.cbSize = sizeof(wc);
@@ -51,7 +51,14 @@
    wc.hIconSm = 0;
 
+   if(Win32WndClass::FindClass(wc.hInstance, (LPSTR)wc.lpszClassName)) {
+   	dprintf(("RegisterClassA %x %x already exists", wc.hInstance, wc.lpszClassName));
+	SetLastError(ERROR_CLASS_ALREADY_EXISTS);
+	return 0;
+   }
+
    wclass = new Win32WndClass(&wc,FALSE);
    if(wclass == NULL) {
-        dprintf(("RegisterClassA wclass == NULL!"));
+        dprintf(("ERROR: RegisterClassA winclass == NULL!"));
+	DebugInt3();
         return(0);
    }
@@ -63,9 +70,16 @@
 {
  Win32WndClass *wclass;
+
+   if(Win32WndClass::FindClass(lpWndClass->hInstance, (LPSTR)lpWndClass->lpszClassName)) {
+   	dprintf(("RegisterClassExA %x %x already exists", lpWndClass->hInstance, lpWndClass->lpszClassName));
+	SetLastError(ERROR_CLASS_ALREADY_EXISTS);
+	return 0;
+   }
 
    dprintf(("RegisterClassExA\n"));
    wclass = new Win32WndClass((WNDCLASSEXA *)lpWndClass,FALSE);
    if(wclass == NULL) {
-        dprintf(("RegisterClassExA wclass == NULL!"));
+        dprintf(("ERROR: RegisterClassExA winclass == NULL!"));
+	DebugInt3();
         return(0);
    }
@@ -77,16 +91,23 @@
 {
  ATOM rc;
- WNDCLASSEXA wclass;
+ WNDCLASSEXA wc;
  Win32WndClass *winclass;
 
     dprintf(("RegisterClassW\n"));
     //CB: size new in ex structure
-    wclass.cbSize = sizeof(wclass);
-    memcpy(&wclass.style, lpwc, sizeof(WNDCLASSA));
-
-    winclass = new Win32WndClass((WNDCLASSEXA *)&wclass, TRUE);
+    wc.cbSize = sizeof(wc);
+    memcpy(&wc.style, lpwc, sizeof(WNDCLASSA));
+
+    if(Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName)) {
+   	dprintf(("RegisterClassW %x %x already exists", wc.hInstance, wc.lpszClassName));
+	SetLastError(ERROR_CLASS_ALREADY_EXISTS);
+	return 0;
+    }
+
+    winclass = new Win32WndClass((WNDCLASSEXA *)&wc, TRUE);
     if(winclass == NULL) {
-        dprintf(("RegisterClassW wclass == NULL!"));
-        return(0);
+        dprintf(("ERROR: RegisterClassW winclass == NULL!"));
+	DebugInt3();
+	return 0;
     }
     rc = winclass->getAtom();
@@ -99,13 +120,20 @@
 {
  ATOM rc;
- WNDCLASSEXA wclass;
+ WNDCLASSEXA wc;
  Win32WndClass *winclass;
 
     dprintf(("RegisterClassExW\n"));
-    memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
-
-    winclass = new Win32WndClass((WNDCLASSEXA *)&wclass, TRUE);
+    memcpy(&wc, lpwc, sizeof(WNDCLASSEXA));
+
+    if(Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName)) {
+   	dprintf(("RegisterClassW %x %x already exists", wc.hInstance, wc.lpszClassName));
+	SetLastError(ERROR_CLASS_ALREADY_EXISTS);
+	return 0;
+    }
+
+    winclass = new Win32WndClass((WNDCLASSEXA *)&wc, TRUE);
     if(winclass == NULL) {
-        dprintf(("RegisterClassExW wclass == NULL!"));
+        dprintf(("ERROR: RegisterClassExW winclass == NULL!"));
+	DebugInt3();
         return(0);
     }
