Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

static int kldrModPEDoImports ( PKLDRMODPE  pModPE,
void *  pvMapping,
PFNKLDRMODGETIMPORT  pfnGetImport,
void *  pvUser 
) [static]

Resolves imports.

Returns:
0 on success, non-zero kLdr status code on failure.
Parameters:
pModPE The PE module interpreter instance.
pvMapping The mapping which imports should be resolved.
pfnGetImport The callback for resolving an imported symbol.
pvUser User argument to the callback.

Definition at line 1550 of file kLdrModPE.c.

References KLDRMODPE::cImportModules, KLDRMODPE::Hdrs, KLDRMODPE_RVA2TYPE, kldrModPEDoImports32Bit(), kldrModPEDoImports64Bit(), kldrModPENumberOfImports(), and KLDRMODPE::pMod.

Referenced by kldrModPEFixupMapping(), and kldrModPERelocateBits().

{
    const IMAGE_IMPORT_DESCRIPTOR *pImpDesc;

    /*
     * If no imports, there is nothing to do.
     */
    kldrModPENumberOfImports(pModPE->pMod, pvMapping);
    if (!pModPE->cImportModules)
        return 0;

    pImpDesc = KLDRMODPE_RVA2TYPE(pvMapping,
                                  pModPE->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress,
                                  const IMAGE_IMPORT_DESCRIPTOR *);
    if (pModPE->Hdrs.FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32))
        return kldrModPEDoImports32Bit(pModPE, pvMapping, pImpDesc, pfnGetImport, pvUser);
    return kldrModPEDoImports64Bit(pModPE, pvMapping, pImpDesc, pfnGetImport, pvUser);
}


Generated by  Doxygen 1.6.0   Back to index