Changeset 1273 for trunk/src/win32k/ldr/ldr.cpp
- Timestamp:
- Oct 14, 1999, 3:25:39 AM (26 years ago)
- 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:00bird Exp $1 /* $Id: ldr.cpp,v 1.2 1999-10-14 01:25:38 bird Exp $ 2 2 * 3 3 * ldr.cpp - Loader helper functions a structures. … … 18 18 *******************************************************************************/ 19 19 #include <os2.h> 20 #include <string.h>21 20 22 21 #include "malloc.h" 23 22 #include "new.h" 23 #include <memory.h> 24 #include <stdlib.h> 25 24 26 #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" 27 31 #include "ldr.h" 28 32 … … 31 35 * Global Variables * 32 36 *******************************************************************************/ 33 unsigned char ahStates[MAX_FILE_HANDLES/4];34 UNCERTAIN ahUncertain[MAX_UNCERTAIN_FILES];35 37 PPENODE pPE; 38 unsigned char achHandleStates[MAX_FILE_HANDLES/8]; 36 39 37 40 … … 40 43 *******************************************************************************/ 41 44 static PPENODE findNodePtr2(PPENODE pRoot, const char *pszFilename); 42 static ULONG freeNode(PPENODE pNode);43 45 static 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 unused65 * @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 else88 rc = -1;89 return rc;90 }91 92 93 /**94 * Find the uncertain entry for hFile95 * @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 }106 46 107 47 … … 322 262 323 263 /*depth first search thru the whole tree */ 324 if ( pRoot == NULL || pRoot->lxfile.queryIsModuleName(pszFilename))264 if (pRoot == NULL || pRoot->pPe2Lx->queryIsModuleName(pszFilename)) 325 265 return pRoot; 326 266 … … 344 284 pNode = new PENODE; 345 285 if (pNode == NULL) 346 kprintf(("allocateNode: malloc returned anNULL-pointer\n"));286 kprintf(("allocateNode: new returned a NULL-pointer\n")); 347 287 348 288 return pNode; … … 355 295 * @param pNode Pointer to node which is to be freed. 356 296 */ 357 staticULONG freeNode(PPENODE pNode)297 ULONG freeNode(PPENODE pNode) 358 298 { 359 299 if (pNode != NULL) … … 404 344 405 345 /* 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)); 418 347 419 348 /* init pPEFiles* */
Note:
See TracChangeset
for help on using the changeset viewer.