Changeset 16933 in vbox for trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
- Timestamp:
- Feb 18, 2009 11:42:57 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 43082
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r13837 r16933 944 944 * @param pFileHdr Pointer to the file header that needs validating. 945 945 * @param pszLogName The log name to prefix the errors with. 946 */ 947 int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, const char *pszLogName) 946 * @param penmArch Where to store the CPU architecture. 947 */ 948 int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, const char *pszLogName, PRTLDRARCH penmArch) 948 949 { 949 950 size_t cbOptionalHeader; … … 952 953 case IMAGE_FILE_MACHINE_I386: 953 954 cbOptionalHeader = sizeof(IMAGE_OPTIONAL_HEADER32); 955 *penmArch = RTLDRARCH_X86_32; 954 956 break; 955 957 case IMAGE_FILE_MACHINE_AMD64: 956 958 cbOptionalHeader = sizeof(IMAGE_OPTIONAL_HEADER64); 959 *penmArch = RTLDRARCH_AMD64; 957 960 break; 958 961 … … 960 963 Log(("rtldrPEOpen: %s: Unsupported Machine=%#x\n", 961 964 pszLogName, pFileHdr->Machine)); 965 *penmArch = RTLDRARCH_INVALID; 962 966 return VERR_BAD_EXE_FORMAT; 963 967 } … … 1417 1421 * @returns iprt status code. 1418 1422 * @param pReader The loader reader instance which will provide the raw image bits. 1423 * @param fFlags Reserved, MBZ. 1424 * @param enmArch Architecture specifier. 1419 1425 * @param offNtHdrs The offset of the NT headers (where you find "PE\0\0"). 1420 1426 * @param phLdrMod Where to store the handle. 1421 1427 */ 1422 int rtldrPEOpen(PRTLDRREADER pReader, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod)1428 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod) 1423 1429 { 1424 1430 /* … … 1429 1435 if (RT_FAILURE(rc)) 1430 1436 return rc; 1437 RTLDRARCH enmArchImage; 1431 1438 const char *pszLogName = pReader->pfnLogName(pReader); 1432 rc = rtldrPEValidateFileHeader(&FileHdr, pszLogName );1439 rc = rtldrPEValidateFileHeader(&FileHdr, pszLogName, &enmArchImage); 1433 1440 if (RT_FAILURE(rc)) 1434 1441 return rc; 1442 1443 /* 1444 * Match the CPU architecture. 1445 */ 1446 if ( enmArch != RTLDRARCH_WHATEVER 1447 && enmArch != enmArchImage) 1448 return VERR_LDR_ARCH_MISMATCH; 1435 1449 1436 1450 /*
Note:
See TracChangeset
for help on using the changeset viewer.