Changeset 5053 for trunk/tools/common/kFileLX.cpp
- Timestamp:
- Feb 2, 2001, 9:45:42 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/common/kFileLX.cpp
r4750 r5053 1 /* $Id: kFileLX.cpp,v 1. 3 2000-12-04 08:48:08bird Exp $1 /* $Id: kFileLX.cpp,v 1.4 2001-02-02 08:45:41 bird Exp $ 2 2 * 3 3 * … … 46 46 #include <assert.h> 47 47 48 #include "kFile.h" 48 49 #include "kFileFormatBase.h" 49 50 #include "kInterfaces.h" … … 112 113 * @param pszFilename LX executable image name. 113 114 */ 114 kFileLX::kFileLX(const char *pszFilename) 115 kFileLX::kFileLX(const char *pszFilename) throw (int) 115 116 : pvBase(NULL) 116 117 { … … 119 120 /* create filemapping */ 120 121 pvBase = kFileFormatBase::readfile(pszFilename); 122 if (pvBase == NULL) 123 throw(1); 124 125 pehdr = (struct exe_hdr*)pvBase; 126 if (pehdr->e_magic == EMAGIC) 127 offLXHdr = pehdr->e_lfanew; 128 else 129 offLXHdr = 0; 130 131 pe32 = (struct e32_exe*)((char*)pvBase + offLXHdr); 132 if (*(PUSHORT)pe32 != E32MAGIC) 133 { 134 free(pvBase); 135 pvBase = NULL; 136 throw(2); 137 } 138 139 paObject = pe32->e32_objtab && pe32->e32_objcnt 140 ? (struct o32_obj*)((char*)pvBase + pe32->e32_objtab + offLXHdr) : NULL; 141 paMap = pe32->e32_objmap 142 ? (struct o32_map*)((char*)pvBase + pe32->e32_objmap + offLXHdr) : NULL; 143 } 144 145 146 /** 147 * Create an LX file object from an LX executable image. 148 * @param pFile Pointer to opened LX file. 149 */ 150 kFileLX::kFileLX(kFile *pFile) throw (int) 151 : pvBase(NULL) 152 { 153 struct exe_hdr * pehdr; 154 155 /* create filemapping */ 156 pvBase = pFile->readFile(); 121 157 if (pvBase == NULL) 122 158 throw(1);
Note:
See TracChangeset
for help on using the changeset viewer.