Changeset 1678 for trunk/src/win32k/pe2lx/pe2lx.cpp
- Timestamp:
- Nov 10, 1999, 2:45:38 AM (26 years ago)
- 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:09bird Exp $1 /* $Id: pe2lx.cpp,v 1.7 1999-11-10 01:45:37 bird Exp $ 2 2 * 3 3 * Pe2Lx class implementation. Ring 0 and Ring 3 … … 21 21 #else /*RING3*/ 22 22 #define INCL_DOSFILEMGR /* RING3: DOS File api. */ 23 #define INCL_DOSPROCESS /* RING3: DosSleep. */ 23 24 #endif 24 25 … … 124 125 #include "ldrCalls.h" /* _ldr* calls. (_ldrRead) */ 125 126 #endif 127 #include "modulebase.h" /* ModuleBase class definitions, ++. */ 126 128 #include "pe2lx.h" /* Pe2Lx class definitions, ++. */ 127 129 #include <versionos2.h> /* Pe2Lx version. */ … … 188 190 { /* Win32 Module name Odin32 Module name*/ 189 191 {"NETAPI32", "WNETAP32"}, 192 {"OLE32", "OLE32OS2"}, 190 193 {NULL, NULL} /* end-of-list entry */ 191 194 }; 192 193 194 /**195 * Current output message detail level; default: Pe2Lx::Info, -W3.196 */197 ULONG Pe2Lx::ulInfoLevel = Pe2Lx::Info;198 199 195 200 196 … … 244 240 */ 245 241 Pe2Lx::Pe2Lx(SFN hFile) : 246 #ifdef DEBUG 247 fInitTime(TRUE), 248 #endif 249 hFile(hFile), pszFilename(NULL), pszModuleName(NULL), 242 ModuleBase(hFile), 250 243 fAllInOneObject(FALSE), paObjects(NULL), cObjects(0), cObjectsAllocated(0), 251 244 paObjTab(NULL), paObjPageTab(NULL), … … 281 274 Pe2Lx::~Pe2Lx() 282 275 { 283 if (pszFilename != NULL)284 {285 free(pszFilename);286 pszFilename = NULL;287 }288 if (pszModuleName != NULL)289 {290 free(pszModuleName);291 pszModuleName = NULL;292 }293 276 if (paObjects != NULL) 294 277 { … … 398 381 PIMAGE_DOS_HEADER pMzHdr; 399 382 int i, j; 400 PCSZ psz;401 383 PIMAGE_SECTION_HEADER paSections; /* Pointer to section headers */ 402 384 … … 412 394 413 395 /* 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; 429 399 430 400 /* 1.Read the from the start of the file, expect a MZ header. */ … … 1124 1094 1125 1095 /** 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 THEN1131 * BEGIN1132 * IF no extention THEN1133 * compare directly with modulename1134 * ELSE1135 * compare input filename with the object filename without path.1136 * END1137 * ELSE1138 * compare input filename with the object filename1139 * return TRUE if equal : FALSE if not.1140 * @status partially implemented.1141 * @author knut st. osmundsen1142 */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 else1150 { /* extention */1151 PCSZ psz = strchr(this->pszFilename, '\\');1152 if ((psz = strchr(this->pszFilename, '/')) == NULL)1153 psz = this->pszFilename;1154 else1155 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 /**1166 1096 * Gets the size of the virtual LX-file. 1167 1097 * @returns Size of the virtual LX-file in bytes. … … 4066 3996 4067 3997 /** 4068 * Output function for Pe2Lx.4069 * @param pszFormat Pointer to format string.4070 * @status completely implemented; tested.4071 * @author knut st. osmundsen4072 */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 /**4087 3998 * Constructor. 4088 3999 * @param hFile Filehandle.
Note:
See TracChangeset
for help on using the changeset viewer.