Changeset 2891 for trunk/kLdr/kLdrMod.c


Ignore:
Timestamp:
Nov 21, 2006, 10:40:45 PM (19 years ago)
Author:
bird
Message:

interface adjustment (in progress).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrMod.c

    r2879 r2891  
    238238 *                              KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP.
    239239 * @param   iSymbol         The symbol ordinal. (optional)
    240  * @param   pszSymbol       The symbol name. (optional)
     240 * @param   pchSymbol       The symbol name. (optional)
     241 *                          Important, this doesn't have to be a null-terminated string.
     242 * @param   cchSymbol       The length of the symbol name.
     243 * @param   pszVersion      The symbol version. NULL if not versioned.
    241244 * @param   pfnGetForwarder The callback to use when resolving a forwarder symbol. This is optional
    242245 *                          and if not specified KLDR_ERR_FORWARDER is returned instead.
    243246 * @param   pvUser          The user argument for the pfnGetForwarder callback.
    244247 * @param   puValue         Where to store the symbol value. (optional)
    245  * @param   pfKind          Where to store the symbol kind. (optional)
     248 * @param   pfKind          On input one of the KLDRSYMKIND_REQ_* #defines.
     249 *                          On output the symbol kind. (optional)
    246250 */
    247251int     kLdrModQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t iSymbol,
    248                            const char *pszSymbol, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser,
    249                            PKLDRADDR puValue, uint32_t *pfKind)
     252                           const char *pchSymbol, size_t cchSymbol, const char *pszVersion,
     253                           PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, uint32_t *pfKind)
    250254{
    251255    KLDRMOD_VALIDATE(pMod);
     
    255259        *puValue = 0;
    256260    if (pfKind)
    257         *pfKind = 0;
    258     return pMod->pOps->pfnQuerySymbol(pMod, pvBits, BaseAddress, iSymbol, pszSymbol, pfnGetForwarder, pvUser, puValue, pfKind);
     261        KLDRHLP_VALIDATE_FLAGS(*pfKind, KLDRSYMKIND_REQ_SEGMENTED);
     262    return pMod->pOps->pfnQuerySymbol(pMod, pvBits, BaseAddress, iSymbol, pchSymbol, cchSymbol, pszVersion,
     263                                      pfnGetForwarder, pvUser, puValue, pfKind);
    259264}
    260265
     
    379384
    380385/**
     386 * Queries info about a resource.
     387 *
     388 * If there are multiple resources matching the criteria, the best or
     389 * first match will be return.
     390 *
     391 *
     392 * @returns 0 on success.
     393 * @returns Whatever non-zero status returned by pfnCallback (enumeration was stopped).
     394 * @returns non-zero kLdr or native status code on failure.
     395 *
     396 * @param   pMod            The module.
     397 * @param   pvBits          Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress.
     398 *                          This can be used by some module interpreters to reduce memory consumption.
     399 * @param   BaseAddress     The module base address to use when calculating the resource addresses.
     400 *                          There are two special values that can be used:
     401 *                              KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP.
     402 * @param   idType          The resource type id to match if not NIL_KLDRMOD_RSRC_TYPE_ID.
     403 * @param   pszType         The resource type name to match if no NULL.
     404 * @param   idName          The resource name id to match if not NIL_KLDRMOD_RSRC_NAME_ID.
     405 * @param   pszName         The resource name to match if not NULL.
     406 * @param   idLang          The language id to match.
     407 * @param   pfnCallback     The callback function.
     408 * @param   pvUser          The user argument for the callback.
     409 */
     410int     kLdrModQueryResource(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t idType, const char *pszType,
     411                             uint32_t idName, const char *pszName, uint32_t idLang, PKLDRADDR pAddrRsrc, size_t *pcbRsrc)
     412{
     413    KLDRMOD_VALIDATE(pMod);
     414    if (!pAddrRsrc && !pcbRsrc)
     415        return KLDR_ERR_INVALID_PARAMETER;
     416    if (pAddrRsrc)
     417        *pAddrRsrc = NIL_KLDRADDR;
     418    if (pcbRsrc)
     419        *pcbRsrc = 0;
     420    return pMod->pOps->pfnQueryResource(pMod, pvBits, BaseAddress, idType, pszType, idName, pszName, idLang, pAddrRsrc, pcbRsrc);
     421}
     422
     423
     424/**
     425 * Enumerates the resources matching the specfied criteria.
     426 *
     427 *
     428 * @returns 0 on success.
     429 * @returns Whatever non-zero status returned by pfnCallback (enumeration was stopped).
     430 * @returns non-zero kLdr or native status code on failure.
     431 *
     432 * @param   pMod            The module.
     433 * @param   pvBits          Optional pointer to bits returned by kLdrModGetBits() currently located at BaseAddress.
     434 *                          This can be used by some module interpreters to reduce memory consumption.
     435 * @param   BaseAddress     The module base address to use when calculating the resource addresses.
     436 *                          There are two special values that can be used:
     437 *                              KLDRMOD_BASEADDRESS_LINK and KLDRMOD_BASEADDRESS_MAP.
     438 * @param   idType          The resource type id to match if not NIL_KLDRMOD_RSRC_TYPE_ID.
     439 * @param   pszType         The resource type name to match if no NULL.
     440 * @param   idName          The resource name id to match if not NIL_KLDRMOD_RSRC_NAME_ID.
     441 * @param   pszName         The resource name to match if not NULL.
     442 * @param   idLang          The language id to match.
     443 * @param   pfnCallback     The callback function.
     444 * @param   pvUser          The user argument for the callback.
     445 */
     446int     kLdrModEnumResources(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t idType, const char *pszType,
     447                             uint32_t idName, const char *pszName, uint32_t idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser)
     448{
     449    KLDRMOD_VALIDATE(pMod);
     450    return pMod->pOps->pfnEnumResources(pMod, pvBits, BaseAddress, idType, pszType, idName, pszName, idLang, pfnCallback, pvUser);
     451}
     452
     453
     454/**
    381455 * Enumerate the debug info formats contained in the executable image.
    382456 *
Note: See TracChangeset for help on using the changeset viewer.