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

int kLdrModOpenNative ( const char *  pszFilename,
PPKLDRMOD  ppMod 
)

Loads a module using the native module loader.

Returns:
0 on success.

non-zero native or kLdr status code on failure.

Parameters:
pszFilename The filename or module name to be loaded.
ppMod Where to store the module interpreter instance pointer.

Definition at line 180 of file kLdrModNative.c.

References kLdrModOpenNativeByHandle(), and NULL.

Referenced by kldrModNativeCreate().

{
    int rc;

    /*
     * Load the image.
     */
#if K_OS == K_OS_OS2
    HMODULE hmod;

    rc = DosLoadModule(NULL, 0, (PCSZ)pszFilename, &hmod);
    if (rc)
        return rc;
    rc = kLdrModOpenNativeByHandle((KUPTR)hmod, ppMod);
    if (rc)
        DosFreeModule(hmod);

#elif K_OS == K_OS_WINDOWS
    HMODULE hmod;

    hmod = LoadLibrary(pszFilename);
    if (!hmod)
        return GetLastError();
    rc = kLdrModOpenNativeByHandle((KUPTR)hmod, ppMod);
    if (rc)
        FreeLibrary(hmod);

#elif K_OS == K_OS_DARWIN
    void *pvMod;

    pvMod = dlopen(pszFilename, 0);
    if (!pvMod)
        return ENOENT;
    rc = kLdrModOpenNativeByHandle((KUPTR)pvMod, ppMod);
    if (rc)
        dlclose(pvMod);

#else
# error "Port me"
#endif
    return rc;
}


Generated by  Doxygen 1.6.0   Back to index