NPError NP_Initialize(NPNetscapeFuncs* browser_funcs, NPPluginFuncs* plugin_funcs) { printf("NPP_Initialize\n"); memcpy(&kBrowserFuncs, browser_funcs, sizeof(kBrowserFuncs)); pglInitialize(); return NP_GetEntryPoints(plugin_funcs); }
FABRIC_NPAPI_EXPORT NPError OSCALL NP_Initialize(NPNetscapeFuncs* browser_functions, NPPluginFuncs* plugin_functions) { displayHeader(); FABRIC_DEBUG_LOG( "Debug with: gdb --pid=%d", getpid() ); llvmInitialize(); extern void InitializeBrowserFunctions(NPNetscapeFuncs* browser_functions); InitializeBrowserFunctions(browser_functions); NPError np_err = NP_GetEntryPoints(plugin_functions); return np_err; }
bool PluginPackage::load() { if (m_isLoaded) { m_loadCount++; return true; } WTF::RetainPtr<CFStringRef> path(AdoptCF, m_path.createCFString()); WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false)); m_module = CFBundleCreate(NULL, url.get()); if (!m_module || !CFBundleLoadExecutable(m_module)) { LOG(Plugins, "%s not loaded", m_path.utf8().data()); return false; } m_isLoaded = true; NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0; NP_InitializeFuncPtr NP_Initialize; NPError npErr; NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Initialize")); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_GetEntryPoints")); m_NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Shutdown")); if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) goto abort; memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); initializeBrowserFuncs(); npErr = NP_Initialize(&m_browserFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; npErr = NP_GetEntryPoints(&m_pluginFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; m_loadCount++; return true; abort: unloadWithoutShutdown(); return false; }
extern "C" NPError WINAPI NP_Initialize(NPNetscapeFuncs* nFuncs, NPPluginFuncs* pFuncs) { if(!nFuncs) return NPERR_INVALID_FUNCTABLE_ERROR; qNetscapeFuncs = nFuncs; int navMajorVers = qNetscapeFuncs->version >> 8; // if the plugin's major version is lower than the Navigator's, // then they are incompatible, and should return an error if(navMajorVers > NP_VERSION_MAJOR) return NPERR_INCOMPATIBLE_VERSION_ERROR; // check if the Browser supports the XEmbed protocol int supportsXEmbed = 0; NPError err = NPN_GetValue(0, NPNVSupportsXEmbedBool, (void *)&supportsXEmbed); if (err != NPERR_NO_ERROR ||!supportsXEmbed) return NPERR_INCOMPATIBLE_VERSION_ERROR; return NP_GetEntryPoints(pFuncs); }
NP_Initialize (NPNetscapeFuncs * nf) #endif { if (nf == NULL) return NPERR_INVALID_FUNCTABLE_ERROR; #ifdef HAVE_LINUX NP_GetEntryPoints (pf); #else cloud_spy_startup (); #endif cloud_spy_object_type_init (); cloud_spy_nsfuncs = nf; cloud_spy_plugin_roots = g_hash_table_new_full (NULL, NULL, NULL, cloud_spy_root_object_destroy); cloud_spy_main_context = g_main_context_new (); cloud_spy_main_loop = g_main_loop_new (cloud_spy_main_context, FALSE); cloud_spy_main_thread = g_thread_create (cloud_spy_run_main_loop, NULL, TRUE, NULL); return NPERR_NO_ERROR; }
bool PluginPackage::load() { if (m_freeLibraryTimer.isActive()) { ASSERT(m_module); m_freeLibraryTimer.stop(); } else if (m_isLoaded) { if (m_quirks.contains(PluginQuirkDontAllowMultipleInstances)) return false; m_loadCount++; return true; } else { WCHAR currentPath[MAX_PATH]; if (!::GetCurrentDirectoryW(MAX_PATH, currentPath)) return false; String path = m_path.substring(0, m_path.reverseFind('\\')); if (!::SetCurrentDirectoryW(path.charactersWithNullTermination())) return false; // Load the library m_module = ::LoadLibraryW(m_path.charactersWithNullTermination()); if (!::SetCurrentDirectoryW(currentPath)) { if (m_module) ::FreeLibrary(m_module); return false; } } if (!m_module) return false; m_isLoaded = true; NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0; NP_InitializeFuncPtr NP_Initialize = 0; NPError npErr; NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, "NP_Initialize"); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, "NP_GetEntryPoints"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, "NP_Shutdown"); if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) goto abort; memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); npErr = NP_GetEntryPoints(&m_pluginFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; memset(&m_browserFuncs, 0, sizeof(m_browserFuncs)); m_browserFuncs.size = sizeof (m_browserFuncs); m_browserFuncs.version = NP_VERSION_MINOR; m_browserFuncs.geturl = NPN_GetURL; m_browserFuncs.posturl = NPN_PostURL; m_browserFuncs.requestread = NPN_RequestRead; m_browserFuncs.newstream = NPN_NewStream; m_browserFuncs.write = NPN_Write; m_browserFuncs.destroystream = NPN_DestroyStream; m_browserFuncs.status = NPN_Status; m_browserFuncs.uagent = NPN_UserAgent; m_browserFuncs.memalloc = NPN_MemAlloc; m_browserFuncs.memfree = NPN_MemFree; m_browserFuncs.memflush = NPN_MemFlush; m_browserFuncs.reloadplugins = NPN_ReloadPlugins; m_browserFuncs.geturlnotify = NPN_GetURLNotify; m_browserFuncs.posturlnotify = NPN_PostURLNotify; m_browserFuncs.getvalue = NPN_GetValue; m_browserFuncs.setvalue = NPN_SetValue; m_browserFuncs.invalidaterect = NPN_InvalidateRect; m_browserFuncs.invalidateregion = NPN_InvalidateRegion; m_browserFuncs.forceredraw = NPN_ForceRedraw; m_browserFuncs.getJavaEnv = NPN_GetJavaEnv; m_browserFuncs.getJavaPeer = NPN_GetJavaPeer; m_browserFuncs.pushpopupsenabledstate = NPN_PushPopupsEnabledState; m_browserFuncs.poppopupsenabledstate = NPN_PopPopupsEnabledState; m_browserFuncs.pluginthreadasynccall = NPN_PluginThreadAsyncCall; m_browserFuncs.releasevariantvalue = _NPN_ReleaseVariantValue; m_browserFuncs.getstringidentifier = _NPN_GetStringIdentifier; m_browserFuncs.getstringidentifiers = _NPN_GetStringIdentifiers; m_browserFuncs.getintidentifier = _NPN_GetIntIdentifier; m_browserFuncs.identifierisstring = _NPN_IdentifierIsString; m_browserFuncs.utf8fromidentifier = _NPN_UTF8FromIdentifier; m_browserFuncs.intfromidentifier = _NPN_IntFromIdentifier; m_browserFuncs.createobject = _NPN_CreateObject; m_browserFuncs.retainobject = _NPN_RetainObject; m_browserFuncs.releaseobject = _NPN_ReleaseObject; m_browserFuncs.invoke = _NPN_Invoke; m_browserFuncs.invokeDefault = _NPN_InvokeDefault; m_browserFuncs.evaluate = _NPN_Evaluate; m_browserFuncs.getproperty = _NPN_GetProperty; m_browserFuncs.setproperty = _NPN_SetProperty; m_browserFuncs.removeproperty = _NPN_RemoveProperty; m_browserFuncs.hasproperty = _NPN_HasProperty; m_browserFuncs.hasmethod = _NPN_HasMethod; m_browserFuncs.setexception = _NPN_SetException; m_browserFuncs.enumerate = _NPN_Enumerate; m_browserFuncs.construct = _NPN_Construct; npErr = NP_Initialize(&m_browserFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; m_loadCount++; return true; abort: unloadWithoutShutdown(); return false; }
bool PluginPackage::load() { if (m_freeLibraryTimer.isActive()) { ASSERT(m_module); m_freeLibraryTimer.stop(); } else if (m_isLoaded) { if (m_quirks.contains(PluginQuirkDontAllowMultipleInstances)) return false; m_loadCount++; return true; } else { #if OS(WINCE) m_module = ::LoadLibraryW(m_path.charactersWithNullTermination().data()); #else WCHAR currentPath[MAX_PATH]; if (!::GetCurrentDirectoryW(MAX_PATH, currentPath)) return false; String path = m_path.substring(0, m_path.reverseFind('\\')); if (!::SetCurrentDirectoryW(path.charactersWithNullTermination().data())) return false; // Load the library m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); if (!::SetCurrentDirectoryW(currentPath)) { if (m_module) ::FreeLibrary(m_module); return false; } #endif } if (!m_module) return false; m_isLoaded = true; NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0; NP_InitializeFuncPtr NP_Initialize = 0; NPError npErr; #if OS(WINCE) NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, L"NP_Initialize"); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, L"NP_GetEntryPoints"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, L"NP_Shutdown"); #else NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, "NP_Initialize"); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, "NP_GetEntryPoints"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, "NP_Shutdown"); #endif if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) goto abort; memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); npErr = NP_GetEntryPoints(&m_pluginFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; initializeBrowserFuncs(); npErr = NP_Initialize(&m_browserFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; m_loadCount++; return true; abort: unloadWithoutShutdown(); return false; }
bool PluginPackage::load() { if (m_isLoaded) { m_loadCount++; return true; } WTF::RetainPtr<CFStringRef> path(AdoptCF, m_path.createCFString()); WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false)); m_module = CFBundleCreate(NULL, url.get()); if (!m_module || !CFBundleLoadExecutable(m_module)) { LOG(Plugin, "%s not loaded", m_path.utf8().data()); return false; } m_isLoaded = true; NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0; NP_InitializeFuncPtr NP_Initialize; NPError npErr; NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Initialize")); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_GetEntryPoints")); m_NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Shutdown")); if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) goto abort; memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); m_browserFuncs.size = sizeof(m_browserFuncs); m_browserFuncs.version = NP_VERSION_MINOR; m_browserFuncs.geturl = NPN_GetURL; m_browserFuncs.posturl = NPN_PostURL; m_browserFuncs.requestread = NPN_RequestRead; m_browserFuncs.newstream = NPN_NewStream; m_browserFuncs.write = NPN_Write; m_browserFuncs.destroystream = NPN_DestroyStream; m_browserFuncs.status = NPN_Status; m_browserFuncs.uagent = NPN_UserAgent; m_browserFuncs.memalloc = NPN_MemAlloc; m_browserFuncs.memfree = NPN_MemFree; m_browserFuncs.memflush = NPN_MemFlush; m_browserFuncs.reloadplugins = NPN_ReloadPlugins; m_browserFuncs.geturlnotify = NPN_GetURLNotify; m_browserFuncs.posturlnotify = NPN_PostURLNotify; m_browserFuncs.getvalue = NPN_GetValue; m_browserFuncs.setvalue = NPN_SetValue; m_browserFuncs.invalidaterect = NPN_InvalidateRect; m_browserFuncs.invalidateregion = NPN_InvalidateRegion; m_browserFuncs.forceredraw = NPN_ForceRedraw; m_browserFuncs.getJavaEnv = NPN_GetJavaEnv; m_browserFuncs.getJavaPeer = NPN_GetJavaPeer; m_browserFuncs.pushpopupsenabledstate = NPN_PushPopupsEnabledState; m_browserFuncs.poppopupsenabledstate = NPN_PopPopupsEnabledState; m_browserFuncs.releasevariantvalue = _NPN_ReleaseVariantValue; m_browserFuncs.getstringidentifier = _NPN_GetStringIdentifier; m_browserFuncs.getstringidentifiers = _NPN_GetStringIdentifiers; m_browserFuncs.getintidentifier = _NPN_GetIntIdentifier; m_browserFuncs.identifierisstring = _NPN_IdentifierIsString; m_browserFuncs.utf8fromidentifier = _NPN_UTF8FromIdentifier; m_browserFuncs.createobject = _NPN_CreateObject; m_browserFuncs.retainobject = _NPN_RetainObject; m_browserFuncs.releaseobject = _NPN_ReleaseObject; m_browserFuncs.invoke = _NPN_Invoke; m_browserFuncs.invokeDefault = _NPN_InvokeDefault; m_browserFuncs.evaluate = _NPN_Evaluate; m_browserFuncs.getproperty = _NPN_GetProperty; m_browserFuncs.setproperty = _NPN_SetProperty; m_browserFuncs.removeproperty = _NPN_RemoveProperty; m_browserFuncs.hasproperty = _NPN_HasMethod; m_browserFuncs.hasmethod = _NPN_HasProperty; m_browserFuncs.setexception = _NPN_SetException; m_browserFuncs.enumerate = _NPN_Enumerate; npErr = NP_Initialize(&m_browserFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; npErr = NP_GetEntryPoints(&m_pluginFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; m_loadCount++; return true; abort: unloadWithoutShutdown(); return false; }
bool PluginPackage::load() { if (m_isLoaded) { m_loadCount++; return true; } NP_InitializeFuncPtr NP_Initialize = 0; NPError err = 0; m_module = wkcPluginLoadPeer(m_path.utf8().data()); if (!m_module) { unloadWithoutShutdown(); return false; } NP_Initialize = (NP_InitializeFuncPtr)wkcPluginGetSymbolPeer(m_module, "NP_Initialize"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)wkcPluginGetSymbolPeer(m_module, "NP_Shutdown"); #ifndef XP_UNIX NP_GetEntryPointsFuncPtr NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)wkcPluginGetSymbolPeer(m_module, "NP_GetEntryPoints"); if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) { #else if (!NP_Initialize || !m_NPP_Shutdown) { #endif wkcPluginUnloadPeer(m_module); m_module = 0; goto error_end; } m_isLoaded = true; ::memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); #ifndef XP_UNIX err = NP_GetEntryPoints(&m_pluginFuncs); if (err!=NPERR_NO_ERROR) goto error_end; #endif #if ENABLE(NETSCAPE_PLUGIN_API) initializeBrowserFuncs(); #endif #ifdef XP_UNIX err = NP_Initialize(&m_browserFuncs, &m_pluginFuncs); #else err = NP_Initialize(&m_browserFuncs); #endif if (err!=NPERR_NO_ERROR) goto error_end; m_loadCount++; return true; error_end: unloadWithoutShutdown(); return false; } bool unloadModule(PlatformModule module) { wkcPluginUnloadPeer(module); return true; }