VirtualBox

Changeset 52213 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 28, 2014 5:52:58 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95276
Message:

SUP,IPRT: Implemented forwarder support in RTLdr and cleaned up some the ordinal mess. Resolved imports when doing the process verification/purification runs other than SUPHARDNTVPKIND_CHILD_PURIFICATION. This is necessary since 32-bit windows combine .text with .rdata, and we don't want to overwrite the import table after it has been snapped. Include read-only sections in the verfication runs.

Location:
trunk/include/iprt
Files:
3 edited

Legend:

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

    r52108 r52213  
    21622162/** Image hash mismatch. */
    21632163#define VERR_LDRVI_IMAGE_HASH_MISMATCH              (-22929)
     2164
     2165/** Cannot resolve symbol because it's a forwarder. */
     2166#define VERR_LDR_FORWARDER                          (-22950)
     2167/** The symbol is not a forwarder. */
     2168#define VERR_LDR_NOT_FORWARDER                      (-22951)
     2169/** Malformed forwarder entry. */
     2170#define VERR_LDR_BAD_FORWARDER                      (-22952)
     2171/** Too long forwarder chain or there is a loop. */
     2172#define VERR_LDR_FORWARDER_CHAIN_TOO_LONG           (-22953)
     2173/** Support for forwarders has not been implemented. */
     2174#define VERR_LDR_FORWARDERS_NOT_SUPPORTED           (-22954)
    21642175/** @} */
    21652176
  • trunk/include/iprt/ldr.h

    r51770 r52213  
    472472 *
    473473 * @returns iprt status code.
     474 * @retval  VERR_LDR_FORWARDER forwarder, use pfnQueryForwarderInfo. Buffer size
     475 *          hint in @a ppvValue.
    474476 * @param   hLdrMod         The loader module handle.
    475477 * @param   pszSymbol       Symbol name.
     
    487489 *
    488490 * @returns iprt status code.
     491 * @retval  VERR_LDR_FORWARDER forwarder, use pfnQueryForwarderInfo. Buffer size
     492 *          hint in @a pValue.
    489493 * @param   hLdrMod         The loader module handle.
    490494 * @param   pvBits          Optional pointer to the loaded image.
     
    493497 * @param   BaseAddress     Image load address.
    494498 *                          Not supported for RTLdrLoad() images.
     499 * @param   iOrdinal        Symbol ordinal number, pass UINT32_MAX if pszSymbol
     500 *                          should be used instead.
    495501 * @param   pszSymbol       Symbol name.
    496502 * @param   pValue          Where to store the symbol value.
    497503 */
    498 RTDECL(int) RTLdrGetSymbolEx(RTLDRMOD hLdrMod, const void *pvBits, RTLDRADDR BaseAddress, const char *pszSymbol,
    499                              PRTLDRADDR pValue);
    500 
     504RTDECL(int) RTLdrGetSymbolEx(RTLDRMOD hLdrMod, const void *pvBits, RTLDRADDR BaseAddress,
     505                             uint32_t iOrdinal, const char *pszSymbol, PRTLDRADDR pValue);
    501506
    502507/**
     
    511516 */
    512517RTDECL(PFNRT) RTLdrGetFunction(RTLDRMOD hLdrMod, const char *pszSymbol);
     518
     519/**
     520 * Information about an imported symbol.
     521 */
     522typedef struct RTLDRIMPORTINFO
     523{
     524    /** Symbol table entry number, UINT32_MAX if not available. */
     525    uint32_t        iSelfOrdinal;
     526    /** The ordinal of the imported symbol in szModule, UINT32_MAX if not used. */
     527    uint32_t        iOrdinal;
     528    /** The symbol name, NULL if not used.  This points to the char immediately
     529     *  following szModule when returned by RTLdrQueryForwarderInfo. */
     530    const char     *pszSymbol;
     531    /** The name of the module being imported from. */
     532    char            szModule[1];
     533} RTLDRIMPORTINFO;
     534/** Pointer to information about an imported symbol. */
     535typedef RTLDRIMPORTINFO *PRTLDRIMPORTINFO;
     536/** Pointer to const information about an imported symbol. */
     537typedef RTLDRIMPORTINFO const *PCRTLDRIMPORTINFO;
     538
     539/**
     540 * Query information about a forwarded symbol.
     541 *
     542 * @returns IPRT status code.
     543 * @param   hLdrMod         The loader module handle.
     544 * @param   pvBits          Optional pointer to the loaded image.
     545 *                          Set this to NULL if no RTLdrGetBits() processed image bits are available.
     546 *                          Not supported for RTLdrLoad() images.
     547 * @param   iOrdinal        Symbol ordinal number, pass UINT32_MAX if pszSymbol
     548 *                          should be used instead.
     549 * @param   pszSymbol       Symbol name.
     550 * @param   pInfo           Where to return the forwarder info.
     551 * @param   cbInfo          Size of the buffer @a pInfo points to.  For a size
     552 *                          hint, see @a pValue when RTLdrGetSymbolEx returns
     553 *                          VERR_LDR_FORWARDER.
     554 */
     555RTDECL(int) RTLdrQueryForwarderInfo(RTLDRMOD hLdrMod, const void *pvBits, uint32_t iOrdinal, const char *pszSymbol,
     556                                    PRTLDRIMPORTINFO pInfo, size_t cbInfo);
     557
    513558
    514559/**
  • trunk/include/iprt/mangling.h

    r51869 r52213  
    691691# define RTLdrRelocate                                  RT_MANGLER(RTLdrRelocate)
    692692# define RTLdrRvaToSegOffset                            RT_MANGLER(RTLdrRvaToSegOffset)
     693# define RTLdrQueryForwarderInfo                        RT_MANGLER(RTLdrQueryForwarderInfo)
    693694# define RTLdrQueryProp                                 RT_MANGLER(RTLdrQueryProp)
    694695# define RTLdrSegOffsetToRva                            RT_MANGLER(RTLdrSegOffsetToRva)
Note: See TracChangeset for help on using the changeset viewer.

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