VirtualBox

Changeset 46023 in vbox


Ignore:
Timestamp:
May 13, 2013 3:34:54 PM (12 years ago)
Author:
vboxsync
Message:

RTLdrOpen: Defined the first flag RTLDR_O_FOR_DEBUG for use with RTDbgMod.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/ldr.h

    r45994 r46023  
    152152typedef RTLDRARCH *PRTLDRARCH;
    153153
     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
    154163/**
    155164 * Open a binary image file, extended version.
     
    157166 * @returns iprt status code.
    158167 * @param   pszFilename Image filename.
    159  * @param   fFlags      Reserved, MBZ.
     168 * @param   fFlags      Valid RTLDR_O_XXX combination.
    160169 * @param   enmArch     CPU architecture specifier for the image to be loaded.
    161170 * @param   phLdrMod    Where to store the handle to the loader module.
     
    167176 *
    168177 * @returns iprt status code.
    169  * @param   pszFilename     Image filename.
    170  * @param   phLdrMod        Where to store the handle to the loaded module.
    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.
    172181 * @param   enmArch     CPU architecture specifier for the image to be loaded.
    173182 * @remark  Primarily for testing the loader.
  • trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp

    r44528 r46023  
    254254    LogFlow(("RTLdrOpen: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n",
    255255             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);
    257257    AssertMsgReturn(enmArch > RTLDRARCH_INVALID && enmArch < RTLDRARCH_END, ("%d\n", enmArch), VERR_INVALID_PARAMETER);
    258258
     
    306306    LogFlow(("RTLdrOpenkLdr: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n",
    307307             pszFilename, pszFilename, fFlags, enmArch, phLdrMod));
     308    AssertMsgReturn(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
    308309
    309310    /*
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r45996 r46023  
    11531153 * @returns iprt status code.
    11541154 * @param   pFileHdr    Pointer to the file header that needs validating.
     1155 * @param   fFlags      Valid RTLDR_O_XXX combination.
    11551156 * @param   pszLogName  The log name to  prefix the errors with.
    11561157 * @param   penmArch    Where to store the CPU architecture.
    11571158 */
    1158 int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, const char *pszLogName, PRTLDRARCH penmArch)
     1159static int rtldrPEValidateFileHeader(PIMAGE_FILE_HEADER pFileHdr, uint32_t fFlags, const char *pszLogName, PRTLDRARCH penmArch)
    11591160{
    11601161    size_t cbOptionalHeader;
     
    11831184    }
    11841185    /* 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))
    11861188    {
    11871189        Log(("rtldrPEOpen: %s: IMAGE_FILE_RELOCS_STRIPPED\n", pszLogName));
     
    17121714int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod)
    17131715{
    1714     AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
    1715 
    17161716    /*
    17171717     * Read and validate the file header.
     
    17231723    RTLDRARCH enmArchImage;
    17241724    const char *pszLogName = pReader->pfnLogName(pReader);
    1725     rc = rtldrPEValidateFileHeader(&FileHdr, pszLogName, &enmArchImage);
     1725    rc = rtldrPEValidateFileHeader(&FileHdr, fFlags, pszLogName, &enmArchImage);
    17261726    if (RT_FAILURE(rc))
    17271727        return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette