Changeset 46023 in vbox
- Timestamp:
- May 13, 2013 3:34:54 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/ldr.h
r45994 r46023 152 152 typedef RTLDRARCH *PRTLDRARCH; 153 153 154 /** @name RTLDR_O_XXX - RTLdrOpen flags. 155 * @{ */ 156 /** Open for debugging or introspection reasons. 157 * This will skip a few of the stricter validations when loading images. */ 158 #define RTLDR_O_FOR_DEBUG RT_BIT_32(0) 159 /** Mask of valid flags. */ 160 #define RTLDR_O_VALID_MASK UINT32_C(0x00000001) 161 /** @} */ 162 154 163 /** 155 164 * Open a binary image file, extended version. … … 157 166 * @returns iprt status code. 158 167 * @param pszFilename Image filename. 159 * @param fFlags Reserved, MBZ.168 * @param fFlags Valid RTLDR_O_XXX combination. 160 169 * @param enmArch CPU architecture specifier for the image to be loaded. 161 170 * @param phLdrMod Where to store the handle to the loader module. … … 167 176 * 168 177 * @returns iprt status code. 169 * @param pszFilename 170 * @param phLdrMod 171 * @param fFlags Reserved, MBZ.178 * @param pszFilename Image filename. 179 * @param phLdrMod Where to store the handle to the loaded module. 180 * @param fFlags Valid RTLDR_O_XXX combination. 172 181 * @param enmArch CPU architecture specifier for the image to be loaded. 173 182 * @remark Primarily for testing the loader. -
trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp
r44528 r46023 254 254 LogFlow(("RTLdrOpen: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n", 255 255 pszFilename, pszFilename, fFlags, enmArch, phLdrMod)); 256 AssertMsgReturn(! fFlags, ("%#x\n", fFlags), VERR_INVALID_PARAMETER);256 AssertMsgReturn(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER); 257 257 AssertMsgReturn(enmArch > RTLDRARCH_INVALID && enmArch < RTLDRARCH_END, ("%d\n", enmArch), VERR_INVALID_PARAMETER); 258 258 … … 306 306 LogFlow(("RTLdrOpenkLdr: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n", 307 307 pszFilename, pszFilename, fFlags, enmArch, phLdrMod)); 308 AssertMsgReturn(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER); 308 309 309 310 /* -
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r45996 r46023 1153 1153 * @returns iprt status code. 1154 1154 * @param pFileHdr Pointer to the file header that needs validating. 1155 * @param fFlags Valid RTLDR_O_XXX combination. 1155 1156 * @param pszLogName The log name to prefix the errors with. 1156 1157 * @param penmArch Where to store the CPU architecture. 1157 1158 */ 1158 int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, const char *pszLogName, PRTLDRARCH penmArch)1159 static int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, uint32_t fFlags, const char *pszLogName, PRTLDRARCH penmArch) 1159 1160 { 1160 1161 size_t cbOptionalHeader; … … 1183 1184 } 1184 1185 /* This restriction needs to be implemented elsewhere. */ 1185 if (pFileHdr->Characteristics & IMAGE_FILE_RELOCS_STRIPPED) 1186 if ( (pFileHdr->Characteristics & IMAGE_FILE_RELOCS_STRIPPED) 1187 && !(fFlags & RTLDR_O_FOR_DEBUG)) 1186 1188 { 1187 1189 Log(("rtldrPEOpen: %s: IMAGE_FILE_RELOCS_STRIPPED\n", pszLogName)); … … 1712 1714 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod) 1713 1715 { 1714 AssertReturn(!fFlags, VERR_INVALID_PARAMETER);1715 1716 1716 /* 1717 1717 * Read and validate the file header. … … 1723 1723 RTLDRARCH enmArchImage; 1724 1724 const char *pszLogName = pReader->pfnLogName(pReader); 1725 rc = rtldrPEValidateFileHeader(&FileHdr, pszLogName, &enmArchImage);1725 rc = rtldrPEValidateFileHeader(&FileHdr, fFlags, pszLogName, &enmArchImage); 1726 1726 if (RT_FAILURE(rc)) 1727 1727 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.