Ignore:
Timestamp:
Oct 14, 1999, 3:25:39 AM (26 years ago)
Author:
bird
Message:

Pe2Lx rewrite changes in win32k.
Pluss some makefile/depend changes.

File:
1 edited

Legend:

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

    r847 r1273  
    1 /* $Id: ldr.cpp,v 1.1 1999-09-06 02:20:00 bird Exp $
     1/* $Id: ldr.cpp,v 1.2 1999-10-14 01:25:38 bird Exp $
    22 *
    33 * ldr.cpp - Loader helper functions a structures.
     
    1818*******************************************************************************/
    1919#include <os2.h>
    20 #include <string.h>
    2120
    2221#include "malloc.h"
    2322#include "new.h"
     23#include <memory.h>
     24#include <stdlib.h>
     25
    2426#include "log.h"
    25 #include "pefile.h"
    26 #include "lx.h"
     27#include <peexe.h>
     28#include <exe386.h>
     29#include "OS2Krnl.h"
     30#include "pe2lx.h"
    2731#include "ldr.h"
    2832
     
    3135*   Global Variables                                                           *
    3236*******************************************************************************/
    33 unsigned char   ahStates[MAX_FILE_HANDLES/4];
    34 UNCERTAIN       ahUncertain[MAX_UNCERTAIN_FILES];
    3537PPENODE         pPE;
     38unsigned char   achHandleStates[MAX_FILE_HANDLES/8];
    3639
    3740
     
    4043*******************************************************************************/
    4144static PPENODE  findNodePtr2(PPENODE pRoot, const char *pszFilename);
    42 static ULONG    freeNode(PPENODE pNode);
    4345static ULONG    depth(PPENODE pNode);
    44 
    45 
    46 /**
    47  * Get a free entry in the ahUncertain table.
    48  * @returns   Index to free entry in the ahUncertain table.
    49  */
    50 ULONG getFreeUncertainEntry(void)
    51 {
    52     ULONG i;
    53 
    54     i = 0;
    55     while (i < MAX_UNCERTAIN_FILES && ahUncertain[i].hFile != 0xFFFF)
    56         i++;
    57 
    58     return i < MAX_UNCERTAIN_FILES ? i : -1;
    59 }
    60 
    61 
    62 /**
    63  * Free uncertain entry.
    64  * Mark entry with hFile in the uncertain table as unused
    65  * @returns   NO_ERROR on success, -1 on error.
    66  * @param     hFile  Filehandle (key) to free.
    67  */
    68 ULONG freeUncertainEntry(SFN hFile)
    69 {
    70     int i;
    71     int rc;
    72 
    73     i = 0;
    74     while (i < MAX_UNCERTAIN_FILES && ahUncertain[i].hFile != hFile)
    75         i++;
    76 
    77     if (i < MAX_UNCERTAIN_FILES && ahUncertain[i].hFile == hFile)
    78     {
    79         ahUncertain[i].hFile = 0xFFFF;
    80         ahUncertain[i].offsetNEHdr = 0;
    81         ahUncertain[i].fMZ = 0;
    82         ahUncertain[i].fPE = 0;
    83         free(ahUncertain[i].pszName);
    84         ahUncertain[i].pszName = NULL;
    85         rc = NO_ERROR;
    86     }
    87     else
    88         rc  = -1;
    89     return rc;
    90 }
    91 
    92 
    93 /**
    94  * Find the uncertain entry for hFile
    95  * @returns   Index into ahUncertain if found. ~0UL on error.
    96  * @param     hFile  Filehandle (key) to find.
    97  */
    98 ULONG findUncertainEntry(SFN hFile)
    99 {
    100     int i = 0;
    101     while (i < MAX_UNCERTAIN_FILES && ahUncertain[i].hFile != hFile)
    102         i++;
    103 
    104     return i < MAX_UNCERTAIN_FILES ? (ULONG)i : ~0UL;
    105 }
    10646
    10747
     
    322262
    323263    /*depth first search thru the whole tree */
    324     if ( pRoot == NULL || pRoot->lxfile.queryIsModuleName(pszFilename))
     264    if (pRoot == NULL || pRoot->pPe2Lx->queryIsModuleName(pszFilename))
    325265        return pRoot;
    326266
     
    344284    pNode = new PENODE;
    345285    if (pNode == NULL)
    346         kprintf(("allocateNode: malloc returned an NULL-pointer\n"));
     286        kprintf(("allocateNode: new returned a NULL-pointer\n"));
    347287
    348288    return pNode;
     
    355295 * @param     pNode  Pointer to node which is to be freed.
    356296 */
    357 static ULONG freeNode(PPENODE pNode)
     297ULONG freeNode(PPENODE pNode)
    358298{
    359299    if (pNode != NULL)
     
    404344
    405345    /* init state table */
    406     for (i = 0; i < MAX_FILE_HANDLES/4; i++)
    407         ahStates[i] = 0;
    408 
    409     /* init uncertain files */
    410     for (i = 0; i < MAX_UNCERTAIN_FILES; i++)
    411     {
    412         ahUncertain[i].hFile = 0xFFFF;
    413         ahUncertain[i].offsetNEHdr = 0;
    414         ahUncertain[i].fMZ = 0;
    415         ahUncertain[i].fPE = 0;
    416         ahUncertain[i].pszName = NULL;
    417     }
     346    memset(&achHandleStates[0], 0, sizeof(achHandleStates));
    418347
    419348    /* init pPEFiles* */
Note: See TracChangeset for help on using the changeset viewer.