Changeset 1194 for trunk/src/user32


Ignore:
Timestamp:
Oct 8, 1999, 8:39:35 PM (26 years ago)
Author:
sandervl
Message:

Property fixes, set last error when window creation fails

Location:
trunk/src/user32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r1189 r1194  
    1 # $Id: Makefile,v 1.26 1999-10-08 16:13:07 cbratschi Exp $
     1# $Id: Makefile,v 1.27 1999-10-08 18:39:33 sandervl Exp $
    22
    33#
     
    9292window.obj:    window.cpp win32class.h win32wbase.h win32wndchild.h oslibwin.h win32wmdiclient.h win32wdesktop.h
    9393windowmsg.obj: windowmsg.cpp win32class.h win32wbase.h win32wndchild.h oslibmsg.h
    94 winprop.obj:   winprop.cpp
     94winprop.obj:   winprop.cpp win32wbase.h
    9595wingdi.obj:    wingdi.cpp win32wbase.h oslibgdi.h
    9696windowclass.obj: windowclass.cpp win32class.h win32wbase.h win32wndchild.h
  • trunk/src/user32/defwndproc.cpp

    r949 r1194  
    1 /* $Id: defwndproc.cpp,v 1.8 1999-09-15 23:18:49 sandervl Exp $ */
     1/* $Id: defwndproc.cpp,v 1.9 1999-10-08 18:39:34 sandervl Exp $ */
    22
    33/*
     
    5656
    5757    dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     58//TODO: Wrong check?
    5859    if(!dialog || !dialog->IsDialog()) {
     60//    if(!dialog) {
    5961        dprintf(("DefDlgProcA, window %x not found", hwnd));
    6062        return 0;
     
    6971
    7072    dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     73//TODO: Wrong check?
    7174    if(!dialog || !dialog->IsDialog()) {
     75//    if(!dialog) {
    7276        dprintf(("DefDlgProcW, window %x not found", hwnd));
    7377        return 0;
  • trunk/src/user32/win32dlg.cpp

    r1126 r1194  
    1 /* $Id: win32dlg.cpp,v 1.7 1999-10-04 18:32:50 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.8 1999-10-08 18:39:34 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    195195    if (createControls(dlgTemplate, hInst))
    196196    {
     197        dprintf(("********* DIALOG CONTROLS CREATED ************"));
    197198        /* Send initialisation messages and set focus */
    198199        hwndFocus = GetNextDlgTabItem( getWindowHandle(), 0, FALSE );
     
    210211        return;
    211212    }
     213    dprintf(("********* DIALOG CREATION FAILED! ************"));
    212214    DestroyWindow();
    213215}
  • trunk/src/user32/win32wbase.cpp

    r1189 r1194  
    1 /* $Id: win32wbase.cpp,v 1.30 1999-10-08 16:13:08 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.31 1999-10-08 18:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    306306        {
    307307            dprintf(("HwGetWindowHandleData couldn't find owner window %x!!!", cs->hwndParent));
     308            SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    308309            return FALSE;
    309310        }
     
    320321            {
    321322                dprintf(("HwGetWindowHandleData couldn't find owner window %x!!!", cs->hwndParent));
     323                SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    322324                return FALSE;
    323325            }
     
    450452  if(OS2Hwnd == 0) {
    451453        dprintf(("Window creation failed!!"));
     454        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    452455        return FALSE;
    453456  }
     
    455458  if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    456459        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
     460        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    457461        return FALSE;
    458462  }
    459463  if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    460464        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
     465        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    461466        return FALSE;
    462467  }
     
    464469  if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_SHAREDMEM, HeapGetSharedMemBase()) == FALSE) {
    465470        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
     471        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    466472        return FALSE;
    467473  }
     
    470476    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    471477            dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
     478            SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    472479            return FALSE;
    473480    }
    474481    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    475482            dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
     483            SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    476484            return FALSE;
    477485    }
     
    479487    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_SHAREDMEM, HeapGetSharedMemBase()) == FALSE) {
    480488            dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
     489            SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    481490            return FALSE;
    482491    }
     
    576585        }
    577586  }
     587  dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
    578588  fCreated = FALSE;
    579589  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
    580590  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
    581591  DestroyWindow();
     592  SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    582593  return FALSE;
    583594}
  • trunk/src/user32/winprop.cpp

    r949 r1194  
    1 /* $Id: winprop.cpp,v 1.1 1999-09-15 23:19:03 sandervl Exp $ */
     1/* $Id: winprop.cpp,v 1.2 1999-10-08 18:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Property apis for OS/2
     
    1212#include <user32.h>
    1313#include <misc.h>
     14#include "win32wbase.h"
    1415
    1516//******************************************************************************
    1617//******************************************************************************
    17 int WIN32API EnumPropsA(HWND arg1, PROPENUMPROCA arg2)
     18int WIN32API EnumPropsA(HWND hwnd, PROPENUMPROCA arg2)
    1819{
    1920#ifdef DEBUG
     
    2223    //calling convention problems
    2324    return 0;
    24 //    return O32_EnumProps(arg1, (PROPENUMPROC_O32)arg2);
     25//    return O32_EnumProps(hwnd, (PROPENUMPROC_O32)arg2);
    2526}
    2627//******************************************************************************
    2728//******************************************************************************
    28 int WIN32API EnumPropsExA( HWND arg1, PROPENUMPROCEXA arg2, LPARAM  arg3)
     29int WIN32API EnumPropsExA( HWND hwnd, PROPENUMPROCEXA arg2, LPARAM  arg3)
    2930{
    3031#ifdef DEBUG
     
    3334    //calling convention problems
    3435    return 0;
    35 //    return O32_EnumPropsEx(arg1, arg2, (PROPENUMPROCEX_O32)arg3);
     36//    return O32_EnumPropsEx(hwnd, arg2, (PROPENUMPROCEX_O32)arg3);
    3637}
    3738//******************************************************************************
    3839//******************************************************************************
    39 int WIN32API EnumPropsExW( HWND arg1, PROPENUMPROCEXW arg2, LPARAM  arg3)
     40int WIN32API EnumPropsExW( HWND hwnd, PROPENUMPROCEXW arg2, LPARAM  arg3)
    4041{
    4142#ifdef DEBUG
     
    4546    //calling convention problems
    4647    return 0;
    47 //    return O32_EnumPropsEx(arg1, arg2, arg3);
     48//    return O32_EnumPropsEx(hwnd, arg2, arg3);
    4849}
    4950//******************************************************************************
    5051//******************************************************************************
    51 int WIN32API EnumPropsW( HWND arg1, PROPENUMPROCW  arg2)
     52int WIN32API EnumPropsW( HWND hwnd, PROPENUMPROCW  arg2)
    5253{
    5354#ifdef DEBUG
     
    5758    //calling convention problems
    5859    return 0;
    59 //    return O32_EnumProps(arg1, arg2);
     60//    return O32_EnumProps(hwnd, arg2);
    6061}
    6162//******************************************************************************
    6263//******************************************************************************
    63 HANDLE WIN32API GetPropA( HWND arg1, LPCSTR arg2)
     64HANDLE WIN32API GetPropA(HWND hwnd, LPCSTR arg2)
    6465{
     66  Win32BaseWindow *window;
     67  HANDLE rc;
     68
     69    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     70    if(!window) {
     71        dprintf(("GetPropA, window %x not found", hwnd));
     72        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     73        return 0;
     74    }
     75    rc = O32_GetProp(window->getOS2WindowHandle(), arg2);
    6576#ifdef DEBUG
    66     if((int)arg2 >> 16 != 0)
    67      WriteLog("USER32:  GetPropA %s\n", arg2);
    68     else WriteLog("USER32:  GetPropA %X\n", arg2);
     77    if(HIWORD(arg2) != 0)
     78         dprintf(("USER32: GetPropA %s returned %x\n", arg2, rc));
     79    else dprintf(("USER32: GetPropA %X returned %x\n", arg2, rc));
    6980#endif
    70     return O32_GetProp(arg1, arg2);
     81    return rc;
    7182}
    7283//******************************************************************************
    7384//******************************************************************************
    74 HANDLE WIN32API GetPropW(HWND arg1, LPCWSTR arg2)
     85HANDLE WIN32API GetPropW(HWND hwnd, LPCWSTR arg2)
    7586{
    7687 BOOL  handle;
    7788 char *astring;
    7889
    79     if((int)arg2 >> 16 != 0)
     90    if(HIWORD(arg2) != 0)
    8091         astring = UnicodeToAsciiString((LPWSTR)arg2);
    8192    else astring = (char *)arg2;
    82 #ifdef DEBUG
    83     if((int)arg2 >> 16 != 0)
    84          WriteLog("USER32:  GetPropW %s\n", astring);
    85     else WriteLog("USER32:  GetPropW %X\n", astring);
    86 #endif
    87     handle = GetPropA(arg1, (LPCSTR)astring);
    88     if((int)arg2 >> 16 != 0)
     93
     94    handle = GetPropA(hwnd, (LPCSTR)astring);
     95    if(HIWORD(astring) != 0)
    8996        FreeAsciiString(astring);
    9097
     
    93100//******************************************************************************
    94101//******************************************************************************
    95 HANDLE WIN32API RemovePropA( HWND arg1, LPCSTR  arg2)
     102HANDLE WIN32API RemovePropA( HWND hwnd, LPCSTR  arg2)
    96103{
     104 Win32BaseWindow *window;
     105
     106    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     107    if(!window) {
     108        dprintf(("RemovePropA, window %x not found", hwnd));
     109        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     110        return 0;
     111    }
    97112#ifdef DEBUG
    98     WriteLog("USER32:  RemovePropA\n");
     113    if(HIWORD(arg2) != 0)
     114         dprintf(("USER32: RemovePropA %S\n", arg2));
     115    else dprintf(("USER32: RemovePropA %X\n", arg2));
    99116#endif
    100     return O32_RemoveProp(arg1, arg2);
     117    return O32_RemoveProp(window->getWindowHandle(), arg2);
    101118}
    102119//******************************************************************************
    103120//******************************************************************************
    104 HANDLE WIN32API RemovePropW( HWND arg1, LPCWSTR arg2)
     121HANDLE WIN32API RemovePropW( HWND hwnd, LPCWSTR arg2)
    105122{
    106  char *astring = UnicodeToAsciiString((LPWSTR)arg2);
     123 char  *astring;
    107124 HANDLE rc;
    108125
    109 #ifdef DEBUG
    110     WriteLog("USER32:  RemovePropW\n");
    111 #endif
    112     rc = O32_RemoveProp(arg1, astring);
    113     FreeAsciiString(astring);
     126    if(HIWORD(arg2) != 0)
     127         astring = UnicodeToAsciiString((LPWSTR)arg2);
     128    else astring = (char *)arg2;
     129
     130    rc = RemovePropA(hwnd, astring);
     131
     132    if(HIWORD(astring) != 0)
     133        FreeAsciiString(astring);
    114134    return rc;
    115135}
    116136//******************************************************************************
    117137//******************************************************************************
    118 BOOL WIN32API SetPropA( HWND arg1, LPCSTR arg2, HANDLE  arg3)
     138BOOL WIN32API SetPropA( HWND hwnd, LPCSTR arg2, HANDLE  arg3)
    119139{
     140 Win32BaseWindow *window;
     141
     142    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     143    if(!window) {
     144        dprintf(("SetPropA, window %x not found", hwnd));
     145        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     146        return 0;
     147    }
    120148#ifdef DEBUG
    121     if((int)arg2 >> 16 != 0)
    122      WriteLog("USER32:  SetPropA %S\n", arg2);
    123     else WriteLog("USER32:  SetPropA %X\n", arg2);
     149    if(HIWORD(arg2) != 0)
     150         dprintf(("USER32: SetPropA %S to %x\n", arg2, arg3));
     151    else dprintf(("USER32: SetPropA %X to %x\n", arg2, arg3));
    124152#endif
    125     return O32_SetProp(arg1, arg2, arg3);
     153    return O32_SetProp(window->getWindowHandle(), arg2, arg3);
    126154}
    127155//******************************************************************************
    128156//******************************************************************************
    129 BOOL WIN32API SetPropW(HWND arg1, LPCWSTR arg2, HANDLE arg3)
     157BOOL WIN32API SetPropW(HWND hwnd, LPCWSTR arg2, HANDLE arg3)
    130158{
    131159 BOOL  rc;
    132160 char *astring;
    133161
    134     if((int)arg2 >> 16 != 0)
     162    if(HIWORD(arg2) != 0)
    135163         astring = UnicodeToAsciiString((LPWSTR)arg2);
    136164    else astring = (char *)arg2;
    137165
    138 #ifdef DEBUG
    139     if((int)arg2 >> 16 != 0)
    140          WriteLog("USER32:  SetPropW %S\n", astring);
    141     else WriteLog("USER32:  SetPropW %X\n", astring);
    142 #endif
    143     rc = O32_SetProp(arg1, astring, arg3);
    144     if((int)astring >> 16 != 0)
     166    rc = SetPropA(hwnd, astring, arg3);
     167    if(HIWORD(astring) != 0)
    145168        FreeAsciiString(astring);
     169
    146170    return(rc);
    147171}
Note: See TracChangeset for help on using the changeset viewer.