// Dynamically load SSL library. Set up ctx->ssl_ctx pointer. static int set_ssl_option(struct mg_context *ctx) { int i, size; const char *pem; // If PEM file is not specified and the init_ssl callback // is not specified, skip SSL initialization. if ((pem = ctx->config[SSL_CERTIFICATE]) == NULL) { // MG_INIT_SSL // ctx->callbacks.init_ssl == NULL) { return 1; } #if !defined(NO_SSL_DL) if (!load_dll(ctx, SSL_LIB, ssl_sw) || !load_dll(ctx, CRYPTO_LIB, crypto_sw)) { return 0; } #endif // NO_SSL_DL // Initialize SSL library SSL_library_init(); SSL_load_error_strings(); if ((ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) { cry(fc(ctx), "SSL_CTX_new (server) error: %s", ssl_error()); return 0; } // If user callback returned non-NULL, that means that user callback has // set up certificate itself. In this case, skip sertificate setting. // MG_INIT_SSL if (SSL_CTX_use_certificate_file(ctx->ssl_ctx, pem, 1) == 0 || SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, pem, 1) == 0) { cry(fc(ctx), "%s: cannot open %s: %s", __func__, pem, ssl_error()); return 0; } if (pem != NULL) { (void) SSL_CTX_use_certificate_chain_file(ctx->ssl_ctx, pem); } // Initialize locking callbacks, needed for thread safety. // http://www.openssl.org/support/faq.html#PROG1 size = sizeof(pthread_mutex_t) * CRYPTO_num_locks(); if ((ssl_mutexes = (pthread_mutex_t *) malloc((size_t)size)) == NULL) { cry(fc(ctx), "%s: cannot allocate mutexes: %s", __func__, ssl_error()); return 0; } for (i = 0; i < CRYPTO_num_locks(); i++) { pthread_mutex_init(&ssl_mutexes[i], NULL); } CRYPTO_set_locking_callback(&ssl_locking_callback); CRYPTO_set_id_callback(&ssl_id_callback); return 1; }
SslCrypt::SslCrypt(const char* lib1, const char* lib2, int version):_pssl_accept(0),_pssl_connect(0),_version(version) { if (!load_dll(lib1, ssl_sw) || !load_dll(lib2, crypto_sw)) { // "sudo apt-get install libssl-dev" GLOGE("Cannot load SSL libraries..."); exit(0); } SSL_library_init(); SSL_load_error_strings(); // OpenSSL_add_ssl_algorithms(); }
void patch_with_dll(const char* dll_filename, Branch* branch, caValue* errorOut) { // Check to unload this file, if it's already loaded unload_dll(dll_filename); Dll* dll = load_dll(dll_filename, errorOut); if (dll == NULL) { if (errorOut != NULL) { std::stringstream msg; msg << "load_dll failed, " << as_string(errorOut); set_string(errorOut, msg.str().c_str()); } return; } // Call on_load (if it exists) OnLoadFunc onLoad = (OnLoadFunc) find_func_in_dll(dll, "on_load"); if (onLoad != NULL) onLoad(branch); // Iterate through every function inside 'branch', and possibly replace // its evaluate function with one from the dll. patch_branch_recr(dll, branch, ""); }
/* * Load library and get all pointers. * Parameter 'libname' provides name of DLL. * Return OK or FAIL. */ static int ruby_runtime_link_init(char *libname, int verbose) { int i; if (hinstRuby) return OK; hinstRuby = load_dll(libname); if (!hinstRuby) { if (verbose) EMSG2(_(e_loadlib), libname); return FAIL; } for (i = 0; ruby_funcname_table[i].ptr; ++i) { if (!(*ruby_funcname_table[i].ptr = symbol_from_dll(hinstRuby, ruby_funcname_table[i].name))) { close_dll(hinstRuby); hinstRuby = NULL; if (verbose) EMSG2(_(e_loadfunc), ruby_funcname_table[i].name); return FAIL; } } return OK; }
/* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ INTLDECL char * textdomain(const char *__domainname) { if (!load_dll() || !f_gettext_fncs.textdomain_x) return 0; return (*f_gettext_fncs.textdomain_x)(__domainname); }
static int load_dlls // LOAD DLL'S ( void ) { char const * env; // - position in WMAKE_DLL pointer unsigned char dll_name[_MAX_PATH]; // - DLL name char const * dp; // - points at dll_name size_t size; // - size of dll name int retn; // - return: TRUE ==> ok env = getenv( "WMAKE_DLL" ); retn = TRUE; if( 0 != env ) { for( ; ; ) { dp = env; for( ; ; ++env ) { if( *env == ';' ) break; if( *env == '\0' ) { break; } } size = env - dp; if( size > 0 ) { dll_name[size] = '\0'; memcpy( dll_name, dp, size ); retn &= load_dll( dll_name ); } if( *env == '\0' ) break; ++ env; } } return( retn ); }
/* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ INTLDECL char * gettext(const char *__msgid) { if (!load_dll() || !f_gettext_fncs.gettext_x) return (char *)__msgid; return (*f_gettext_fncs.gettext_x)(__msgid); }
/* pass some set_property call to gettext */ INTLDECL int gt_set_property (const char *name, const char *value) { if (!load_dll() || !f_gettext_fncs.gt_set_property_x) return 0; return (*f_gettext_fncs.gt_set_property_x)(name, value); }
static int lua_link_init(char *libname, int verbose) { const luaV_Reg *reg; if (hinstLua) return OK; hinstLua = load_dll(libname); if (!hinstLua) { if (verbose) EMSG2(_(e_loadlib), libname); return FAIL; } for (reg = luaV_dll; reg->func; reg++) { if ((*reg->func = symbol_from_dll(hinstLua, reg->name)) == NULL) { close_dll(hinstLua); hinstLua = 0; if (verbose) EMSG2(_(e_loadfunc), reg->name); return FAIL; } } return OK; }
/* * Load library and get all pointers. * Parameter 'libname' provides name of DLL. * Return OK or FAIL. */ static int python_runtime_link_init(char *libname, int verbose) { int i; PYTHON_PROC *ucs_as_encoded_string = (PYTHON_PROC*)&py_PyUnicode_AsEncodedString; # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) /* Can't have Python and Python3 loaded at the same time. * It cause a crash, because RTLD_GLOBAL is needed for * standard C extension libraries of one or both python versions. */ if (python3_loaded()) { if (verbose) emsg(_("E836: This Vim cannot execute :python after using :py3")); return FAIL; } # endif if (hinstPython) return OK; hinstPython = load_dll(libname); if (!hinstPython) { if (verbose) semsg(_(e_loadlib), libname); return FAIL; } for (i = 0; python_funcname_table[i].ptr; ++i) { if ((*python_funcname_table[i].ptr = symbol_from_dll(hinstPython, python_funcname_table[i].name)) == NULL) { close_dll(hinstPython); hinstPython = 0; if (verbose) semsg(_(e_loadfunc), python_funcname_table[i].name); return FAIL; } } /* Load unicode functions separately as only the ucs2 or the ucs4 functions * will be present in the library. */ *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS2_AsEncodedString"); if (*ucs_as_encoded_string == NULL) *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS4_AsEncodedString"); if (*ucs_as_encoded_string == NULL) { close_dll(hinstPython); hinstPython = 0; if (verbose) semsg(_(e_loadfunc), "PyUnicode_UCSX_*"); return FAIL; } return OK; }
/* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ INTLDECL char * bind_textdomain_codeset(const char *__domainname, const char *__codeset) { if (!load_dll() || !f_gettext_fncs.bind_textdomain_codeset_x) return 0; return (*f_gettext_fncs.bind_textdomain_codeset_x)(__domainname, __codeset); }
/* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ INTLDECL char * dgettext(const char *__domainname, const char *__msgid) { if (!load_dll() || !f_gettext_fncs.dgettext_x) return (char *)__msgid; return (*f_gettext_fncs.dgettext_x)(__domainname, __msgid); }
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ INTLDECL char * dcgettext(const char *__domainname, const char *__msgid, int __category) { if (!load_dll() || !f_gettext_fncs.dcgettext_x) return (char *)__msgid; return (*f_gettext_fncs.dcgettext_x)(__domainname, __msgid, __category); }
/* Similar to `gettext' but select the plural form corresponding to the number N. */ INTLDECL char * ngettext(const char *__msgid1, const char *__msgid2, unsigned long int __n) { if (!load_dll() || !f_gettext_fncs.ngettext_x) return __n>1 ? (char *)__msgid2 : (char *)__msgid1; return (*f_gettext_fncs.ngettext_x)(__msgid1, __msgid2, __n); }
/* Similar to `dcgettext' but select the plural form corresponding to the number N. */ INTLDECL char * dcngettext(const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) { if (!load_dll() || !f_gettext_fncs.dcngettext_x) return __n>1 ? (char *)__msgid2 : (char *)__msgid1; return (*f_gettext_fncs.dcngettext_x)(__domainname, __msgid1, __msgid2, __n, __category); }
/* increment nl_msg_cat_cntr in gettext */ INTLDECL void gt_notify_language_change (void) { /* TODO: Need to find out how to directly bump counter in case this is someone else's gettext.dll */ if (!load_dll() || !f_gettext_fncs.gt_notify_language_change_x) return; (*f_gettext_fncs.gt_notify_language_change_x)(); }
static int ishim_set_dll_name (const char *filepath) { if (!filepath) filepath = ""; lstrcpyn(f_dllpath, filepath, sizeof(f_dllpath)); unload_dll(); f_failed=0; /* force attempt to load */ return load_dll(); }
PaError dll_Pa_OpenDefaultStream( PaStream** stream, int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat, double sampleRate, unsigned long framesPerBuffer, PaStreamCallback *streamCallback, void *userData ) { if (load_dll()) return dPa_OpenDefaultStream(stream,numInputChannels,numOutputChannels,sampleFormat,sampleRate,framesPerBuffer,streamCallback,userData); return paNotInitialized; }
int preinit(sh_audio_t *sh_audio) { /* Win32 VQF audio codec: */ vqf_priv_t *priv; if(!(sh_audio->context=malloc(sizeof(vqf_priv_t)))) return 0; priv=sh_audio->context; if(!load_dll(sh_audio->codec->dll)) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "win32.dll looks broken :(\n"); return 0; } if(!init_vqf_audio_codec(sh_audio)){ mp_msg(MSGT_DECAUDIO, MSGL_ERR, "TWinVQ initialization fail\n"); return 0; } mp_msg(MSGT_DECAUDIO, MSGL_INFO, "INFO: TWinVQ (%s) audio codec init OK!\n",sh_audio->codec->dll); priv->skip_cnt = 2; return 1; }
void startEngine(void) { //dbg_printf("Started skinner engine"); readSettings(); set_log_window(); if (engine_running) return; if (false == make_exclusion_list()) return; if (false == load_dll()) { free_exclusion_list(); return; } bbSkinMsg = RegisterWindowMessage(BBLEANSKIN_WINDOWMSG); // save sys-colors setTTC(SAVE_3DC); // save the normal SystemParameter settings, window metrics, etc. ncm_save.cbSize = sizeof(NONCLIENTMETRICS); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof ncm_save, &ncm_save, 0); ZeroMemory(&ncm_prev, sizeof(NONCLIENTMETRICS)); // read styles for skin readStyle(); // possibly set sys-colors setTTC(APPLY_3DC); // set the system wide window metrics according to style metrics setmetrics(); // set the hook EntryFunc(ENGINE_SETHOOKS, lpvMem); engine_running = true; // now apply to open windows if (applyToOpen) sendToAll(MSGID_LOAD); //write_bin(); }
/* * Load library and get all pointers. * Parameter 'libname' provides name of DLL. * Return OK or FAIL. */ static int python_runtime_link_init(char *libname, int verbose) { int i; #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) /* Can't have Python and Python3 loaded at the same time. * It cause a crash, because RTLD_GLOBAL is needed for * standard C extension libraries of one or both python versions. */ if (python3_loaded()) { if (verbose) EMSG(_("E836: This Vim cannot execute :python after using :py3")); return FAIL; } #endif if (hinstPython) return OK; hinstPython = load_dll(libname); if (!hinstPython) { if (verbose) EMSG2(_(e_loadlib), libname); return FAIL; } for (i = 0; python_funcname_table[i].ptr; ++i) { if ((*python_funcname_table[i].ptr = symbol_from_dll(hinstPython, python_funcname_table[i].name)) == NULL) { close_dll(hinstPython); hinstPython = 0; if (verbose) EMSG2(_(e_loadfunc), python_funcname_table[i].name); return FAIL; } } return OK; }
void dll_al_GenSources(ALsizei n, ALuint *sources) { if (load_dll()) dAlGenSources(n, sources); }
void dll_al_DeleteSources(ALsizei n, ALuint *sources) { if (load_dll()) dAlDeleteSources(n, sources); }
void dll_al_GenBuffers(ALsizei n, ALuint *buffers) { if (load_dll()) dAlGenBuffers(n, buffers); }
void dll_al_DeleteBuffers(ALsizei n, ALuint *buffers) { if (load_dll()) dAlDeleteBuffers(n, buffers); }
void dll_al_SourceStop(ALuint source) { if (load_dll()) dAlSourceStop(source); }
void dll_al_SourcePlay(ALuint source) { if (load_dll()) dAlSourcePlay(source); }
void dll_al_BufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq) { if (load_dll()) dAlBufferData(buffer, format, data, size, freq); }
void dll_al_SourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers) { if (load_dll()) dAlSourceUnqueueBuffers(source, nb, buffers); }
void dll_al_GetSourcei(ALuint source, ALenum param, ALint *value) { if (load_dll()) dAlGetSourcei(source, param, value); }