Index: trunk/src/user32/new/windowclass.cpp
===================================================================
--- trunk/src/user32/new/windowclass.cpp	(revision 304)
+++ trunk/src/user32/new/windowclass.cpp	(revision 307)
@@ -1,3 +1,3 @@
-/* $Id: windowclass.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */
+/* $Id: windowclass.cpp,v 1.3 1999-07-15 08:18:11 sandervl Exp $ */
 /*
  * Win32 Window Class Code for OS/2
@@ -19,4 +19,5 @@
 #include <win32class.h>
 #include <win32wnd.h>
+#include <handlemanager.h>
 
 //******************************************************************************
@@ -63,5 +64,4 @@
 }
 //******************************************************************************
-//CB: update to unicode!
 //******************************************************************************
 WORD WIN32API RegisterClassW(CONST WNDCLASSW *lpwc)
@@ -69,4 +69,5 @@
  ATOM rc;
  WNDCLASSEXA wclass;
+ Win32WndClass *winclass;
 
     dprintf(("RegisterClassW\n"));
@@ -74,16 +75,21 @@
     wclass.cbSize = sizeof(wclass);
     memcpy(&wclass.style, lpwc, sizeof(WNDCLASSA));
-    if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
+    if(wclass.lpszMenuName && (HIWORD(wclass.lpszMenuName) != 0)) {
         wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
     }
-    if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
+    if(wclass.lpszClassName && (HIWORD(wclass.lpszClassName) != 0)) {
         wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
     }
-    rc = RegisterClassA((CONST WNDCLASSA *)&wclass);
-
-    if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
+    winclass = new Win32WndClass((WNDCLASSEXA *)&wclass, TRUE);
+    if(winclass == NULL) {
+        dprintf(("RegisterClassW wclass == NULL!"));
+        return(0);
+    }
+    rc = winclass->getAtom();
+
+    if(lpwc->lpszMenuName && (HIWORD(lpwc->lpszMenuName) != 0)) {
         FreeAsciiString((char *)wclass.lpszMenuName);
     }
-    if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
+    if(lpwc->lpszClassName && (HIWORD(lpwc->lpszClassName) !=0)) {
         FreeAsciiString((char *)wclass.lpszClassName);
     }
@@ -91,5 +97,4 @@
 }
 //******************************************************************************
-//CB: update to unicode!
 //******************************************************************************
 ATOM WIN32API RegisterClassExW(CONST WNDCLASSEXW *lpwc)
@@ -97,19 +102,26 @@
  ATOM rc;
  WNDCLASSEXA wclass;
+ Win32WndClass *winclass;
 
     dprintf(("RegisterClassExW\n"));
     memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
-    if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
+    if(wclass.lpszMenuName && (HIWORD(wclass.lpszMenuName) != 0)) {
         wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
     }
-    if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
+    if(wclass.lpszClassName && (HIWORD(wclass.lpszClassName) != 0)) {
         wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
     }
-    rc = RegisterClassExA((CONST WNDCLASSEXA *)&wclass);
-
-    if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
+
+    winclass = new Win32WndClass((WNDCLASSEXA *)&wclass, TRUE);
+    if(winclass == NULL) {
+        dprintf(("RegisterClassExW wclass == NULL!"));
+        return(0);
+    }
+    rc = winclass->getAtom();
+
+    if(lpwc->lpszMenuName && (HIWORD(lpwc->lpszMenuName) != 0)) {
         FreeAsciiString((char *)wclass.lpszMenuName);
     }
-    if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
+    if(lpwc->lpszClassName && (HIWORD(lpwc->lpszClassName) != 0)) {
         FreeAsciiString((char *)wclass.lpszClassName);
     }
@@ -127,5 +139,4 @@
 }
 //******************************************************************************
-//CB:update to unicode!
 //******************************************************************************
 BOOL WIN32API UnregisterClassW(LPCWSTR lpszClassName, HINSTANCE hinst)
@@ -134,5 +145,5 @@
 
   dprintf(("USER32:  UnregisterClassW\n"));
-  if((ULONG)lpszClassName >> 16 != 0) {
+  if(HIWORD(lpszClassName) != 0) {
         astring = UnicodeToAsciiString((LPWSTR)lpszClassName);
   }
@@ -140,6 +151,7 @@
 
   Win32WndClass::UnregisterClassA(hinst, (LPSTR)astring);
-  if((ULONG)astring >> 16 != 0)
+  if(HIWORD(astring) != 0)
         FreeAsciiString((char *)astring);
+
   //Spintest returns FALSE in dll termination, so pretend it succeeded
   return(TRUE);
@@ -164,5 +176,4 @@
 }
 //******************************************************************************
-//CB: update to unicode!
 //******************************************************************************
 BOOL WIN32API GetClassInfoW(HINSTANCE  hinst, LPCWSTR lpszClass, WNDCLASSW *lpwc)
@@ -175,5 +186,5 @@
   dprintf(("USER32:  GetClassInfoW\n"));
 
-  if((ULONG)lpszClass >> 16 != 0) {
+  if(HIWORD(lpszClass) != 0) {
         astring = UnicodeToAsciiString((LPWSTR)lpszClass);
   }
@@ -181,9 +192,10 @@
 
   wndclass = Win32WndClass::FindClass(hinst, astring);
-  if((ULONG)astring >> 16 != 0)
+  if(HIWORD(astring) != 0)
         FreeAsciiString((char *)astring);
+
   if(wndclass) {
         wndclass->getClassInfo(&wc);
-        memcpy(lpwc, &wc, sizeof(WNDCLASSW));
+        memcpy(lpwc, &wc.style, sizeof(WNDCLASSW));
         return(TRUE);
   }
@@ -250,5 +262,5 @@
   dprintf(("USER32: GetClassInfoExW\n"));
 
-  if((ULONG)lpszClass >> 16 != 0) {
+  if(HIWORD(lpszClass) != 0) {
         astring = UnicodeToAsciiString((LPWSTR)lpszClass);
   }
@@ -256,6 +268,7 @@
 
   wndclass = Win32WndClass::FindClass(hInstance, astring);
-  if((ULONG)astring >> 16 != 0)
+  if(HIWORD(astring) != 0)
         FreeAsciiString((char *)astring);
+
   if(wndclass) {
         wndclass->getClassInfo(lpwcx);
@@ -271,6 +284,5 @@
 
     dprintf(("USER32: GetClassNameA\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("GetClassNameA wnd == NULL"));
         return(0);
@@ -285,6 +297,5 @@
 
     dprintf(("USER32: GetClassNameW\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("GetClassNameA wnd == NULL"));
         return(0);
@@ -299,6 +310,5 @@
 
     dprintf(("USER32: SetClassLongA\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("SetClassLongA wnd == NULL"));
         return(0);
@@ -313,6 +323,5 @@
 
     dprintf(("USER32: SetClassLongW\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("SetClassLongW wnd == NULL"));
         return(0);
@@ -327,6 +336,5 @@
 
     dprintf(("USER32: SetClassWordA\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("SetClassWordA wnd == NULL"));
         return(0);
@@ -341,6 +349,5 @@
 
     dprintf(("USER32: GetClassWordA\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("GetClassWordA wnd == NULL"));
         return(0);
@@ -355,6 +362,5 @@
 
     dprintf(("USER32: GetClassLongA\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("GetClassLongA wnd == NULL"));
         return(0);
@@ -369,6 +375,5 @@
 
     dprintf(("USER32: GetClassLongW\n"));
-    wnd = WIN2OS2HWND(hwnd);
-    if(wnd == NULL) {
+    if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) {
         dprintf(("GetClassLongW wnd == NULL"));
         return(0);
