Exemplo n.º 1
0
void
ArchPluginWindows::load()
{
	String dir = getPluginsDir();
	LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str()));

	String pattern = String(dir).append("\\*.dll");
	std::vector<String> plugins;
	getFilenames(pattern, plugins);

	std::vector<String>::iterator it;
	for (it = plugins.begin(); it != plugins.end(); ++it) {
		LOG((CLOG_DEBUG "loading plugin: %s", (*it).c_str()));
		String path = String(dir).append("\\").append(*it);
		HINSTANCE library = LoadLibrary(path.c_str());

		if (library == NULL) {
			String error = XArchEvalWindows().eval();
			LOG((CLOG_ERR "failed to load plugin '%s', error: %s", (*it).c_str(), error.c_str()));
			continue;
		}

		void* lib = reinterpret_cast<void*>(library);
		String filename = synergy::string::removeFileExt(*it);
		m_pluginTable.insert(std::make_pair(filename, lib));

		const char * version = (char*)invoke( filename.c_str(),"version",NULL);
		if (version == NULL) {
			version = kPre174Plugin;
		}

		LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version));
	}
}
Exemplo n.º 2
0
CArchAppUtilWindows::CArchAppUtilWindows() :
m_exitMode(kExitModeNormal)
{
	if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)consoleHandler, TRUE) == FALSE)
    {
		throw XArchEvalWindows();
    }
}