Changeset 1678 for trunk/src


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.

Location:
trunk/src/win32k
Files:
5 added
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/Makefile

    r1479 r1678  
    11################################################################################
    2 # $Id: Makefile,v 1.11 1999-10-27 15:14:15 bird Exp $
     2# $Id: Makefile,v 1.12 1999-11-10 01:45:29 bird Exp $
    33#
    44# Copyright 1998-1999 knut st. osmundsen
     5#
     6# Project Odin Software License can be found in LICENSE.TXT
    57#
    68################################################################################
     
    6668# COMPILER/ASSEMBLER INCLUDEPATHS
    6769################################################################################
    68 CINCLUDES  = -I$(WIN32KBASE)\include                \
    69              -I$(TOOLKIT)\h                         \
    70              -I$(VACPATH)\include                   \
    71              -I$(DDKPATH)\h                         \
    72              -I$(DDKPATH)\src\dev\dasd\diskh        \
    73              -I.                                    \
    74              -I$(PDWIN32_INCLUDE)                   \
     70CINCLUDES  = -I$(WIN32KBASE)\include \
     71             -I$(TOOLKIT)\h \
     72             -I$(VACPATH)\include \
     73             -I$(DDKPATH)\h \
     74             -I$(DDKPATH)\src\dev\dasd\diskh \
     75             -I. \
     76             -I$(PDWIN32_INCLUDE) \
    7577             -I$(PDWIN32_INCLUDE)\win
    7678
    77 CINCLUDES16= -I$(WIN32KBASE)\include                \
    78              -I.                                    \
    79              -I$(DDKPATH)\h                         \
    80              -I$(MSCPATH)\include                   \
     79CINCLUDES16= -I$(WIN32KBASE)\include \
     80             -I. \
     81             -I$(DDKPATH)\h \
     82             -I$(MSCPATH)\include \
    8183             -I$(PDWIN32_INCLUDE)
    8284
    8385
    84 AINCLUDES  = -Fdi:$(WIN32KBASE)\include             \
     86AINCLUDES  = -Fdi:$(WIN32KBASE)\include \
    8587             -Fdi:$(DDKPATH)\inc
    8688
     
    149151# OBJECTS and LIBRARIES - Don't mess with the order or objects and libraries!
    150152################################################################################
    151 OBJS  = object\devfirst.obj                 \
    152         object\d16strat.obj                 \
    153         object\d32hlp.obj                   \
    154         object\d32globals.obj               \
    155         object\asmutils.obj                 \
    156         object\calltab.obj                  \
    157         object\malloc.obj                   \
    158         object\new.obj                      \
    159         object\stricmp.obj                  \
    160         object\yield.obj                    \
    161         object\vsprintf.obj                 \
    162         object\vprintf.obj                  \
    163         object\avl.obj                      \
    164         object\ldr.obj                      \
    165         object\myldrClose.obj               \
    166         object\myldrOpen.obj                \
    167         object\myldrRead.obj                \
    168         object\myLDRQAppType.obj            \
    169         object\pe2lx.obj
    170 
    171 # not used
    172 #         object\cout.obj
    173 
    174 OBJSINIT =                                  \
    175         object\d16init.obj                  \
    176         object\d32init.obj                  \
     153OBJS  = object\devfirst.obj \
     154        object\d16strat.obj \
     155        object\d32hlp.obj \
     156        object\d32globals.obj \
     157        object\asmutils.obj \
     158        object\calltab.obj \
     159        object\malloc.obj \
     160        object\new.obj \
     161        object\stricmp.obj \
     162        object\yield.obj \
     163        object\vsprintf.obj \
     164        object\vprintf.obj \
     165        object\avl.obj \
     166        object\ldr.obj \
     167        object\myldrClose.obj \
     168        object\myldrOpen.obj \
     169        object\myldrRead.obj \
     170        object\myLDRQAppType.obj \
     171        object\pe2lx.obj \
     172        object\ModuleBase.obj
     173
     174
     175OBJSINIT = \
     176        object\d16init.obj \
     177        object\d32init.obj \
    177178        object\probkrnl.obj
    178179
    179 LIBS =  \
     180LIBS = \
    180181!if "$(CCENV)" == "VAC36"
    181         $(VACPATH)\lib\cpprni36.lib         \
     182        $(VACPATH)\lib\cpprni36.lib \
    182183!else
    183         $(VACPATH)\lib\cppon30.lib          \
     184        $(VACPATH)\lib\cppon30.lib  \
    184185!endif
    185186        $(DDKPATH)\lib\os2286.lib
  • trunk/src/win32k/configure.cmd

    r909 r1678  
    1 /* $Id: configure.cmd,v 1.2 1999-09-12 00:26:27 bird Exp $
     1/* $Id: configure.cmd,v 1.3 1999-11-10 01:45:29 bird Exp $
    22 *
    33 * Configuration script.
     
    55 *
    66 * Copyright (c) 1999 knut st. osmundsen
     7 *
     8 * Project Odin Software License can be found in LICENSE.TXT
    79 *
    810 */
     
    2325    if (stream(sIncFile, 'c', 'open write' ) <> '') then do
    2426        call lineout sIncFile, '################################################################################'
    25         call lineout sIncFile, '#'
    26         call lineout sIncFile, '# Copyright (c) 1998-1999 knut st. osmundsen'
    27         call lineout sIncFile, '#'
     27        call lineout sIncFile, '# Generated by configure.cmd'
    2828        call lineout sIncFile, '################################################################################';
    2929        call lineout sIncFile, ''
  • trunk/src/win32k/dev16/d16init.c

    r1535 r1678  
    1 /* $Id: d16init.c,v 1.3 1999-10-31 23:57:00 bird Exp $
     1/* $Id: d16init.c,v 1.4 1999-11-10 01:45:30 bird Exp $
    22 *
    33 * d16init - init routines for both drivers.
     
    77 *
    88 * Copyright (c) 1999 knut st. osmundsen
     9 *
     10 * Project Odin Software License can be found in LICENSE.TXT
    911 *
    1012 */
  • trunk/src/win32k/dev16/d16strat.c

    r1467 r1678  
    1 /* $Id: d16strat.c,v 1.2 1999-10-27 02:02:53 bird Exp $
     1/* $Id: d16strat.c,v 1.3 1999-11-10 01:45:30 bird Exp $
    22 *
    33 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr)
     
    55 *
    66 * Copyright (c) 1999 knut st. osmundsen
     7 *
     8 * Project Odin Software License can be found in LICENSE.TXT
    79 *
    810 */
  • trunk/src/win32k/dev16/probkrnl.c

    r1535 r1678  
    1 /* $Id: probkrnl.c,v 1.3 1999-10-31 23:57:01 bird Exp $
     1/* $Id: probkrnl.c,v 1.4 1999-11-10 01:45:30 bird Exp $
    22 *
    33 * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
     
    2222 * Copyright (c) 1998-1999 knut st. osmundsen
    2323 *
     24 * Project Odin Software License can be found in LICENSE.TXT
     25 *
    2426 */
    2527
  • trunk/src/win32k/dev32/d32globals.c

    r1467 r1678  
    1 /* $Id: d32globals.c,v 1.2 1999-10-27 02:02:53 bird Exp $
     1/* $Id: d32globals.c,v 1.3 1999-11-10 01:45:30 bird Exp $
    22 *
    33 * d32globals - global data (32-bit)
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/dev32/d32init.c

    r1535 r1678  
    1 /* $Id: d32init.c,v 1.3 1999-10-31 23:57:02 bird Exp $
     1/* $Id: d32init.c,v 1.4 1999-11-10 01:45:30 bird Exp $
    22 *
    33 * d32init.c - 32-bits init routines.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    4042*   Internal Functions                                                         *
    4143*******************************************************************************/
    42 static int  interpretFunctionProlog(char *p);
    43 static int  procInit(void);
     44static ULONG    readnum(const char *pszNum);
     45static int      interpretFunctionProlog(char *p);
     46static int      procInit(void);
    4447
    4548
     
    7073USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit)
    7174{
    72     char *pszTmp2;
    73     char *pszTmp;
     75    char   *pszTmp2;
     76    char   *pszTmp;
     77    ULONG   ul;
    7478
    7579    pulTKSSBase32 = (PULONG)_TKSSBase16;
     
    114118                break;
    115119
     120            case 'h':
     121            case 'H': /* Heap options */
     122                pszTmp2 = strpbrk(pszTmp, ":=/- ");
     123                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     124                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
     125                {
     126                    ul = readnum(pszTmp2 + 1);
     127                    if (ul > 0x1000UL && ul < 0x2000000UL) /* 4KB < ul < 32MB */
     128                    {
     129                        if (strnicmp(pszTmp, "heapm", 5) == 0)
     130                            options.cbHeapMax = ul;
     131                        else
     132                            options.cbHeap = ul;
     133                    }
     134                }
     135                break;
     136
    116137            case 'l':
    117138            case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */
     
    133154            case 'P': /* PE */
    134155                pszTmp2 = strpbrk(pszTmp, ":=/- ");
    135                 if (pszTmp2 != NULL && (*pszTmp == ':' || *pszTmp == '='))
     156                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     157                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
    136158                {
    137159                    pszTmp++;
     
    156178                break;
    157179
     180            case 'r':
     181            case 'R': /* ResHeap options */
     182                pszTmp2 = strpbrk(pszTmp, ":=/- ");
     183                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     184                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
     185                {
     186                    ul = readnum(pszTmp2 + 1);
     187                    if (ul > 0x1000UL && ul < 0x700000UL) /* 4KB < ul < 7MB */
     188                    {
     189                        if (strnicmp(pszTmp, "resheapm", 8) == 0)
     190                            options.cbHeapMaxResident = ul;
     191                        else
     192                            options.cbHeapResident = ul;
     193                    }
     194                }
     195                break;
     196
    158197            case 's':
    159             case 'S': /* SMP kernel */
    160                 options.fKernel = KF_SMP;
     198            case 'S': /* Sym:<filename> or Script:<Yes|No> or Smp */
     199                /* SMP kernel */
     200                if (pszTmp[1] == 'm' || pszTmp[1] == 'M')
     201                    options.fKernel = KF_SMP;
     202                else
     203                {
     204                    if (pszTmp[1] == 'c' || pszTmp[1] == 'C')
     205                    {
     206                        pszTmp2 = strpbrk(pszTmp, ":=/- ");
     207                        options.fScript = pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     208                            && (*pszTmp2 == ':' || *pszTmp2 == '=')
     209                            && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y');
     210                    }
     211                }
     212                break;
     213
     214            case 'u':
     215            case 'U': /* UNI kernel */
     216                options.fKernel = KF_UNI;
    161217                break;
    162218
     
    166222                break;
    167223
    168             case 'u':
    169             case 'U': /* UNI kernel */
    170                 options.fKernel = KF_SMP;
    171                 break;
     224            case 'w':
     225            case 'W':
     226                if (pszTmp[1] >= '0' && pszTmp[1] <= '4')
     227                    options.ulInfoLevel = pszTmp[1] - '0';
     228                else
     229                {
     230                    pszTmp2 = strpbrk(pszTmp, ":=/- ");
     231                    if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     232                        && (*pszTmp2 == ':' || *pszTmp2 == '=')
     233                        && pszTmp2[1] >= '0' && pszTmp2[1] <= '4'
     234                        )
     235                        options.ulInfoLevel = pszTmp2[1] - '0';
     236                }
     237                break;
     238
    172239        }
    173240        pszTmp = strpbrk(pszTmp, "-/");
    174241    }
     242
     243    /* heap min/max corrections */
     244    if (options.cbHeap > options.cbHeapMax)
     245        options.cbHeapMax = options.cbHeap;
     246    if (options.cbHeapResident > options.cbHeapMaxResident)
     247        options.cbHeapMaxResident = options.cbHeapResident;
    175248
    176249    /* Transfer version and build number from 16-bit probkrnl.c */
     
    179252    options.usVerMinor = _usVerMinor;
    180253
    181     /* log option summary */
     254    /* log option summary - FIXME */
    182255    kprintf(("Options - Summary\n"));
    183256    kprintf(("\tKernel: ver%d.%d  build %d  type %s\n",
     
    217290
    218291    return STATUS_DONE;
     292}
     293
     294
     295/**
     296 * Reads a number (unsigned long integer) for a string.
     297 * @returns   number read, ~0UL on error / no number read.
     298 * @param     pszNum  Pointer to the string containing the number.
     299 * @status    competely implemented.
     300 * @author    knut st. osmundsen
     301 */
     302static ULONG    readnum(const char *pszNum)
     303{
     304    ULONG ulRet = 0;
     305    ULONG ulBase = 10;
     306    int   i = 0;
     307
     308    if (*pszNum == '0')
     309        if (pszNum[1] == 'x' || pszNum[1] == 'X')
     310        {
     311            ulBase == 16;
     312            pszNum += 2;
     313        }
     314        else
     315        {
     316            ulBase == 8;
     317            i = 1;
     318        }
     319
     320    /* read digits */
     321    while (ulBase == 16 ? (pszNum[i] >= '0' && pszNum[i] <= '9') || (pszNum[i] >= 'a' && pszNum[i] <= 'f') || (pszNum[i] >= 'A' && pszNum[i] <= 'F')
     322           : (pszNum[i] >= '0' && pszNum[i] <= (ulBase == 10 ? '9' : '7'))
     323           )
     324    {
     325        ulRet *= ulBase;
     326        if (ulBase <= 10)
     327            ulRet += pszNum[i] - '0';
     328        else
     329            ulRet += pszNum[i] - (pszNum[i] >= 'A' ? 'A' - 10 : (pszNum[i] >= 'a' ? 'a' + 9 : '0'));
     330
     331        i++;
     332    }
     333
     334    return i > 0 ? ulRet : ~0UL;
    219335}
    220336
  • trunk/src/win32k/fastdep.c

    r1329 r1678  
    1 /*
     1/* $Id: fastdep.c,v 1.6 1999-11-10 01:45:29 bird Exp $
     2 *
    23 * Fast dependants. (Fast = Quick and Dirty!)
    34 *
    45 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    58 *
    69 */
  • trunk/src/win32k/include/LdrCalls.h

    r847 r1678  
    1 /* $Id: LdrCalls.h,v 1.1 1999-09-06 02:19:58 bird Exp $
     1/* $Id: LdrCalls.h,v 1.2 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * Prototypes for the loader overrided function.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/OS2Krnl.h

    r1467 r1678  
    1 /* $Id: OS2Krnl.h,v 1.2 1999-10-27 02:02:55 bird Exp $
     1/* $Id: OS2Krnl.h,v 1.3 1999-11-10 01:45:31 bird Exp $
    22 *
    33 * OS/2 kernel structures, typedefs and macros.
     4 *
     5 * Project Odin Software License can be found in LICENSE.TXT
    46 *
    57 */
  • trunk/src/win32k/include/asmutils.h

    r1467 r1678  
    1 /* $Id: asmutils.h,v 1.2 1999-10-27 02:02:55 bird Exp $
     1/* $Id: asmutils.h,v 1.3 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * Assembly utilities.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/cout.h

    r1467 r1678  
    1 /* $Id: cout.h,v 1.2 1999-10-27 02:02:55 bird Exp $
     1/* $Id: cout.h,v 1.3 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * cout - cout replacement.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/dev16.h

    r1467 r1678  
    1 /* $Id: dev16.h,v 1.2 1999-10-27 02:02:56 bird Exp $
     1/* $Id: dev16.h,v 1.3 1999-11-10 01:45:32 bird Exp $
    22 * dev16 - 16-bit specific. Should not be used in 32-bit C/C++.
    33 *
    44 * Copyright (c) 1999 knut st. osmundsen
     5 *
     6 * Project Odin Software License can be found in LICENSE.TXT
    57 *
    68 */
  • trunk/src/win32k/include/dev32.h

    r1467 r1678  
    1 /* $Id: dev32.h,v 1.3 1999-10-27 02:02:56 bird Exp $
     1/* $Id: dev32.h,v 1.4 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * dev32 - header file for 32-bit part of the driver.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/dev32hlp.h

    r1535 r1678  
    1 /* $Id: dev32hlp.h,v 1.2 1999-10-31 23:57:03 bird Exp $
     1/* $Id: dev32hlp.h,v 1.3 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * Dev32Hlp - 32-bit Device helpers.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/devSegDf.inc

    r1467 r1678  
    1 ; $Id: devSegDf.inc,v 1.2 1999-10-27 02:02:56 bird Exp $
     1; $Id: devSegDf.inc,v 1.3 1999-11-10 01:45:32 bird Exp $
    22;
    33; Segment definitions for win32k.sys.
    44;
    55; Copyright (c) 1998-1999 knut st. osmundsen
     6;
     7; Project Odin Software License can be found in LICENSE.TXT
    68;
    79
  • trunk/src/win32k/include/elf.h

    r1270 r1678  
    1 /* $Id: elf.h,v 1.1 1999-10-14 01:17:55 bird Exp $
     1/* $Id: elf.h,v 1.2 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * ELF stuff.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/ldr.h

    r1467 r1678  
    1 /* $Id: ldr.h,v 1.3 1999-10-27 02:02:56 bird Exp $
     1/* $Id: ldr.h,v 1.4 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * ldr - loader header file.
    44 *
    55 * Copyright (c)  1999 knut  St.  osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    4547            union
    4648            {
     49                ModuleBase *pModule;    /* Pointer to a Pe2Lx object. (Win32 executables) */
     50                #if defined(_PE2LX_H_)
    4751                Pe2Lx *     pPe2Lx;     /* Pointer to a Pe2Lx object. (Win32 executables) */
    48                 #if 0
     52                #endif
     53                #if defined(_ELF2LX_H_)
    4954                Elf2Lx *    pElf2Lx;    /* Pointer to a Elf2Lx object. (ELF executables) */
     55                #endif
     56                #if defined(_SCRIPT_H_)
    5057                Script *    pScript;    /* Pointer to a Script object. (Shell scripts) */
     58                #endif
     59                #if defined(_PE_H_)
    5160                Pe *        pPe;        /* Pointer to a Pe object. (Ring3 loader) */
    5261                #endif
    53                 void *      pv;
    5462            } Data;                     /* Pointer to data. Currently it's allways a Pe2Lx object! */
    5563        } MODULE, *PMODULE;
     
    7078        PMODULE     getModuleByFilename(PCSZ pszFilename);
    7179
    72         ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, void *pData);
     80        ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj);
    7381        ULONG       removeModule(SFN hFile);
    7482
  • trunk/src/win32k/include/malloc.h

    r1535 r1678  
    1 /* $Id: malloc.h,v 1.4 1999-10-31 23:57:04 bird Exp $
     1/* $Id: malloc.h,v 1.5 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * Heap.
     
    77 *
    88 * Copyright (c) 1999 knut st. osmundsen
     9 *
     10 * Project Odin Software License can be found in LICENSE.TXT
    911 *
    1012 */
  • trunk/src/win32k/include/new.h

    r1269 r1678  
    1 /* $Id: new.h,v 1.2 1999-10-14 01:16:50 bird Exp $
     1/* $Id: new.h,v 1.3 1999-11-10 01:45:32 bird Exp $
    22 *
    33 * new - new and delete operators.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/omf.h

    r847 r1678  
    1 /* $Id: omf.h,v 1.1 1999-09-06 02:19:59 bird Exp $ */
     1/* $Id: omf.h,v 1.2 1999-11-10 01:45:33 bird Exp $ */
    22/*
    33 * OMF stuff
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/options.h

    r1535 r1678  
    1 /* $Id: options.h,v 1.3 1999-10-31 23:57:04 bird Exp $
     1/* $Id: options.h,v 1.4 1999-11-10 01:45:33 bird Exp $
    22 *
    33 * Options.
     
    4646            o.fScript     = FALSE;          \
    4747            o.fNoLoader   = FALSE;          \
    48             o.cbHeap      = 0x100000; /* 1MB */
     48            o.cbHeap      = 0x100000; /* 1MB */ \
     49            o.cbHeapMax   = 0x100000; /* 1MB */ \
     50            o.cbHeapResident    = 0x10000; /* 64KB */ \
     51            o.cbHeapMaxResident = 0x1000;  /* 4KB */ \
    4952
    5053
     
    8386    /** @cat Options affecting the heap. */
    8487    ULONG       cbHeap;             /* Initial heapsize. */
    85     #if 0
    8688    ULONG       cbHeapMax;          /* Maximum heapsize. */
    8789    ULONG       cbHeapResident;     /* Initial residentheapsize. */
    8890    ULONG       cbHeapMaxResident;  /* Maxiumem residentheapsize. */
    89     #endif
    9091};
    9192
  • trunk/src/win32k/include/pe2lx.h

    r1467 r1678  
    1 /* $Id: pe2lx.h,v 1.5 1999-10-27 02:02:57 bird Exp $
     1/* $Id: pe2lx.h,v 1.6 1999-11-10 01:45:33 bird Exp $
    22 *
    33 * Pe2Lx class declarations. Ring 0 and Ring 3
     
    1818*******************************************************************************/
    1919/*
    20  * Misc
    21  */
    22 #define PAGESIZE                    0x1000
    23 
    24 /*
    2520 * BufferedRVAReader config
    2621 */
    2722#define BUFFEREDRVAREADER_BUFFERSIZE PAGESIZE   /* reader code assumes this size... */
    28 
    29 
    30 /*
    31  * Error definitions (used in addition to them in bseerr.h)
    32  */
    33 #define ERROR_FAILED_TO_ADD_OBJECT          0x42000000UL
    34 #define ERROR_INITMETHOD_NOT_INITTIME       0x42000001UL
    35 #define ERROR_INTERNAL_PROCESSING_ERROR     0x42000002UL
    36 
    37 
    38 /*
    39  * Output macros.
    40  * Macros:          option   infolevel
    41  *      printIPE    -W1      Error
    42  *      printErr    -W1      Error
    43  *      printWar    -W2      Warning
    44  *      printInf    -W3      Info
    45  *      printInfA   -W4      InfoAll
    46  */
    47 #define printIPE(a) (Pe2Lx::ulInfoLevel >= Pe2Lx::Error ? \
    48                      Pe2Lx::printf("\nerror(%d:"__FUNCTION__"): !Internal Processing Error!\n\t", __LINE__), \
    49                      Pe2Lx::printf a,  \
    50                      Pe2Lx::printf("\n")  \
    51                      : (void)0,(void)0,(void)0 )
    52 #define printErr(a) (Pe2Lx::ulInfoLevel >= Pe2Lx::Error ? \
    53                      Pe2Lx::printf("error(%d:"__FUNCTION__"): ", __LINE__), \
    54                      Pe2Lx::printf a  \
    55                      : (void)0,(void)0 )
    56 #define printWar(a) (Pe2Lx::ulInfoLevel >= Pe2Lx::Warning ? \
    57                      Pe2Lx::printf("warning("__FUNCTION__"): "), \
    58                      Pe2Lx::printf a  \
    59                      : (void)0,(void)0 )
    60 #define printInf(a) (Pe2Lx::ulInfoLevel >= Pe2Lx::Info ? \
    61                      Pe2Lx::printf a : (void)0 )
    62 #define printInfA(a)(Pe2Lx::ulInfoLevel >= Pe2Lx::InfoAll ? \
    63                      Pe2Lx::printf a : (void)0 )
    6423
    6524
     
    9756 * @approval    knut st. osmundsen
    9857 */
    99 class Pe2Lx
     58class Pe2Lx : public ModuleBase
    10059{
    10160public:
     
    11271
    11372    /** @cat public Helper methods */
    114     BOOL   queryIsModuleName(PCSZ pszFilename);
    11573    ULONG  querySizeOfLxFile();
    11674    VOID   dumpVirtualLxFile();
    117 
    11875
    11976private:
     
    165122    static VOID dumpSectionHeader(PIMAGE_SECTION_HEADER pSection);
    166123
    167     /** @cat static print method */
    168 public:
    169     static VOID printf(PCSZ pszFormat, ...);
    170 
    171124private:
    172125    /** @cat private data members - allways present.  */
    173     #ifdef DEBUG
    174     BOOL        fInitTime;              /* init time indicator (debug) */
    175     #endif
    176     SFN         hFile;                  /* filehandle */
    177     PSZ         pszFilename;            /* fullpath */
    178     PSZ         pszModuleName;          /* filename without extention. */
    179126    BOOL        fAllInOneObject;        /* The All-in-object fix will be or is applied. */
    180127    PLXOBJECT   paObjects;              /* Pointer to object array. */
     
    241188        ULONG flFlags;                      /* equivalent object flags */
    242189    } paSecChars2Flags[];
    243 
    244 public:
    245     static ULONG ulInfoLevel;                    /* Current output message detail level. */
    246     enum {Quiet, Error, Warning, Info, InfoAll}; /* Output message detail levels. */
    247190};
    248191
  • trunk/src/win32k/include/probkrnl.h

    r1467 r1678  
    1 /* $Id: probkrnl.h,v 1.2 1999-10-27 02:02:57 bird Exp $
     1/* $Id: probkrnl.h,v 1.3 1999-11-10 01:45:33 bird Exp $
    22 *
    33 * Include file for ProbKrnl.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/sprintf.h

    r847 r1678  
    1 /* $Id: sprintf.h,v 1.1 1999-09-06 02:19:59 bird Exp $
     1/* $Id: sprintf.h,v 1.2 1999-11-10 01:45:33 bird Exp $
    22 *
    33 * sprintf/vsprintf header file.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/sym.h

    r847 r1678  
    1 /* $Id: sym.h,v 1.1 1999-09-06 02:19:59 bird Exp $
     1/* $Id: sym.h,v 1.2 1999-11-10 01:45:34 bird Exp $
    22 *
    33 * Sym-file definitions and structs.
     4 *
     5 * Project Odin Software License can be found in LICENSE.TXT
    46 *
    57 */
  • trunk/src/win32k/include/types.h

    r847 r1678  
    1 /* $Id: types.h,v 1.1 1999-09-06 02:20:00 bird Exp $
     1/* $Id: types.h,v 1.2 1999-11-10 01:45:34 bird Exp $
    22 *
    33 * Common typedeclarations.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/include/vprintf.h

    r1270 r1678  
    1 /* $Id: vprintf.h,v 1.1 1999-10-14 01:17:56 bird Exp $
     1/* $Id: vprintf.h,v 1.2 1999-11-10 01:45:34 bird Exp $
    22 *
    33 * printf/vprintf header file.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2426int printf(const char *pszFormat, ...);
    2527int vprintf(const char *pszFormat, va_list args);
     28int vprintf2(const char *pszFormat, va_list args);
    2629
    2730/*
  • trunk/src/win32k/include/yield.h

    r1535 r1678  
    1 /* $Id: yield.h,v 1.2 1999-10-31 23:57:05 bird Exp $
     1/* $Id: yield.h,v 1.3 1999-11-10 01:45:34 bird Exp $
    22 *
    33 * Yield - conversion may take some time. So it is necessary to
     
    55 *
    66 * Copyright (c) 1998-1999 knut st. osmundsen
     7 *
     8 * Project Odin Software License can be found in LICENSE.TXT
    79 *
    810 */
     
    1820    BOOL Yield(void);
    1921#else
    20     #define Yield() FALSE
     22    #define Yield() (DosSleep(0) == NO_ERROR)
    2123#endif
    2224
  • trunk/src/win32k/ldr/ldr.cpp

    r1535 r1678  
    1 /* $Id: ldr.cpp,v 1.5 1999-10-31 23:57:05 bird Exp $
     1/* $Id: ldr.cpp,v 1.6 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * ldr.cpp - Loader helpers.
    44 *
    55 * Copyright (c)  1999 knut  St.  osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2931#include <exe386.h>
    3032#include "OS2Krnl.h"
     33#include "ModuleBase.h"
    3134#include "pe2lx.h"
    3235#include "avl.h"
     
    125128 * @param     pMTE    Pointer to MTE. NULL is valid.
    126129 * @param     fFlags  Type flags for the fFlags field in the node.
    127  * @param     pvData  Pointer to data.
     130 * @param     pModObj Pointer to module object.
    128131 * @sketch    DEBUG: check that the module doesn't exists and parameter check.
    129132 *            (try) Allocate a new node. (return errorcode on failure)
     
    135138 * @author    knut st. osmundsen
    136139 */
    137 ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, void *pvData)
     140ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj)
    138141{
    139142    PMODULE pMod;
     
    166169    pMod->pMTE = pMTE;
    167170    pMod->fFlags = fFlags;
    168     pMod->Data.pv = pvData;
     171    pMod->Data.pModule = pModObj;
    169172
    170173    /* insert the module node into the tree(s) */
     
    248251    pMTERoot = NULL;
    249252
    250     /* Pe2Lx logging. */
    251     Pe2Lx::ulInfoLevel = options.ulInfoLevel;
     253    /* ModuleBase logging. */
     254    ModuleBase::ulInfoLevel = options.ulInfoLevel;
    252255
    253256    return rc;
  • trunk/src/win32k/ldr/myLDRQAppType.cpp

    r847 r1678  
    1 /* $Id: myLDRQAppType.cpp,v 1.1 1999-09-06 02:20:01 bird Exp $
     1/* $Id: myLDRQAppType.cpp,v 1.2 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * _myLDRQAppType - _LDRQAppType overload.
    44 *
    55 * Copyright (c) 1998-1999 knut  St.  osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/ldr/myldrClose.cpp

    r1467 r1678  
    1 /* $Id: myldrClose.cpp,v 1.3 1999-10-27 02:02:58 bird Exp $
     1/* $Id: myldrClose.cpp,v 1.4 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * myldrClose - _ldrClose
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2527#include <exe386.h>
    2628#include "OS2Krnl.h"
    27 #include "pe2lx.h"
    2829#include "avl.h"
     30#include "ModuleBase.h"
    2931#include "ldr.h"
    3032#include "ldrCalls.h"
     
    4547    if (GetState(hFile) == HSTATE_OUR)
    4648    {
     49        #ifdef DEBUG
     50        PMODULE pMod = getModuleBySFN(hFile);
     51        if (pMod != NULL)
     52            pMod->Data.pModule->dumpVirtualLxFile();
     53        else
     54            kprintf(("_ldrClose: getModuleBySFN failed!!!"));
     55        #endif
     56
    4757        rc = removeModule(hFile);
    4858        if (rc != NO_ERROR)
  • trunk/src/win32k/ldr/myldrOpen.cpp

    r1535 r1678  
    1 /* $Id: myldrOpen.cpp,v 1.4 1999-10-31 23:57:06 bird Exp $
     1/* $Id: myldrOpen.cpp,v 1.5 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * myldrOpen - _ldrOpen.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2729#include <exe386.h>
    2830#include "OS2Krnl.h"
     31#include "ModuleBase.h"
    2932#include "pe2lx.h"
    3033#include "elf.h"
     
    128131                }
    129132                else
    130                     if (*pach == '#')
     133                    if (*pach == '#' && pach[1] == '!')
    131134                    {
    132135                        /* unix styled script...? Must be more than 64 bytes long? No options. firstline < 64 bytes. */
    133                         char *pszStart = pach+1;
     136                        char *pszStart = pach+2;
    134137                        char *pszEnd;
    135138                        kprintf(("_ldrOpen: unix script?\n"));
     
    142145                        if (*pszStart != '\0' && *pszStart != '\r' && *pszStart != '\n')
    143146                        {   /* find end-of-word */
     147                            pszEnd = pszStart + 1;
    144148                            while (*pszEnd != '\0' && *pszEnd != '\n' && *pszEnd != '\r'
    145149                                   && *pszEnd != '\t' && *pszEnd != ' ')
    146150                                pszEnd++;
    147                             *pszEnd = '\0';
    148151                            if (*pszEnd != '\0')
    149152                            {
     153                                *pszEnd = '\0';
    150154                                kprintf(("_ldrOpen: unix script - opening %s\n", pszStart));
    151155                                _ldrClose(*phFile);
  • trunk/src/win32k/ldr/myldrRead.cpp

    r1467 r1678  
    1 /* $Id: myldrRead.cpp,v 1.4 1999-10-27 02:02:58 bird Exp $
     1/* $Id: myldrRead.cpp,v 1.5 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * myldrRead - _ldrRead.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2628#include <exe386.h>
    2729#include "OS2Krnl.h"
     30#include "ModuleBase.h"
    2831#include "pe2lx.h"
    2932#include "avl.h"
     
    6164
    6265            if ((pMod->fFlags & MOD_TYPE_MASK) == MOD_TYPE_PE2LX)
    63                 rc = pMod->Data.pPe2Lx->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE);
     66                rc = pMod->Data.pModule->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE);
    6467            else
    6568            {
  • trunk/src/win32k/libconv.c

    r886 r1678  
    1 /* $Id: libconv.c,v 1.1 1999-09-08 20:50:02 bird Exp $ */
    2 /*
     1/* $Id: libconv.c,v 1.2 1999-11-10 01:45:29 bird Exp $
     2 *
    33 * Very simple OMF/LIB dumper.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/misc/malloc.c

    r1536 r1678  
    1 /* $Id: malloc.c,v 1.4 1999-11-01 09:28:58 bird Exp $
     1/* $Id: malloc.c,v 1.5 1999-11-10 01:45:36 bird Exp $
    22 *
    33 * Heap.
     
    77 *
    88 * Copyright (c) 1999 knut st. osmundsen
     9 *
     10 * Project Odin Software License can be found in LICENSE.TXT
    911 *
    1012 */
  • trunk/src/win32k/misc/new.cpp

    r1271 r1678  
    1 /* $Id: new.cpp,v 1.2 1999-10-14 01:19:21 bird Exp $
     1/* $Id: new.cpp,v 1.3 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * new - new and delete operators.
    44 *
    55 * Copyright (c) 1998-1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/misc/stricmp.c

    r1271 r1678  
    1 /* $Id: stricmp.c,v 1.2 1999-10-14 01:19:21 bird Exp $
     1/* $Id: stricmp.c,v 1.3 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * stricmp - Case insensitive string compare.
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/misc/vprintf.c

    r1536 r1678  
    1 /* $Id: vprintf.c,v 1.4 1999-11-01 09:28:59 bird Exp $
     1/* $Id: vprintf.c,v 1.5 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * vprintf and printf
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2224#define NTSF_BLANK      0x0040
    2325
    24 #define INCL_NOAPI
     26
     27#ifdef RING0
     28    #define INCL_NOAPI
     29#else
     30    #define INCL_DOSPROCESS
     31    #define INCL_DOSERRORS
     32#endif
    2533
    2634/*******************************************************************************
     
    205213
    206214
    207 #pragma info(notrd)
    208215/**
    209216 * Partial vprintf implementation.
     217 * This function checks the fLogging flag, and will therefore only write if logging is enabled.
    210218 * @returns   number of
    211  * @param     pszBuffer   Output buffer.
    212219 * @param     pszFormat   Format string.
    213220 * @param     args        Argument list.
     
    215222int vprintf(const char *pszFormat, va_list args)
    216223{
    217     #ifdef RING0
    218         if (!options.fLogging)
    219             return 0;
    220     #else
     224    if (!options.fLogging)
     225        return 0;
     226    return vprintf2(pszFormat, args);
     227}
     228
     229#pragma info(notrd)
     230/**
     231 * Partial vprintf implementation.
     232 * This function don't check the fLogging flag, and will therefore allways write.
     233 * @returns   number of
     234 * @param     pszFormat   Format string.
     235 * @param     args        Argument list.
     236 */
     237int vprintf2(const char *pszFormat, va_list args)
     238{
     239    #ifndef RING0
    221240        int cch = 0;
    222241    #endif
     
    413432    va_list arguments;
    414433
    415     #ifdef RING0
    416         if (!options.fLogging)
    417             return 0;
    418     #endif
    419 
    420434    va_start(arguments, pszFormat);
    421435    cch = vprintf(pszFormat, arguments);
     
    432446    va_list arguments;
    433447
    434     #ifdef RING0
    435         if (!options.fLogging)
    436             return 0;
    437     #endif
    438 
    439448    va_start(arguments, pszFormat);
    440449    cch = vprintf(pszFormat, arguments);
     
    449458    int     cch;
    450459    va_list arguments;
    451 
    452     #ifdef RING0
    453         if (!options.fLogging)
    454             return 0;
    455     #endif
    456460
    457461    va_start(arguments, pszFormat);
  • trunk/src/win32k/misc/vsprintf.c

    r1467 r1678  
    1 /* $Id: vsprintf.c,v 1.3 1999-10-27 02:03:00 bird Exp $
     1/* $Id: vsprintf.c,v 1.4 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * vsprintf and sprintf
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
  • trunk/src/win32k/misc/yield.c

    r1535 r1678  
    1 /* $Id: yield.c,v 1.3 1999-10-31 23:57:08 bird Exp $
     1/* $Id: yield.c,v 1.4 1999-11-10 01:45:37 bird Exp $
    22 *
    33 * Yield - conversion may take some time. So it is necessary to
     
    55 *
    66 * Copyright (c) 1998-1999 knut st. osmundsen
     7 *
     8 * Project Odin Software License can be found in LICENSE.TXT
    79 *
    810 */
     
    2931BOOL Yield(void)
    3032{
     33    #if 0 /* Don't work on SMP and may cause trouble with logging at all machines... */
    3134    PBYTE  pfbYield;
    3235
     
    3740        return TRUE;
    3841    }
    39 
     42    #endif
    4043    return FALSE;
    4144}
  • trunk/src/win32k/pe2lx/makefile

    r1467 r1678  
    11##############################################################################
    2 # $Id: makefile,v 1.5 1999-10-27 02:03:01 bird Exp $
     2# $Id: makefile,v 1.6 1999-11-10 01:45:37 bird Exp $
    33#
    44# PD-Win32 API
     
    1818WIN32K_INCLUDE  = $(WIN32KBASE)\include
    1919WIN32K_MISC     = $(WIN32KBASE)\misc
     20WIN32K_LDR      = $(WIN32KBASE)\ldr
    2021OBJEXT = pe_obj
    2122
     
    5556    @$(CXX) $(CXXFLAGS) -c -Fa$(PE2LXLIST)\$(@B).asm -Fo$@ $<
    5657
     58{$(WIN32K_LDR)}.cpp{$(PE2LXOBJ)}.$(OBJEXT):
     59    @echo compiling: $(@B).cpp
     60    @$(CXX) $(CXXFLAGS) -c -Fa$(PE2LXLIST)\$(@B).asm -Fo$@ $<
     61
    5762.cpp{$(PE2LXOBJ)}.$(OBJEXT):
    5863    @echo compiling: $(@B).cpp
     
    7176    @$(CXX) $(CXXFLAGS) -c -Fa$(PE2LXLIST)\$(@B).asm -Fo$(PE2LXOBJ)\$(@B).$(OBJEXT) $<
    7277
     78{$(WIN32K_LDR)}.cpp.obj:
     79    @echo compiling: $(@B).cpp
     80    @$(CXX) $(CXXFLAGS) -c -Fa$(PE2LXLIST)\$(@B).asm -Fo$(PE2LXOBJ)\$(@B).$(OBJEXT) $<
     81
    7382.cpp.obj:
    7483    @echo compiling: $(@B).cpp
     
    8190TARGET   = pe2lx
    8291
    83 OBJS     =  $(PE2LXOBJ)\pe2lx.$(OBJEXT)         \
    84             $(PE2LXOBJ)\pe2lxmain.$(OBJEXT)     \
    85             $(PE2LXOBJ)\malloc.$(OBJEXT)        \
    86             $(PE2LXOBJ)\new.$(OBJEXT)           \
    87             $(PE2LXOBJ)\stricmp.$(OBJEXT)       \
     92OBJS     =  $(PE2LXOBJ)\pe2lx.$(OBJEXT)      \
     93            $(PE2LXOBJ)\pe2lxmain.$(OBJEXT)  \
     94            $(PE2LXOBJ)\modulebase.$(OBJEXT) \
     95            $(PE2LXOBJ)\malloc.$(OBJEXT)     \
     96            $(PE2LXOBJ)\new.$(OBJEXT)        \
     97            $(PE2LXOBJ)\stricmp.$(OBJEXT)    \
    8898            $(PE2LXOBJ)\vprintf.$(OBJEXT)
    89 #            $(PE2LXOBJ)\vsprintf.$(OBJEXT)
    9099
    91100
     
    121130    $(WIN32K_INCLUDE)\OS2Krnl.h
    122131
     132$(PE2LXOBJ)\ModuleBase.$(OBJEXT): \
     133    $(WIN32K_LDR)\ModuleBase.cpp \
     134    $(WIN32K_INCLUDE)\malloc.h \
     135    $(WIN32K_INCLUDE)\vprintf.h \
     136    $(WIN32K_INCLUDE)\dev32.h \
     137    $(WIN32K_INCLUDE)\OS2Krnl.h \
     138    $(WIN32K_INCLUDE)\modulebase.h
     139
    123140$(PE2LXOBJ)\malloc.$(OBJEXT): \
    124141    $(WIN32K_MISC)\malloc.c \
     
    139156    $(WIN32K_MISC)\stricmp.c
    140157
     158
  • 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.
  • trunk/src/win32k/pe2lx/pe2lxmain.cpp

    r1467 r1678  
    1 /* $Id: pe2lxmain.cpp,v 1.3 1999-10-27 02:03:01 bird Exp $
     1/* $Id: pe2lxmain.cpp,v 1.4 1999-11-10 01:45:38 bird Exp $
    22 *
    33 * Pe2Lx main program. (Ring 3 only!)
    44 *
    55 * Copyright (c) 1999 knut st. osmundsen
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
    68 *
    79 */
     
    2830#include <stdlib.h>
    2931#include "OS2Krnl.h"
     32#include "modulebase.h"
    3033#include "pe2lx.h"
    3134#include <stdio.h>
     
    9295                        switch (*psz)
    9396                        {
    94                             case '0': Pe2Lx::ulInfoLevel = Pe2Lx::Quiet; break;
    95                             case '1': Pe2Lx::ulInfoLevel = Pe2Lx::Error; break;
    96                             case '2': Pe2Lx::ulInfoLevel = Pe2Lx::Warning; break;
    97                             case '3': Pe2Lx::ulInfoLevel = Pe2Lx::Info; break;
    98                             case '4': Pe2Lx::ulInfoLevel = Pe2Lx::InfoAll; break;
     97                            case '0': ModuleBase::ulInfoLevel = ModuleBase::Quiet; break;
     98                            case '1': ModuleBase::ulInfoLevel = ModuleBase::Error; break;
     99                            case '2': ModuleBase::ulInfoLevel = ModuleBase::Warning; break;
     100                            case '3': ModuleBase::ulInfoLevel = ModuleBase::Info; break;
     101                            case '4': ModuleBase::ulInfoLevel = ModuleBase::InfoAll; break;
    99102                        }
    100103                    }
  • trunk/src/win32k/win32k.def

    r1467 r1678  
    22; Copyright 1998 knut st. osmundsen
    33; Definition file for Win32k
     4; Project Odin Software License can be found in LICENSE.TXT
    45;******************************************************************************
    56PHYSICAL DEVICE WIN32K
Note: See TracChangeset for help on using the changeset viewer.