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

static int kldrModPEQueryMainEntrypoint ( PKLDRMOD  pMod,
const void *  pvBits,
KLDRADDR  BaseAddress,
PKLDRADDR  pMainEPAddress 
) [static]

Queries the main entrypoint of the module.

Only executable are supposed to have an main entrypoint, though some object and DLL formats will also allow this.

Returns:
0 and *pMainEPAddress on success. Non-zero status code on failure.
Parameters:
pMod The module.
pvBits Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress. This can be used by some module interpreters to reduce memory consumption.
BaseAddress The module base address to use when calculating the entrypoint address. There are two special values that can be used: KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP.
pMainEPAddress Where to store the entry point address.

Definition at line 1120 of file kLdrModPE.c.

References KLDRMODPE::Hdrs, kldrModPEBitsAndBaseAddress(), NIL_KLDRADDR, NULL, and KLDRMOD::pvData.

{
    PKLDRMODPE pModPE = (PKLDRMODPE)pMod->pvData;
    int rc;

    /*
     * Resolve base address alias if any.
     */
    rc = kldrModPEBitsAndBaseAddress(pModPE, NULL, &BaseAddress);
    if (rc)
        return rc;

    /*
     * Convert the address from the header.
     */
    *pMainEPAddress = pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint
        ? BaseAddress + pModPE->Hdrs.OptionalHeader.AddressOfEntryPoint
        : NIL_KLDRADDR;
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index