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

int kLdrDyldLoad ( const char *  pszDll,
const char *  pszPrefix,
const char *  pszSuffix,
KLDRDYLDSEARCH  enmSearch,
unsigned  fFlags,
PHKLDRMOD  phMod,
char *  pszErr,
KSIZE  cchErr 
)

Loads a module into the current process.

Returns:
0 on success, non-zero native OS status code or kLdr status code on failure.
Parameters:
pszDll The name of the dll to open.
pszPrefix Prefix to use when searching.
pszSuffix Suffix to use when searching.
enmSearch Method to use when locating the module and any modules it may depend on.
fFlags Flags, a combintation of the KLDRYDLD_LOAD_FLAGS_* #defines.
phMod Where to store the handle to the loaded module.
pszErr Where to store extended error information. (optional)
cchErr The size of the buffer pointed to by pszErr.

Definition at line 330 of file kLdrDyld.c.

References g_cActiveLoadCalls, g_cTotalLoadCalls, KLDRDYLDMOD::hMod, K_VALIDATE_ENUM, K_VALIDATE_OPTIONAL_BUFFER, K_VALIDATE_OPTIONAL_STRING, K_VALIDATE_STRING, kldrDyldDoLoad(), kldrDyldDoModuleTerminationAndGarabageCollection(), kLdrDyldSemRelease(), kLdrDyldSemRequest(), NIL_HKLDRMOD, and NULL.

Referenced by main().

{
    int rc;

    /* validate arguments and initialize return values. */
    if (pszErr && cchErr)
        *pszErr = '\0';
    *phMod = NIL_HKLDRMOD;
    K_VALIDATE_STRING(pszDll);
    K_VALIDATE_OPTIONAL_STRING(pszPrefix);
    K_VALIDATE_OPTIONAL_STRING(pszSuffix);
    K_VALIDATE_ENUM(enmSearch, KLDRDYLD_SEARCH);
    K_VALIDATE_OPTIONAL_BUFFER(pszErr, cchErr);

    /* get the semaphore and do the job. */
    rc = kLdrDyldSemRequest();
    if (!rc)
    {
        PKLDRDYLDMOD pMod = NULL;
        g_cTotalLoadCalls++;
        g_cActiveLoadCalls++;
        rc = kldrDyldDoLoad(pszDll, pszPrefix, pszSuffix, enmSearch, fFlags, &pMod, pszErr, cchErr);
        g_cActiveLoadCalls--;
        kldrDyldDoModuleTerminationAndGarabageCollection();
        kLdrDyldSemRelease();
        *phMod = pMod ? pMod->hMod : NIL_HKLDRMOD;
    }
    return rc;
}


Generated by  Doxygen 1.6.0   Back to index