bool PluginPackage::fetchInfo() { if (!load()) return false; NPP_GetValueProcPtr gv = (NPP_GetValueProcPtr)m_module->resolve("NP_GetValue"); typedef char *(*NPP_GetMIMEDescriptionProcPtr)(); NPP_GetMIMEDescriptionProcPtr gm = (NPP_GetMIMEDescriptionProcPtr)m_module->resolve("NP_GetMIMEDescription"); if (!gm || !gv) return false; char *buf = 0; NPError err = gv(0, NPPVpluginNameString, (void*) &buf); if (err != NPERR_NO_ERROR) return false; m_name = buf; err = gv(0, NPPVpluginDescriptionString, (void*) &buf); if (err != NPERR_NO_ERROR) return false; m_description = buf; determineModuleVersionFromDescription(); String mimeDescription = gm(); setMIMEDescription(mimeDescription); m_infoIsFromCache = false; return true; }
bool NetscapePluginModule::getPluginInfoForLoadedPlugin(PluginModuleInfo& plugin) { ASSERT(m_isInitialized); plugin.path = m_pluginPath; plugin.info.file = pathGetFileName(m_pluginPath); Module* module = m_module.get(); NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue"); if (!NPP_GetValue) return false; NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription"); if (!NP_GetMIMEDescription) return false; char* buffer; NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer); if (error == NPERR_NO_ERROR) plugin.info.name = buffer; error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer); if (error == NPERR_NO_ERROR) plugin.info.desc = buffer; const char* mimeDescription = NP_GetMIMEDescription(); if (!mimeDescription) return false; setMIMEDescription(mimeDescription, plugin); return true; }