Exemple #1
0
static int get_executable_name()
{
    if (port_executable_name(&g_executable) != 0)
        return -1;

    return g_executable ? 0 : -1;
}
Exemple #2
0
APR_DECLARE(apr_status_t) port_dso_load_ex(apr_dso_handle_t** handle,
                                           const char* path,
                                           U_32 mode,
                                           apr_pool_t* pool){
    /*
    * FIXME Windows does not support lazy dll resolution a la Linux's RTLD_LAZY.
    * Proper support for it requires hacking of APR DSO functions. 
    * Just ignore the <code>mode<code> param for now.
    */

    /*if (mode == PORT_DSO_DEFAULT || !path) {*/
        char *self_path;
        apr_status_t res;

        if (!path) {
            port_executable_name(&self_path);
            res = apr_dso_load(handle, (const char*)self_path, pool);
            STD_FREE(self_path);
            return res;
        }

        return apr_dso_load(handle, path, pool);

    /*} else {
        HINSTANCE native_handle = NULL;
        DWORD flag = (mode & PORT_DSO_BIND_DEFER) ? 
            (DONT_RESOLVE_DLL_REFERENCES) : (0);
        char *cp = apr_pstrdup(pool, path);
        char *p = cp;
        while ((p = strchr(p, '/')) != NULL) {
            *p = '\\';
        }

        native_handle = LoadLibraryEx(cp, NULL, flag);
        *handle = apr_palloc(pool, sizeof(apr_dso_handle_t));
        if (native_handle == 0) {
            native_handle = LoadLibraryEx(cp, NULL, flag | LOAD_WITH_ALTERED_SEARCH_PATH);
            if (native_handle == 0) {
                DWORD sys_err = apr_get_os_error();
                (*handle)->error = sys_err;
                return sys_err;
            }
        }
        (*handle)->handle = native_handle;
        (*handle)->pool = pool;
        (*handle)->error = APR_SUCCESS;
        return APR_SUCCESS;
    }*/
}