Ignore:
Timestamp:
Nov 10, 1999, 2:45:38 AM (26 years ago)
Author:
bird
Message:

Some bugsfixes - Yield is disabled.
Added parameters.
Correcte moduleheaders.
Introduced a new base class for virtual lx modules + some elf sketches.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/pe2lx/pe2lx.cpp

    r1535 r1678  
    1 /* $Id: pe2lx.cpp,v 1.6 1999-10-31 23:57:09 bird Exp $
     1/* $Id: pe2lx.cpp,v 1.7 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * Pe2Lx class implementation. Ring 0 and Ring 3
     
    2121#else /*RING3*/
    2222    #define INCL_DOSFILEMGR                 /* RING3: DOS File api. */
     23    #define INCL_DOSPROCESS                 /* RING3: DosSleep. */
    2324#endif
    2425
     
    124125    #include "ldrCalls.h"                   /* _ldr* calls. (_ldrRead) */
    125126#endif
     127#include "modulebase.h"                     /* ModuleBase class definitions, ++. */
    126128#include "pe2lx.h"                          /* Pe2Lx class definitions, ++. */
    127129#include <versionos2.h>                     /* Pe2Lx version. */
     
    188190{   /* Win32 Module name                   Odin32 Module name*/
    189191    {"NETAPI32",                           "WNETAP32"},
     192    {"OLE32",                              "OLE32OS2"},
    190193    {NULL,                                 NULL} /* end-of-list entry */
    191194};
    192 
    193 
    194 /**
    195  * Current output message detail level; default: Pe2Lx::Info, -W3.
    196  */
    197 ULONG Pe2Lx::ulInfoLevel = Pe2Lx::Info;
    198 
    199195
    200196
     
    244240 */
    245241Pe2Lx::Pe2Lx(SFN hFile) :
    246 #ifdef DEBUG
    247     fInitTime(TRUE),
    248 #endif
    249     hFile(hFile), pszFilename(NULL), pszModuleName(NULL),
     242    ModuleBase(hFile),
    250243    fAllInOneObject(FALSE), paObjects(NULL), cObjects(0), cObjectsAllocated(0),
    251244    paObjTab(NULL), paObjPageTab(NULL),
     
    281274Pe2Lx::~Pe2Lx()
    282275{
    283     if (pszFilename != NULL)
    284     {
    285         free(pszFilename);
    286         pszFilename = NULL;
    287     }
    288     if (pszModuleName != NULL)
    289     {
    290         free(pszModuleName);
    291         pszModuleName = NULL;
    292     }
    293276    if (paObjects != NULL)
    294277    {
     
    398381    PIMAGE_DOS_HEADER       pMzHdr;
    399382    int                     i, j;
    400     PCSZ                    psz;
    401383    PIMAGE_SECTION_HEADER   paSections;     /* Pointer to section headers */
    402384
     
    412394
    413395    /* 0.pszFilename & pszModuleName. */
    414     this->pszFilename = (char*)malloc(strlen(pszFilename) + 1);
    415     if (this->pszFilename == NULL)
    416         return ERROR_NOT_ENOUGH_MEMORY;
    417     strcpy(this->pszFilename, pszFilename);
    418 
    419     if ((psz = strrchr(pszFilename, '\\') + 1) == (PCHAR)1)
    420             if ((psz = strrchr(pszFilename, '/') + 1) == (PCHAR)1)
    421                 psz = pszFilename;
    422     pszModuleName = strchr(psz, '.');
    423     i = pszModuleName != NULL ? pszModuleName - psz : strlen(psz);
    424     pszModuleName = (PSZ)malloc(i + 1);
    425     if (pszModuleName == NULL)
    426         return ERROR_NOT_ENOUGH_MEMORY;
    427     strncpy(pszModuleName, psz, i);
    428     pszModuleName[i] = '\0';
     396    rc = ModuleBase::init(pszFilename);
     397    if (rc != NO_ERROR)
     398        return rc;
    429399
    430400    /* 1.Read the from the start of the file, expect a MZ header. */
     
    11241094
    11251095/**
    1126  * Asks if pszFilename is the name of this module.
    1127  * @returns   TRUE : pszFilename is the name of this module.
    1128  *            FALSE: pszfilename is not this module.
    1129  * @param     pszFilename  Filename. (Probably allways a qualified name in RING0)
    1130  * @sketch    IF filename without path THEN
    1131  *            BEGIN
    1132  *                IF no extention THEN
    1133  *                    compare directly with modulename
    1134  *                ELSE
    1135  *                    compare input filename with the object filename without path.
    1136  *            END
    1137  *            ELSE
    1138  *                compare input filename with the object filename
    1139  *            return TRUE if equal : FALSE if not.
    1140  * @status    partially implemented.
    1141  * @author    knut st. osmundsen
    1142  */
    1143 BOOL Pe2Lx::queryIsModuleName(PCSZ pszFilename)
    1144 {
    1145     if (strchr(pszFilename, '\\') == NULL && strchr(pszFilename,'/') == NULL)
    1146     {   /* use module name - no extention */
    1147         if (strchr(pszFilename, '.') == NULL)
    1148             return stricmp(pszFilename, pszModuleName) == 0;
    1149         else
    1150         {   /* extention */
    1151             PCSZ psz = strchr(this->pszFilename, '\\');
    1152             if ((psz = strchr(this->pszFilename, '/')) == NULL)
    1153                  psz = this->pszFilename;
    1154             else
    1155                 psz++; /* skip '\\' or '/' */
    1156             return stricmp(pszFilename, psz) == 0;
    1157         }
    1158     }
    1159 
    1160     /* TODO: relative name vs fullname. */
    1161     return stricmp(pszFilename, this->pszFilename) == 0;
    1162 }
    1163 
    1164 
    1165 /**
    11661096 * Gets the size of the virtual LX-file.
    11671097 * @returns   Size of the virtual LX-file in bytes.
     
    40663996
    40673997/**
    4068  * Output function for Pe2Lx.
    4069  * @param     pszFormat    Pointer to format string.
    4070  * @status    completely implemented; tested.
    4071  * @author    knut st. osmundsen
    4072  */
    4073 VOID Pe2Lx::printf(PCSZ pszFormat, ...)
    4074 {
    4075     va_list arguments;
    4076 
    4077     if (ulInfoLevel <= Pe2Lx::ulInfoLevel)
    4078     {
    4079         va_start(arguments, pszFormat);
    4080         vprintf(pszFormat, arguments);
    4081         va_end(arguments);
    4082     }
    4083 }
    4084 
    4085 
    4086 /**
    40873998 * Constructor.
    40883999 * @param     hFile      Filehandle.
Note: See TracChangeset for help on using the changeset viewer.