Changeset 532 for trunk/src


Ignore:
Timestamp:
Aug 17, 1999, 7:04:52 PM (26 years ago)
Author:
sandervl
Message:

Compilation fixes

Location:
trunk/src/kernel32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/HandleManager.cpp

    r529 r532  
    1 /* $Id: HandleManager.cpp,v 1.9 1999-08-17 16:35:08 phaller Exp $ */
     1/* $Id: HandleManager.cpp,v 1.10 1999-08-17 17:04:50 sandervl Exp $ */
    22
    33/*
  • trunk/src/kernel32/KERNEL32.CPP

    r529 r532  
    1 /* $Id: KERNEL32.CPP,v 1.13 1999-08-17 16:35:09 phaller Exp $ */
    2 
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
     1/* $Id: KERNEL32.CPP,v 1.14 1999-08-17 17:04:51 sandervl Exp $ */
     2
    83/*
    94 * Win32 compatibility file functions for OS/2
     
    1510 *
    1611 * @(#) KERNEL32.CPP            1.0.1   1998/06/12 PH added HandleManager support
     12 *
     13 * Project Odin Software License can be found in LICENSE.TXT
     14 *
    1715 */
    1816
     
    2624#include <stdlib.h>
    2725#include <string.h>
    28 //#include <odincrt.h>
    2926
    3027#include "misc.h"
  • trunk/src/kernel32/heap.cpp

    r529 r532  
    1 /* $Id: heap.cpp,v 1.12 1999-08-17 16:35:09 phaller Exp $ */
     1/* $Id: heap.cpp,v 1.13 1999-08-17 17:04:51 sandervl Exp $ */
    22
    33/*
     
    7070  if(curheap == NULL)
    7171  {
    72       O32_HeapDestroy(hHeap);
     72        O32_HeapDestroy(hHeap);
    7373        return(NULL);
    7474  }
     
    9292
    9393  O32_HeapDestroy(curheap->getHeapHandle());
    94   delete curheap;
     94  delete(curheap);
    9595  return(TRUE);
    9696}
     
    157157
    158158      if(OS2ProcessHeap == NULL) {
    159          O32_HeapDestroy(hHeap);
    160                return(NULL);
     159                O32_HeapDestroy(hHeap);
     160                return(NULL);
    161161      }
    162162      processheap = hHeap;
  • trunk/src/kernel32/os2heap.cpp

    r529 r532  
    1 /* $Id: os2heap.cpp,v 1.7 1999-08-17 16:35:09 phaller Exp $ */
     1/* $Id: os2heap.cpp,v 1.8 1999-08-17 17:04:51 sandervl Exp $ */
    22
    33/*
     
    9191  {
    9292    hmutex->leave();
    93     delete hmutex;
     93    delete(hmutex);
    9494  }
    9595
  • trunk/src/kernel32/thread.cpp

    r529 r532  
    1 /* $Id: thread.cpp,v 1.9 1999-08-17 16:35:10 phaller Exp $ */
     1/* $Id: thread.cpp,v 1.10 1999-08-17 17:04:52 sandervl Exp $ */
    22
    33/*
     
    1212#include <os2win.h>
    1313#include <stdarg.h>
    14 //#include <odincrt.h>
    1514#include "thread.h"
    1615#include "except.h"
     
    160159 DWORD            rc;
    161160
    162  delete(me);    //only called once
    163 
     161  delete(me);    //only called once
    164162  dprintf(("Win32ThreadProc %d\n", GetCurrentThreadId()));
    165163
  • trunk/src/kernel32/winimage.cpp

    r529 r532  
    1 /* $Id: winimage.cpp,v 1.8 1999-08-17 16:35:10 phaller Exp $ */
     1/* $Id: winimage.cpp,v 1.9 1999-08-17 17:04:52 sandervl Exp $ */
    22
    33/*
     
    144144  {
    145145    res    = winres->next;
    146     delete winres;
     146    delete(winres);
    147147    winres = res;
    148148  }
     
    985985        if(WinDll == NULL) {
    986986            fout << "WinDll: Error allocating memory" << endl;
    987                 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
     987            WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
    988988            errorState = ERROR_INTERNAL;
    989989            return(FALSE);
  • trunk/src/kernel32/winimgres.cpp

    r529 r532  
    1 /* $Id: winimgres.cpp,v 1.6 1999-08-17 16:35:11 phaller Exp $ */
    2 
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
     1/* $Id: winimgres.cpp,v 1.7 1999-08-17 17:04:52 sandervl Exp $ */
     2
    83/*
    94 * Win32 PE Image class (resource methods)
    105 *
    116 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     7 *
     8 *
     9 * Project Odin Software License can be found in LICENSE.TXT
    1210 *
    1311 */
     
    160158        unicodestr += *unicodestr;
    161159    }
    162 
    163160    res = new Win32Resource(this, id, NTRT_STRING, (ULONG)*unicodestr, (char *)unicodestr);
    164161    if(res == NULL) {
     
    167164    }
    168165  }
    169   else
    170     res = new Win32Resource(this, id, type, pData->Size, resdata);
     166  else  res = new Win32Resource(this, id, type, pData->Size, resdata);
    171167
    172168  return res;
  • trunk/src/kernel32/wprocess.cpp

    r529 r532  
    1 /* $Id: wprocess.cpp,v 1.19 1999-08-17 16:35:11 phaller Exp $ */
     1/* $Id: wprocess.cpp,v 1.20 1999-08-17 17:04:52 sandervl Exp $ */
    22
    33/*
     
    1414#include <stdlib.h>
    1515#include <string.h>
    16 #include <odinwrap.h>
    1716
    1817#include "unicode.h"
     
    3736//Process database
    3837PDB       ProcessPDB = {0};
    39 USHORT     ProcessTIBSel = 0;
     38USHORT    ProcessTIBSel = 0;
    4039DWORD    *TIBFlatPtr    = 0;
    4140
     
    7776   TIBFlatPtr = (DWORD *)OS2AllocThreadLocalMemory(1);
    7877   if(TIBFlatPtr == 0) {
    79    dprintf(("InitializeTIB: local thread memory alloc failed!!"));
    80    DebugInt3();
    81    return NULL;
     78        dprintf(("InitializeTIB: local thread memory alloc failed!!"));
     79        DebugInt3();
     80        return NULL;
    8281   }
    8382   if(OS2AllocSel(PAGE_SIZE, &tibsel) == FALSE)
    8483   {
    85    dprintf(("InitializeTIB: selector alloc failed!!"));
    86    DebugInt3();
    87    return NULL;
     84        dprintf(("InitializeTIB: selector alloc failed!!"));
     85        DebugInt3();
     86        return NULL;
    8887   }
    8988   winteb = (TEB *)OS2SelToFlat(tibsel);
    9089   if(winteb == NULL)
    9190   {
    92    dprintf(("InitializeTIB: DosSelToFlat failed!!"));
    93    DebugInt3();
    94    return NULL;
     91        dprintf(("InitializeTIB: DosSelToFlat failed!!"));
     92        DebugInt3();
     93        return NULL;
    9594   }
    9695   memset(winteb, 0, PAGE_SIZE);
     
    117116   if(OS2GetPIB(PIB_TASKTYPE) == TASKTYPE_PM)
    118117   {
    119    thdb->flags      = 0;  //todo gui
    120    }
    121    else  thdb->flags      = 0;  //todo textmode
     118        thdb->flags      = 0;  //todo gui
     119   }
     120   else thdb->flags      = 0;  //todo textmode
    122121
    123122   if(fMainThread)
    124123   {
    125    //todo initialize PDB during process creation
     124        //todo initialize PDB during process creation
    126125        //todo: initialize TLS array if required
    127126        //TLS in executable always TLS index 0?
    128    ProcessTIBSel = tibsel;
     127        ProcessTIBSel = tibsel;
    129128   }
    130129   dprintf(("InitializeTIB setup TEB with selector %x", tibsel));
     
    146145   winteb = (TEB *)*TIBFlatPtr;
    147146   if(winteb) {
    148    thdb = (THDB *)(winteb+1);
    149    orgtibsel = thdb->OrgTIBSel;
    150 
    151    //Restore our original FS selector
    152       SetFS(orgtibsel);
    153 
    154       //And free our own
    155       OS2FreeSel(thdb->teb_sel);
     147        thdb = (THDB *)(winteb+1);
     148        orgtibsel = thdb->OrgTIBSel;
     149
     150        //Restore our original FS selector
     151        SetFS(orgtibsel);
     152
     153        //And free our own
     154        OS2FreeSel(thdb->teb_sel);
    156155   }
    157156   else dprintf(("Already destroyed TIB"));
     
    171170   winteb = (TEB *)*TIBFlatPtr;
    172171   if(winteb) {
    173    thdb = (THDB *)(winteb+1);
    174    orgtibsel = thdb->OrgTIBSel;
    175 
    176    //Restore our original FS selector
    177       SetFS(orgtibsel);
     172        thdb = (THDB *)(winteb+1);
     173        orgtibsel = thdb->OrgTIBSel;
     174
     175        //Restore our original FS selector
     176        SetFS(orgtibsel);
    178177   }
    179178}
     
    188187   winteb = (TEB *)*TIBFlatPtr;
    189188   if(winteb) {
    190    thdb = (THDB *)(winteb+1);
    191    win32tibsel = thdb->teb_sel;
    192 
    193    //Restore our win32 FS selector
    194       return SetReturnFS(win32tibsel);
     189        thdb = (THDB *)(winteb+1);
     190        win32tibsel = thdb->teb_sel;
     191
     192        //Restore our win32 FS selector
     193        return SetReturnFS(win32tibsel);
    195194   }
    196195   // nested calls are OK, OS2ToWinCallback for instance
     
    202201//******************************************************************************
    203202void WIN32API RegisterExe(WIN32EXEENTRY EntryPoint, PIMAGE_TLS_CALLBACK *TlsCallbackAddr,
    204            LPDWORD TlsIndexAddr, ULONG TlsInitSize,
    205            ULONG TlsTotalSize, LPVOID TlsAddress,
    206                  LONG Win32TableId, LONG NameTableId, LONG VersionResId,
    207                     LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwReserved)
     203                          LPDWORD TlsIndexAddr, ULONG TlsInitSize,
     204                          ULONG TlsTotalSize, LPVOID TlsAddress,
     205                          LONG Win32TableId, LONG NameTableId, LONG VersionResId,
     206                         LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwReserved)
    208207{
    209208  if(WinExe != NULL) //should never happen
    210     delete WinExe;
    211 
     209        delete(WinExe);
    212210
    213211  CheckVersion(Pe2lxVersion, OS2GetDllName(hinstance));
     
    223221
    224222  if(winexe) {
    225    dprintf(("RegisterExe Win32TableId = %x", Win32TableId));
    226    dprintf(("RegisterExe NameTableId  = %x", NameTableId));
    227    dprintf(("RegisterExe VersionResId = %x", VersionResId));
    228    dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion));
    229 
    230       winexe->setVersionId(VersionResId);
    231       winexe->setOS2InstanceHandle(hinstance);
    232    winexe->setEntryPoint((ULONG)EntryPoint);
    233    winexe->setTLSAddress(TlsAddress);
    234    winexe->setTLSInitSize(TlsInitSize);
    235    winexe->setTLSTotalSize(TlsTotalSize);
    236    winexe->setTLSIndexAddr(TlsIndexAddr);
    237    winexe->setTLSCallBackAddr(TlsCallbackAddr);
    238 
    239    char *modname = getenv("WIN32MODULE");
    240 
    241    if(modname != NULL)
    242    {
    243          dprintf(("Set full path for exe to %s", modname));
    244          winexe->setFullPath(modname);
    245    }
    246    winexe->start();
     223        dprintf(("RegisterExe Win32TableId = %x", Win32TableId));
     224        dprintf(("RegisterExe NameTableId  = %x", NameTableId));
     225        dprintf(("RegisterExe VersionResId = %x", VersionResId));
     226        dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion));
     227
     228        winexe->setVersionId(VersionResId);
     229        winexe->setOS2InstanceHandle(hinstance);
     230        winexe->setEntryPoint((ULONG)EntryPoint);
     231        winexe->setTLSAddress(TlsAddress);
     232        winexe->setTLSInitSize(TlsInitSize);
     233        winexe->setTLSTotalSize(TlsTotalSize);
     234        winexe->setTLSIndexAddr(TlsIndexAddr);
     235        winexe->setTLSCallBackAddr(TlsCallbackAddr);
     236
     237        char *modname = getenv("WIN32MODULE");
     238
     239        if(modname != NULL)
     240        {
     241                dprintf(("Set full path for exe to %s", modname));
     242                winexe->setFullPath(modname);
     243        }
     244        winexe->start();
    247245  }
    248246  else {
    249       eprintf(("Win32Exe creation failed!\n"));
    250       DebugInt3();
    251    return;
     247        eprintf(("Win32Exe creation failed!\n"));
     248        DebugInt3();
     249        return;
    252250  }
    253251}
     
    255253//******************************************************************************
    256254ULONG WIN32API RegisterDll(WIN32DLLENTRY pfnDllEntry, PIMAGE_TLS_CALLBACK *TlsCallbackAddr,
    257             LPDWORD TlsIndexAddr, ULONG TlsInitSize,
    258             ULONG TlsTotalSize, LPVOID TlsAddress,
    259                   LONG Win32TableId, LONG NameTableId, LONG VersionResId,
    260                      LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType)
     255                           LPDWORD TlsIndexAddr, ULONG TlsInitSize,
     256                           ULONG TlsTotalSize, LPVOID TlsAddress,
     257                           LONG Win32TableId, LONG NameTableId, LONG VersionResId,
     258                           LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType)
    261259{
    262260 char *name;
     
    265263  if(dwAttachType == 0)
    266264  { //Process attach
    267    if(getenv("WIN32_IOPL2")) {
    268          io_init1();
    269    }
    270    name = OS2GetDllName(hinstance);
    271    CheckVersion(Pe2lxVersion, name);
    272 
    273    dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType));
    274    dprintf(("RegisterDll Win32TableId = %x", Win32TableId));
    275    dprintf(("RegisterDll NameTableId  = %x", NameTableId));
    276    dprintf(("RegisterDll VersionResId = %x", VersionResId));
    277    dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion));
    278 
    279    if(winmod != NULL) {
    280          //dll manually loaded by PE loader (Win32Dll::init)
    281          winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry);
    282    }
    283    else {
    284       //converted win32 dll loaded by OS/2 loader
    285       winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry);
    286       if(winmod == NULL) {
    287             eprintf(("Failed to allocate module object!\n"));
    288             DebugInt3();
    289             return 0;                    //fail dll load
    290       }
    291    }
    292    winmod->setTLSAddress(TlsAddress);
    293    winmod->setTLSInitSize(TlsInitSize);
    294    winmod->setTLSTotalSize(TlsTotalSize);
    295    winmod->setTLSIndexAddr(TlsIndexAddr);
    296    winmod->setTLSCallBackAddr(TlsCallbackAddr);
    297 
    298    /* @@@PH 1998/03/17 console devices initialization */
    299    iConsoleDevicesRegister();
    300 
    301    //SvL: 19-8-'98
    302    winmod->AddRef();
    303    winmod->setVersionId(VersionResId);
    304 
    305    winmod->attachProcess();
     265        if(getenv("WIN32_IOPL2")) {
     266                io_init1();
     267        }
     268        name = OS2GetDllName(hinstance);
     269        CheckVersion(Pe2lxVersion, name);
     270
     271        dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType));
     272        dprintf(("RegisterDll Win32TableId = %x", Win32TableId));
     273        dprintf(("RegisterDll NameTableId  = %x", NameTableId));
     274        dprintf(("RegisterDll VersionResId = %x", VersionResId));
     275        dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion));
     276
     277        if(winmod != NULL) {
     278                //dll manually loaded by PE loader (Win32Dll::init)
     279                winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry);
     280        }
     281        else {
     282                //converted win32 dll loaded by OS/2 loader
     283                winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry);
     284                if(winmod == NULL) {
     285                        eprintf(("Failed to allocate module object!\n"));
     286                        DebugInt3();
     287                        return 0;                    //fail dll load
     288                }
     289        }
     290        winmod->setTLSAddress(TlsAddress);
     291        winmod->setTLSInitSize(TlsInitSize);
     292        winmod->setTLSTotalSize(TlsTotalSize);
     293        winmod->setTLSIndexAddr(TlsIndexAddr);
     294        winmod->setTLSCallBackAddr(TlsCallbackAddr);
     295
     296        /* @@@PH 1998/03/17 console devices initialization */
     297        iConsoleDevicesRegister();
     298
     299        //SvL: 19-8-'98
     300        winmod->AddRef();
     301        winmod->setVersionId(VersionResId);
     302
     303        winmod->attachProcess();
    306304   }
    307305   else {//process detach
    308    if(winmod != NULL && !fFreeLibrary) {
    309       return 0;   //don't unload (OS/2 dll unload bug)
    310    }
    311 //Runtime environment could already be gone, so don't do this
    312 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n"));
     306        if(winmod != NULL && !fFreeLibrary) {
     307                return 0;   //don't unload (OS/2 dll unload bug)
     308        }
     309        //Runtime environment could already be gone, so don't do this
     310        // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n"));
    313311   }
    314312   return 1;   //success
     
    321319
    322320  if(WinExe) {
    323     delete WinExe;
     321    delete(WinExe);
    324322    WinExe = NULL;
    325323  }
     
    400398    if(module->getError() != NO_ERROR) {
    401399        dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile));
    402         delete module;
     400        delete(module);
    403401        return(0);
    404402    }
    405403    if(module->attachProcess() == FALSE) {
    406404        dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile));
    407         delete module;
     405        delete(module);
    408406        return(0);
    409407    }
     
    465463
    466464    module = new Win32Dll((char *)lpszLibFile);
     465
    467466    if(module == NULL)
    468467        return(0);
     
    471470    if(module->getError() != NO_ERROR) {
    472471        dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile));
    473         delete module;
     472        delete(module);
    474473        return(0);
    475474    }
     
    479478    if(module->attachProcess() == FALSE) {
    480479        dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile));
    481         delete module;
     480        delete(module);
    482481        return(0);
    483482    }
Note: See TracChangeset for help on using the changeset viewer.