Ignore:
Timestamp:
Oct 17, 1999, 3:49:09 AM (26 years ago)
Author:
bird
Message:

No exception throwing. Constructors is moved into an init method.
TLS is now implemented, but not tested.

File:
1 edited

Legend:

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

    r1274 r1325  
    1 /* $Id: winexepe2lx.cpp,v 1.2 1999-10-14 01:37:56 bird Exp $ */
     1/* $Id: winexepe2lx.cpp,v 1.3 1999-10-17 01:49:09 bird Exp $ */
    22
    33/*
     
    5252void WIN32API RegisterPe2LxExe(ULONG ulPe2LxVersion, HINSTANCE hinstance, ULONG ulReserved)
    5353{
     54    Win32Pe2LxExe *pWinPe2LxExe;
     55
    5456    /* I/O init. */
    5557    if (getenv("WIN32_IOPL2"))
     
    7375
    7476    /* Create Pe2Lx Exe object. */
    75     try
     77    pWinPe2LxExe = new Win32Pe2LxExe(hinstance, (ulPe2LxVersion & 0x80000000UL) == 0x80000000UL);
     78    if (pWinPe2LxExe == NULL)
    7679    {
    77         Win32Pe2LxExe *pWinPe2LxExe;
    78         pWinPe2LxExe = new Win32Pe2LxExe(hinstance, (ulPe2LxVersion & 0x80000000UL) == 0x80000000UL);
    79         if (pWinPe2LxExe == NULL)
    80             throw ((ULONG)ERROR_NOT_ENOUGH_MEMORY);
    81 
    82         /* Call start (which calls the entry point). */
    83         /*DebugInt3();*/
    84         pWinPe2LxExe->start();
    85     }
    86     catch (ULONG ul)
    87     {
    88         eprintf(("Win32Pe2LxExe creation failed! ul=%d\n", ul));
    89         DebugInt3();
     80        eprintf(("RegisterPe2LxExe: new returned a NULL-pointer\n"));
    9081        return;
    9182    }
     83    if (!pWinPe2LxExe->init())
     84    {
     85        eprintf(("RegisterPe2LxExe: init-method failed.\n"));
     86        delete pWinPe2LxExe;
     87        return;
     88    }
     89
     90    /* Call start (which calls the entry point). */
     91    /*DebugInt3();*/
     92    pWinPe2LxExe->start();
    9293}
    9394
     
    102103 * @remark    Win32Pe2LxImage may throw an exception!
    103104 */
    104 Win32Pe2LxExe::Win32Pe2LxExe(HINSTANCE hinstance, BOOL fWin32k) throw(ULONG):
    105     Win32ImageBase(hinstance),
     105Win32Pe2LxExe::Win32Pe2LxExe(HINSTANCE hinstance, BOOL fWin32k)
     106    : Win32ImageBase(hinstance),
    106107    Win32ExeBase(hinstance),
    107108    Win32Pe2LxImage(hinstance, fWin32k)
    108109{
    109     fConsoleApp = pNtHdrs->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI;
    110 
    111     /* console app? */
    112     if (fConsoleApp)
    113     {
    114         APIRET rc;
    115 
    116         dprintf(("Console application!\n"));
    117 
    118         rc = iConsoleInit();    /* initialize console subsystem */
    119         if (rc != NO_ERROR)     /* check for errors */
    120             dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
    121     }
    122110}
    123111
     
    130118Win32Pe2LxExe::~Win32Pe2LxExe()
    131119{
     120
    132121}
     122
     123
     124/**
     125 * Init object.
     126 * Must be called immedeately after the object construction.
     127 * @returns   Success indicator. (TRUE == success)
     128 * @sketch
     129 * @status    completely implemented.
     130 * @author    knut st. osmundsen
     131 */
     132BOOL Win32Pe2LxExe::init()
     133{
     134    if (Win32Pe2LxImage::init())
     135    {
     136        fConsoleApp = pNtHdrs->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI;
     137
     138        /* console app? */
     139        if (fConsoleApp)
     140        {
     141            APIRET rc;
     142
     143            dprintf(("Console application!\n"));
     144
     145            rc = iConsoleInit();    /* initialize console subsystem */
     146            if (rc != NO_ERROR)     /* check for errors */
     147                dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
     148        }
     149    }
     150    else
     151        return FALSE;
     152    return TRUE;
     153}
     154
Note: See TracChangeset for help on using the changeset viewer.