Ignore:
Timestamp:
Jul 8, 2001, 4:49:47 AM (24 years ago)
Author:
bird
Message:

Early creatation and initiation of executable object (WinExe).

File:
1 edited

Legend:

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

    r5327 r6211  
    1 /* $Id: winexepe2lx.cpp,v 1.9 2001-03-19 14:49:22 bird Exp $ */
     1/* $Id: winexepe2lx.cpp,v 1.10 2001-07-08 02:49:47 bird Exp $ */
    22
    33/*
     
    2626#include <misc.h>
    2727#include <win32type.h>
    28 #include <winexepe2lx.h>
     28#include <win32k.h>
     29#include "winexepe2lx.h"
    2930
    3031#include "cio.h"            // I/O
     
    3536#define DBG_LOCALLOG    DBG_winexepe2lx
    3637#include "dbglocal.h"
     38
     39
     40/*******************************************************************************
     41*   Global Variables                                                           *
     42*******************************************************************************/
     43BOOL Win32Pe2LxExe::fEarlyInit = FALSE;
    3744
    3845
     
    6471    CheckVersion(ulPe2LxVersion & ~0x80000000UL, OSLibGetDllName(hinstance));
    6572
    66     /* Frees WinExe if is not NULL - should never happen! */
    67     if (WinExe != NULL)
    68     {
    69         dprintf(("RegisterPe2LxExe: WinExe != NULL\n"));
    70         delete(WinExe);
    71     }
    72 
    7373    /* Write info to the log. */
    7474    dprintf(("RegisterPe2LxExe: ulPe2LxVersion = %#x\n", ulPe2LxVersion));
     
    7777    dprintf(("RegisterPe2LxExe: name = %s\n", OSLibGetDllName(hinstance)));
    7878
    79     /* Create Pe2Lx Exe object. */
    80     pWinPe2LxExe = new Win32Pe2LxExe(hinstance, (ulPe2LxVersion & 0x80000000UL) == 0x80000000UL);
    81     if (pWinPe2LxExe == NULL)
    82     {
    83         eprintf(("RegisterPe2LxExe: new returned a NULL-pointer\n"));
    84         return;
    85     }
    86     if (!pWinPe2LxExe->init())
    87     {
    88         eprintf(("RegisterPe2LxExe: init-method failed.\n"));
    89         delete pWinPe2LxExe;
    90         return;
    91     }
     79    /* Might allready be initiated because of early init. */
     80    if (    WinExe != NULL
     81        &&  (   (ulPe2LxVersion & 0x80000000UL) != 0x80000000UL)
     82             || !Win32Pe2LxExe::fEarlyInit)
     83    {
     84        delete WinExe;
     85        WinExe = NULL;
     86    }
     87
     88    if (WinExe == NULL)
     89    {
     90        /* Create Pe2Lx Exe object. */
     91        pWinPe2LxExe = new Win32Pe2LxExe(hinstance, (ulPe2LxVersion & 0x80000000UL) == 0x80000000UL);
     92        if (pWinPe2LxExe == NULL)
     93        {
     94            eprintf(("RegisterPe2LxExe: new returned a NULL-pointer\n"));
     95            return;
     96        }
     97        if (!pWinPe2LxExe->init())
     98        {
     99            eprintf(("RegisterPe2LxExe: init-method failed.\n"));
     100            delete pWinPe2LxExe;
     101            return;
     102        }
     103    }
     104    else
     105        pWinPe2LxExe = (Win32Pe2LxExe*)WinExe;
    92106
    93107    /* Call start (which calls the entry point). */
     
    156170}
    157171
     172
     173
     174/**
     175 * Preinitiate the executable before RegisterPe2LxExe is called.
     176 * This is done by the first Pe2Lx DLL which is loaded.
     177 *
     178 * @returns Success idicator.
     179 * @status
     180 * @author  knut st. osmundsen (kosmunds@csc.no)
     181 * @remark
     182 */
     183BOOL Win32Pe2LxExe::earlyInit()
     184{
     185    /*
     186     * Try make an win32k loaded executable object.
     187     */
     188    Win32Pe2LxExe * pExe = new Win32Pe2LxExe((HINSTANCE)OSLibGetPIB(PIB_TASKHNDL), libWin32kInstalled());
     189    if (pExe)
     190    {
     191        if (pExe->init())
     192        {
     193            WinExe = pExe;
     194            return fEarlyInit = TRUE;
     195        }
     196    }
     197
     198    return FALSE;
     199}
     200
Note: See TracChangeset for help on using the changeset viewer.