Ignore:
Timestamp:
Jul 14, 1999, 10:35:38 AM (26 years ago)
Author:
sandervl
Message:

Very preliminary code for Open32 replacement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/win32class.cpp

    r4 r300  
    1 /* $Id: win32class.cpp,v 1.1 1999-05-24 20:20:04 ktk Exp $ */
    2 
     1/* $Id: win32class.cpp,v 1.2 1999-07-14 08:35:36 sandervl Exp $ */
    32/*
    43 * Win32 Window Class Managment Code for OS/2
    54 *
    65 *
    7  * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
    87 *
    98 */
    109#include <os2win.h>
     10#include <stdio.h>
     11#include <stdlib.h>
     12#include <string.h>
    1113#include <stdarg.h>
    1214#include <assert.h>
    13 #include "misc.h"
    14 #include "user32.h"
    15 #include "win32class.h"
    16 #include "win32wnd.h"
     15#include <misc.h>
     16#include <win32class.h>
     17#include <win32wnd.h>
    1718
    1819//******************************************************************************
    1920//Win32WndClass methods:
    2021//******************************************************************************
    21 Win32WndClass::Win32WndClass(WNDCLASSEXA wndclass, BOOL isUnicode)
    22 {
    23   //Insert it in front of the rest
    24   next        = wndclasses;
    25   wndclasses  = this;
    26   if((ULONG)wndclass->lpszClassName >> 16 != 0) {
    27         className  = (char *) malloc(strlen(wndclass->lpszClassName)+1);
    28         classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR));
    29         if(className == NULL || classNameW == NULL) {
    30                 dprintf(("Win32Class ctr; className/classNameW == NULL"));
     22Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode) : GenericObject(&wndclasses, OBJTYPE_CLASS)
     23{
     24  if(HIWORD(wndclass->lpszClassName)) {
     25        if(isUnicode) {
     26                classNameA = (PCHAR)malloc(lstrlenW((LPWSTR)wndclass->lpszClassName)+1);
     27                classNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)wndclass->lpszClassName)+1)*sizeof(WCHAR));
     28        }
     29        else {
     30                classNameA = (PCHAR)malloc(strlen(wndclass->lpszClassName)+1);
     31                classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR));
     32        }
     33        if(classNameA == NULL || classNameW == NULL) {
     34                dprintf(("Win32Class ctr; classNameA/classNameW == NULL"));
    3135                exit(1);
    3236        }
    33         strcpy(className, wndclass->lpszClassName);
    34         AsciiToUnicode(className, classNameW);
    35         classAtom       = GlobalAddAtom(className);
     37        if(isUnicode) {
     38                lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName);
     39                UnicodeToAscii(classNameW, classNameA);
     40        }
     41        else {
     42                strcpy((char *)classNameA, wndclass->lpszClassName);
     43                AsciiToUnicode(classNameA, classNameW);
     44        }
     45        classAtom       = GlobalAddAtomA(classNameA);
    3646  }
    3747  else {
    38         className       = NULL;
     48        classNameA      = NULL;
    3949        classNameW      = NULL;
    4050        classAtom       = (DWORD)wndclass->lpszClassName;
     
    5161  dprintf(("USER32:  wndclass->hCursor %X\n", wndclass->hCursor));
    5262  dprintf(("USER32:  wndclass->hbrBackground %X\n", wndclass->hbrBackground));
    53   if((ULONG)wndclass->lpszClassName >> 16 == 0)
     63  if(HIWORD(wndclass->lpszClassName))
    5464       dprintf(("USER32:  wndclass->lpszClassName %X\n", wndclass->lpszClassName));
    5565  else dprintf(("USER32:  wndclass->lpszClassName %s\n", wndclass->lpszClassName));
    5666
    57   if((ULONG)wc.lpszMenuName >> 16 != 0) {//convert string name identifier to numeric id
     67  if(HIWORD(wndclass->lpszMenuName)) {//convert string name identifier to numeric id
    5868       dprintf(("USER32:  lpszMenuName %s\n", wndclass->lpszMenuName));
    5969  }
     
    6272  nrExtraClassWords     = wndclass->cbClsExtra;
    6373  nrExtraWindowWords    = wndclass->cbWndExtra;
    64   backgroundBrush       = wndclass->hbrBackGround;      //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
     74  backgroundBrush       = wndclass->hbrBackground;      //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
    6575  hCursor               = wndclass->hCursor;
    6676  hIcon                 = wndclass->hIcon;
    6777  hInstance             = wndclass->hInstance;
    68   if(wndclass->lpszMenuName && (ULONG)wndclass->lpszMenuName >> 16) {
    69         menuName  = (ULONG)malloc(strlen(wndclass->lpszMenuName)+1);
    70         menuNameW = (ULONG)malloc((strlen(wndclass->lpszMenuName)+1)*sizeof(WCHAR));
    71         if(menuName == NULL || menuNameW == NULL) {
    72                 dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));
    73                 exit(1);
    74         }
    75         strcpy((char *)menuName, wndclass->lpszMenuName);
    76         AsciiToUnicode(menuName, menuNameW);
    77   }
    78   else {
    79         menuName  = (ULONG)wndclass->lpszMenuName;
    80         menuNameW = (ULONG)wndclass->lpszMenuName;
    81   }
     78
     79  menuNameA = 0;
     80  menuNameW = 0;
     81  setMenuName((LPSTR)wndclass->lpszMenuName);
    8282
    8383  windowStyle           = wndclass->style;
     
    9595  else  userClassLong = NULL;
    9696
    97   hIconSm = wndclass->hIconSm;
    98 
    99   dprintf(("Win32WndClass::Win32WndClass %d\n", id));
     97  cWindows = 0;
     98  hIconSm  = wndclass->hIconSm;
    10099}
    101100//******************************************************************************
     
    103102Win32WndClass::~Win32WndClass()
    104103{
    105   Win32WndClass *wndclass = Win32WndClass::wndclasses;
    106 
    107   if(wndclass == this) {
    108         wndclasses = next;
    109   }
    110   else {
    111         while(wndclass->next != NULL) {
    112                 if(wndclass->next == this) {
    113                         wndclass->next = next;
    114                         break;
    115                 }
    116                 wndclass = wndclass->next;
    117         }
    118   }
    119104  if(userClassLong)     free(userClassLong);
    120   if(className)         free(className);
     105  if(classNameA)        free(classNameA);
    121106  if(classNameW)        free(classNameW);
    122   if(menuName && (ULONG)menuName >> 16) {
    123         free(menuName)
     107  if(menuNameA && HIWORD(menuNameA)) {
     108        free(menuNameA);
    124109        assert(menuNameW);
    125110        free(menuNameW);
     
    130115Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id)
    131116{
    132   Win32WndClass *wndclass = wndclasses;
     117  Win32WndClass *wndclass = (Win32WndClass *)wndclasses;
    133118
    134119  if(wndclass == NULL)  return(NULL);
    135120
    136   if((ULONG)id >> 16 != 0) {
    137         if(stricmp(wndclass->className, id) == 0 && wndclass->hInstance == hInstance) {
     121  if(HIWORD(id) != 0) {
     122        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
    138123                return(wndclass);
    139124        }
    140125        else {
    141                 wndclass = wndclass->next;
     126                wndclass = (Win32WndClass *)wndclass->GetNext();
    142127                while(wndclass != NULL) {
    143                         if(stricmp(wndclass->className, id) == 0 && wndclass->hInstance == hInstance) {
     128                        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
    144129                                return(wndclass);
    145130                        }
    146                         wndclass = wndclass->next;
     131                        wndclass = (Win32WndClass *)wndclass->GetNext();
    147132                }
    148133        }
     
    153138        }
    154139        else {
    155                 wndclass = wndclass->next;
     140                wndclass = (Win32WndClass *)wndclass->GetNext();
    156141                while(wndclass != NULL) {
    157142                        if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
    158143                                return(wndclass);
    159144                        }
    160                         wndclass = wndclass->next;
     145                        wndclass = (Win32WndClass *)wndclass->GetNext();
    161146                }
    162147        }
    163148  }
    164   dprintf(("Class %X (inst %X) not found!", id, hInstance);
     149  dprintf(("Class %X (inst %X) not found!", id, hInstance));
    165150  return(NULL);
    166151}
     
    171156  wndclass->cbClsExtra    = nrExtraClassWords;
    172157  wndclass->cbWndExtra    = nrExtraWindowWords;
    173   wndclass->hbrBackGround = backgroundBrush;
     158  wndclass->hbrBackground = backgroundBrush;
    174159  wndclass->hCursor       = hCursor;
    175160  wndclass->hIcon         = hIcon;
    176161  wndclass->hInstance     = hInstance;
    177   wndclass->lpszMenuName  = (LPCTSTR)menuName;
    178   wndclass->lpszClassName = (className) ? (LPCTSTR)className : (LPCTSTR)classAtom;
     162  wndclass->lpszMenuName  = (LPCTSTR)menuNameA;
     163  wndclass->lpszClassName = (classNameA) ? (LPCTSTR)classNameA : (LPCTSTR)classAtom;
    179164  wndclass->style         = windowStyle;
    180165  wndclass->lpfnWndProc   = windowProc;
     
    188173  wndclass->cbClsExtra    = nrExtraClassWords;
    189174  wndclass->cbWndExtra    = nrExtraWindowWords;
    190   wndclass->hbrBackGround = backgroundBrush;
     175  wndclass->hbrBackground = backgroundBrush;
    191176  wndclass->hCursor       = hCursor;
    192177  wndclass->hIcon         = hIcon;
     
    203188ULONG Win32WndClass::getClassName(LPSTR lpszClassName, ULONG cchClassName)
    204189{
    205   if((ULONG)className >> 16 != 0) {
    206         strncpy(lpszClassName, className, cchClassName-1);
     190  if(HIWORD(classNameA)) {
     191        strncpy(lpszClassName, classNameA, cchClassName-1);
    207192        return strlen(lpszClassName);
    208193  }
     
    216201 ULONG len;
    217202
    218   if((ULONG)classNameW >> 16 != 0) {
    219         len = min(UniStrLen((UniChar*)classNameW)+1, cchClassName);
    220         memcpy(lpszClassName, classNameW, len*sizeof(WCHAR));
    221         return len;
     203  if(HIWORD(classNameW)) {
     204        lstrcpyW(lpszClassName, classNameW);
     205        return lstrlenW(lpszClassName)*sizeof(WCHAR);
    222206  }
    223207  *(ULONG *)lpszClassName = classAtom;
    224208  return(sizeof(ULONG));
     209}
     210//******************************************************************************
     211//******************************************************************************
     212void Win32WndClass::setMenuName(LPSTR newMenuName)
     213{
     214  if(HIWORD(menuNameA)) {
     215        free(menuNameA);
     216        free(menuNameW);
     217        menuNameA = 0;
     218        menuNameW = 0;
     219  }
     220  if(HIWORD(newMenuName)) {
     221        if(isUnicode) {
     222                menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1);
     223                menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));
     224        }
     225        else {
     226                menuNameA = (PCHAR)malloc(strlen(newMenuName)+1);
     227                menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR));
     228        }
     229        if(menuNameA == NULL || menuNameW == NULL) {
     230                dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));
     231                exit(1);
     232        }
     233        if(isUnicode) {
     234                lstrcpyW(menuNameW, (LPWSTR)newMenuName);
     235                UnicodeToAscii(menuNameW, menuNameA);
     236        }
     237        else {
     238                strcpy((char *)menuNameA, newMenuName);
     239                AsciiToUnicode(menuNameA, menuNameW);
     240        }
     241  }
     242  else {//id
     243        menuNameA = (PCHAR)newMenuName;
     244        menuNameW = (WCHAR *)newMenuName;
     245  }
    225246}
    226247//******************************************************************************
     
    242263                return hInstance;
    243264        case GCL_MENUNAME:
    244                 return (isUnicode) ? menuNameW : menuName;
     265                return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA;
    245266        case GCL_STYLE:
    246267                return windowStyle;
    247268        case GCL_WNDPROC:
    248                 return windowProc;
     269                return (ULONG)windowProc;
    249270        case GCW_ATOM: //TODO: does this really happen in windows?
    250271                SetLastError(ERROR_INVALID_PARAMETER);
     
    260281//******************************************************************************
    261282//******************************************************************************
    262 WORD Win32WndClass::getClassWord(int index);
     283WORD Win32WndClass::getClassWord(int index)
    263284{
    264285  switch(index) {
     
    276297//TODO: What effects what immediately?
    277298//******************************************************************************
    278 ULONG Win32WndClass::setClassLong(int index, LONG lNewVal, BOOL isUnicode);
     299ULONG Win32WndClass::setClassLongA(int index, LONG lNewVal, BOOL isUnicode)
    279300{
    280301 ULONG rc;
     
    306327                break;
    307328        case GCL_MENUNAME:
    308                 if(isUnicode) {
    309                         rc = menuNameW;
    310                         menuNameW = lNewVal;    //FIXME
    311                 }
    312                 else { 
    313                         rc = menuName;
    314                         menuName = lNewVal;     //FIXME
    315                 }
     329                rc = 0; //old value is meaningless (according to Wine)
     330                setMenuName((LPSTR)lNewVal);
    316331                break;
    317332        case GCL_STYLE:
     
    320335                break;
    321336        case GCL_WNDPROC:
    322                 rc = windowProc;
    323                 windowProc = lNewVal;
     337                rc = (ULONG)windowProc;
     338                windowProc = (WNDPROC)lNewVal;
    324339                break;
    325340        case GCW_ATOM: //TODO: does this really happen in windows?
     
    339354//******************************************************************************
    340355//******************************************************************************
    341 WORD Win32WndClass::setClassWord(int index, WORD wNewVal);
     356WORD Win32WndClass::setClassWord(int index, WORD wNewVal)
    342357{
    343358 WORD rc;
     
    375390//******************************************************************************
    376391//******************************************************************************
    377 Win32WndClass *Win32WndClass::wndclasses = NULL;
    378 
    379 //******************************************************************************
    380 //SvL: 18-7-'98: Moved here from user32.cpp
    381 //******************************************************************************
    382 ATOM WIN32API OS2RegisterClassA(WNDCLASS *lpWndClass)
    383 {
    384  WNDCLASSEXA wc;
    385  Win32Class *wclass;
    386 
    387    memcpy(&wc, lpWndClass, sizeof(WNDCLASS));
    388    wc.hIconSm = 0;
    389    
    390    wclass = new Win32Class(&wc);
    391    if(wclass == NULL) {
    392         dprintf(("RegisterClassA wclass == NULL!"));
    393         return(0);
    394    }
    395    return(wclass->getAtom());
    396 }
    397 //******************************************************************************
    398 //SvL: 18-7-'98: Moved here from user32.cpp
    399 //******************************************************************************
    400 ATOM WIN32API OS2RegisterClassExA(WNDCLASSEXA *lpWndClass)
    401 {
    402  Win32Class *wclass;
    403 
    404    wclass = new Win32Class(lpWndClass);
    405    if(wclass == NULL) {
    406         dprintf(("RegisterClassExA wclass == NULL!"));
    407         return(0);
    408    }
    409    return(wclass->getAtom());
    410 }
    411 //******************************************************************************
    412 //******************************************************************************
    413 WORD WIN32API OS2RegisterClassW(WNDCLASSW *lpwc)
    414 {
    415  ATOM rc;
    416  WNDCLASSEX wclass;
    417 
    418     dprintf(("RegisterClassW\n"));
    419     memcpy(&wclass, lpwc, sizeof(WNDCLASS));
    420     if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
    421         wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
    422     }
    423     if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
    424         wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
    425     }
    426     rc = OS2RegisterClassA(&wclass);
    427 
    428     if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
    429         FreeAsciiString((char *)wclass.lpszMenuName);
    430     }
    431     if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
    432         FreeAsciiString((char *)wclass.lpszClassName);
    433     }
    434     return(rc);
    435 }
    436 //******************************************************************************
    437 //******************************************************************************
    438 ATOM WIN32API OS2RegisterClassExW(CONST WNDCLASSEXW *lpwc)
    439 {
    440  ATOM rc;
    441  WNDCLASSEXA wclass;
    442 
    443     dprintf(("RegisterClassExW\n"));
    444     memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
    445     if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
    446         wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
    447     }
    448     if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
    449         wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
    450     }
    451     rc = OS2RegisterClassExA(&wclass);
    452 
    453     if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
    454         FreeAsciiString((char *)wclass.lpszMenuName);
    455     }
    456     if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
    457         FreeAsciiString((char *)wclass.lpszClassName);
    458     }
    459     return(rc);
    460 }
    461 //******************************************************************************
    462 //******************************************************************************
    463 BOOL WIN32API OS2UnregisterClassA(LPCSTR lpszClassName, HINSTANCE hinst)
    464 {
    465    dprintf(("USER32:  OS2UnregisterClassA\n"));
    466    Win32WndClass::UnregisterClass(hinst, (LPSTR)lpszClassName);
    467 
    468    //Spintest returns FALSE in dll termination, so pretend it succeeded
    469    return(TRUE);
    470 }
    471 //******************************************************************************
    472 //******************************************************************************
    473 BOOL WIN32API OS2UnregisterClassW(LPWSTR lpszClassName, HINSTANCE hinst)
    474 {
    475  char *astring = NULL;
    476 
    477   dprintf(("USER32:  OS2UnregisterClassW\n"));
    478   if((ULONG)lpszClassName >> 16 != 0) {
    479         astring = UnicodeToAsciiString(lpszClassName);
    480   }
    481   else  astring = (char *)lpszClassName;
    482 
    483   Win32WndClass::UnregisterClass(hinst, (LPSTR)astring);
    484   if(astring >> 16 != 0)       
    485         FreeAsciiString((char *)astring);
    486   //Spintest returns FALSE in dll termination, so pretend it succeeded
    487   return(TRUE);
    488 }
    489 //******************************************************************************
    490 //******************************************************************************
    491 BOOL WIN32API OS2GetClassInfoA(HINSTANCE hInstance, LPCSTR lpszClass, PWNDCLASSA lpwc)
    492 {
    493  WNDCLASSEXA    wc;
    494  BOOL           rc;
    495  Win32WndClass *wndclass;
    496 
    497   dprintf(("USER32:  OS2GetClassInfoA\n"));
    498 
    499   wndclass = FindClass(hInstance, lpszClass);
    500   if(wndclass) {
    501         wndclass->getClassInfo(&wc);
    502         memcpy(lpwc, &wc, sizeof(WNDCLASSA));
    503         return(TRUE);
    504   }
    505   return(FALSE); 
    506 }
    507 //******************************************************************************
    508 //******************************************************************************
    509 BOOL WIN32API OS2GetClassInfoW(HINSTANCE  hinst, LPWSTR lpszClass, PWNDCLASSW lpwc)
    510 {
    511  WNDCLASSEXW    wc;
    512  BOOL           rc;
    513  Win32WndClass *wndclass;
    514  char          *astring = NULL;
    515 
    516   dprintf(("USER32:  OS2GetClassInfoW\n"));
    517 
    518   if((ULONG)lpszClass >> 16 != 0) {
    519         astring = UnicodeToAsciiString(lpszClass);
    520   }
    521   else  astring = (char *)lpszClass;
    522 
    523   wndclass = FindClass(hInstance, astring);
    524   if((ULONG)astring >> 16 != 0)
    525         FreeAsciiString((char *)astring);
    526   if(wndclass) {
    527         wndclass->getClassInfo(&wc);
    528         memcpy(lpwc, &wc, sizeof(WNDCLASSW));
    529         return(TRUE);
    530   }
    531   return(FALSE); 
    532 }
    533 /****************************************************************************
    534  * Name      : BOOL WIN32API OS2GetClassInfoExA
    535  * Purpose   : The GetClassInfoEx function retrieves information about a window
    536  *             class, including the handle of the small icon associated with the
    537  *             window class. GetClassInfo does not retrieve the handle of the small icon.
    538  * Parameters: HINSTANCE    hinst     handle of application instance
    539  *             LPCTSTR      lpszClass address of class name string
    540  *             LPWNDCLASSEX lpwcx     address of structure for class data
    541  * Variables :
    542  * Result    : If the function finds a matching class and successfully copies
    543  *               the data, the return value is TRUE;
    544  *             otherwise, it is FALSE.
    545  *             To get extended error information, call GetLastError.
    546  * Remark    : PH: does not obtain handle of the small icon
    547  *****************************************************************************/
    548 BOOL WIN32API OS2GetClassInfoExA(HINSTANCE     hInstance,
    549                                  LPCTSTR       lpszClass,
    550                                  LPWNDCLASSEXA lpwcx)
    551 {
    552  BOOL           rc;
    553  Win32WndClass *wndclass;
    554  
    555   dprintf(("USER32:GetClassInfoExA (%08xh,%x,%08x).\n",
    556          hInstance,
    557          lpszClass,
    558          lpwcx));
    559  
    560   wndclass = FindClass(hInstance, lpszClass);
    561   if(wndclass) {
    562         wndclass->getClassInfo(lpwcx);
    563         return(TRUE);
    564   }
    565   return(FALSE); 
    566 }
    567 /*****************************************************************************
    568  * Name      : BOOL WIN32API OS2GetClassInfoExW
    569  * Purpose   : The GetClassInfoEx function retrieves information about a window
    570  *             class, including the handle of the small icon associated with the
    571  *             window class. GetClassInfo does not retrieve the handle of the small icon.
    572  * Parameters: HINSTANCE    hinst     handle of application instance
    573  *             LPCWSTR      lpszClass address of class name string
    574  *             LPWNDCLASSEX lpwcx     address of structure for class data
    575  * Variables :
    576  * Result    : If the function finds a matching class and successfully copies
    577  *               the data, the return value is TRUE;
    578  *             otherwise, it is FALSE.
    579  *             To get extended error information, call GetLastError.
    580  * Remark    : does not obtain handle of the small icon
    581  *
    582  *****************************************************************************/
    583 BOOL WIN32API OS2GetClassInfoExW(HINSTANCE     hInstance,
    584                                  LPCWSTR       lpszClass,
    585                                  LPWNDCLASSEXW lpwcx)
    586 {
    587  BOOL           rc;
    588  Win32WndClass *wndclass;
    589  char          *astring = NULL;
    590 
    591   dprintf(("USER32: OS2GetClassInfoExW\n"));
    592 
    593   if((ULONG)lpszClass >> 16 != 0) {
    594         astring = UnicodeToAsciiString(lpszClass);
    595   }
    596   else  astring = (char *)lpszClass;
    597 
    598   wndclass = FindClass(hInstance, astring);
    599   if((ULONG)astring >> 16 != 0)
    600         FreeAsciiString((char *)astring);
    601   if(wndclass) {
    602         wndclass->getClassInfo(lpwcx);
    603         return(TRUE);
    604   }
    605   return(FALSE); 
    606 }
    607 //******************************************************************************
    608 //******************************************************************************
    609 int WIN32API OS2GetClassNameA(HWND hwnd, LPSTR lpszClassName, int cchClassName)
    610 {
    611  Win32Window *wnd;
    612 
    613     dprintf(("USER32: OS2GetClassNameA\n"));
    614     wnd = WIN2OS2HWND(hwnd);
    615     if(wnd == NULL) {
    616         dprintf(("GetClassNameA wnd == NULL"));
    617         return(0);
    618     }
    619     return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
    620 }
    621 //******************************************************************************
    622 //******************************************************************************
    623 int WIN32API OS2GetClassNameW(HWND hwnd, LPWSTR lpszClassName, int cchClassName)
    624 {
    625  Win32Window *wnd;
    626 
    627     dprintf(("USER32: OS2GetClassNameW\n"));
    628     wnd = WIN2OS2HWND(hwnd);
    629     if(wnd == NULL) {
    630         dprintf(("GetClassNameA wnd == NULL"));
    631         return(0);
    632     }
    633     return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
    634 }
    635 //******************************************************************************
    636 //******************************************************************************
    637 DWORD WIN32API OS2SetClassLongA(HWND hwnd, int nIndex, LONG lNewVal)
    638 {
    639  Win32Window *wnd;
    640 
    641     dprintf(("USER32: OS2SetClassLongA\n"));
    642     wnd = WIN2OS2HWND(hwnd);
    643     if(wnd == NULL) {
    644         dprintf(("SetClassLongA wnd == NULL"));
    645         return(0);
    646     }
    647     return (wnd->getClass())->setClassLongA(nIndex, lNewVal);
    648 }
    649 //******************************************************************************
    650 //******************************************************************************
    651 DWORD WIN32API OS2SetClassLongW(HWND hwnd, int nIndex, LONG lNewVal)
    652 {
    653  Win32Window *wnd;
    654 
    655     dprintf(("USER32: OS2SetClassLongW\n"));
    656     wnd = WIN2OS2HWND(hwnd);
    657     if(wnd == NULL) {
    658         dprintf(("SetClassLongW wnd == NULL"));
    659         return(0);
    660     }
    661     return (wnd->getClass())->setClassLongW(nIndex, lNewVal);
    662 }
    663 //******************************************************************************
    664 //******************************************************************************
    665 WORD WIN32API OS2SetClassWord(HWND hwnd, int nIndex, WORD  wNewVal)
    666 {
    667  Win32Window *wnd;
    668 
    669     dprintf(("USER32: OS2SetClassWordA\n"));
    670     wnd = WIN2OS2HWND(hwnd);
    671     if(wnd == NULL) {
    672         dprintf(("SetClassWordA wnd == NULL"));
    673         return(0);
    674     }
    675     return (wnd->getClass())->setClassWord(nIndex, wNewVal);
    676 }
    677 //******************************************************************************
    678 //******************************************************************************
    679 WORD WIN32API OS2GetClassWord(HWND hwnd, int nIndex)
    680 {
    681  Win32Window *wnd;
    682 
    683     dprintf(("USER32: OS2GetClassWordA\n"));
    684     wnd = WIN2OS2HWND(hwnd);
    685     if(wnd == NULL) {
    686         dprintf(("GetClassWordA wnd == NULL"));
    687         return(0);
    688     }
    689     return (wnd->getClass())->getClassWord(nIndex);
    690 }
    691 //******************************************************************************
    692 //******************************************************************************
    693 DWORD WIN32API OS2GetClassLongA(HWND hwnd, int nIndex)
    694 {
    695  Win32Window *wnd;
    696 
    697     dprintf(("USER32: OS2GetClassLongA\n"));
    698     wnd = WIN2OS2HWND(hwnd);
    699     if(wnd == NULL) {
    700         dprintf(("OS2GetClassLongA wnd == NULL"));
    701         return(0);
    702     }
    703     return (wnd->getClass())->getClassLongA(nIndex);
    704 }
    705 //******************************************************************************
    706 //******************************************************************************
    707 DWORD WIN32API OS2GetClassLongW(HWND hwnd, int nIndex)
    708 {
    709  Win32Window *wnd;
    710 
    711     dprintf(("USER32: OS2GetClassLongW\n"));
    712     wnd = WIN2OS2HWND(hwnd);
    713     if(wnd == NULL) {
    714         dprintf(("OS2GetClassLongW wnd == NULL"));
    715         return(0);
    716     }
    717     return (wnd->getClass())->getClassLongW(nIndex);
    718 }
    719 //******************************************************************************
    720 //******************************************************************************
     392GenericObject *Win32WndClass::wndclasses = NULL;
     393
Note: See TracChangeset for help on using the changeset viewer.