Only loaded matching plugin on Windows #4866
Conflicts: src/gui/gui.pro src/gui/src/PluginManager.cpp src/lib/arch/win32/ArchPluginWindows.cpp
This commit is contained in:
parent
02902066a4
commit
a249c38b96
|
@ -59,7 +59,9 @@ SOURCES += src/main.cpp \
|
||||||
src/SslCertificate.cpp \
|
src/SslCertificate.cpp \
|
||||||
src/FileSysClient.cpp \
|
src/FileSysClient.cpp \
|
||||||
src/Plugin.cpp \
|
src/Plugin.cpp \
|
||||||
src/WebClient.cpp
|
src/WebClient.cpp \
|
||||||
|
../lib/common/PluginVersion.cpp
|
||||||
|
|
||||||
HEADERS += src/MainWindow.h \
|
HEADERS += src/MainWindow.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
src/ServerConfig.h \
|
src/ServerConfig.h \
|
||||||
|
@ -106,6 +108,8 @@ HEADERS += src/MainWindow.h \
|
||||||
src/FileSysClient.h \
|
src/FileSysClient.h \
|
||||||
src/Plugin.h \
|
src/Plugin.h \
|
||||||
src/WebClient.h
|
src/WebClient.h
|
||||||
|
../lib/common/PluginVersion.h
|
||||||
|
|
||||||
RESOURCES += res/Synergy.qrc
|
RESOURCES += res/Synergy.qrc
|
||||||
RC_FILE = res/win/Synergy.rc
|
RC_FILE = res/win/Synergy.rc
|
||||||
macx {
|
macx {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "ProcessorArch.h"
|
#include "ProcessorArch.h"
|
||||||
#include "Fingerprint.h"
|
#include "Fingerprint.h"
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
|
#include "../lib/common/PluginVersion.h"
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
|
||||||
PluginManager::PluginManager() :
|
PluginManager::PluginManager() :
|
||||||
m_FileSysPluginList()
|
m_FileSysPluginList()
|
||||||
{
|
{
|
||||||
|
@ -154,6 +156,7 @@ void PluginManager::copyPlugins()
|
||||||
"plugin list. Please contact the help desk, and "
|
"plugin list. Please contact the help desk, and "
|
||||||
"provide the following details.\n\n%1").arg(e.what()));
|
"provide the following details.\n\n%1").arg(e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit copyFinished();
|
emit copyFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "arch/win32/ArchPluginWindows.h"
|
#include "arch/win32/ArchPluginWindows.h"
|
||||||
#include "arch/win32/XArchWindows.h"
|
#include "arch/win32/XArchWindows.h"
|
||||||
|
#include "common/PluginVersion.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/IEventQueue.h"
|
#include "base/IEventQueue.h"
|
||||||
#include "base/Event.h"
|
#include "base/Event.h"
|
||||||
|
@ -67,16 +68,24 @@ ArchPluginWindows::load()
|
||||||
}
|
}
|
||||||
|
|
||||||
void* lib = reinterpret_cast<void*>(library);
|
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) {
|
String pluginName = synergy::string::removeFileExt(*it);
|
||||||
version = kPre174Plugin;
|
m_pluginTable.insert(std::make_pair(pluginName, lib));
|
||||||
}
|
|
||||||
|
|
||||||
|
char* version = (char*)invoke(pluginName.c_str(), "version", NULL);
|
||||||
|
String expectedVersion(pluginVersion(pluginName.c_str()));
|
||||||
|
if (version != NULL && expectedVersion.compare(version) == 0) {
|
||||||
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(), version));
|
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(), version));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_WARN "plugin version doesn't match"));
|
||||||
|
LOG((CLOG_DEBUG "expected plugin version: %s actual plugin version: %s",
|
||||||
|
expectedVersion.c_str(), version));
|
||||||
|
LOG((CLOG_WARN "skip plugin: %s", (*it).c_str()));
|
||||||
|
m_pluginTable.erase(pluginName);
|
||||||
|
FreeLibrary(library);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2015 Synergy Si Ltd.
|
||||||
|
*
|
||||||
|
* This package is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
|
*
|
||||||
|
* This package is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PluginVersion.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static const int kpluginCount = 1;
|
||||||
|
static const char kUnknownVersion[] = "unknown";
|
||||||
|
static const char* s_pluginNames[] = {"ns"};
|
||||||
|
static const char* s_pluginVersions[] = {"1.2"};
|
||||||
|
|
||||||
|
const char* pluginVersion(const char* pluginName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < kpluginCount; i++) {
|
||||||
|
if (strcmp(pluginName, s_pluginNames[i]) == 0) {
|
||||||
|
return s_pluginVersions[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return kUnknownVersion;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2015 Synergy Si Ltd.
|
||||||
|
*
|
||||||
|
* This package is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
|
*
|
||||||
|
* This package is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// return plugin version map
|
||||||
|
const char* pluginVersion(const char* pluginName);
|
|
@ -20,6 +20,7 @@
|
||||||
#include "SecureSocket.h"
|
#include "SecureSocket.h"
|
||||||
#include "SecureListenSocket.h"
|
#include "SecureListenSocket.h"
|
||||||
#include "arch/Arch.h"
|
#include "arch/Arch.h"
|
||||||
|
#include "common/PluginVersion.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -27,11 +28,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
const char * kSynergyVers = VERSION;
|
|
||||||
SecureSocket* g_secureSocket = NULL;
|
SecureSocket* g_secureSocket = NULL;
|
||||||
SecureListenSocket* g_secureListenSocket = NULL;
|
SecureListenSocket* g_secureListenSocket = NULL;
|
||||||
Arch* g_arch = NULL;
|
Arch* g_arch = NULL;
|
||||||
Log* g_log = NULL;
|
Log* g_log = NULL;
|
||||||
|
static const char kPluginName[] = "ns";
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
helperGetLibsUsed(void)
|
helperGetLibsUsed(void)
|
||||||
|
@ -106,7 +107,7 @@ invoke(const char* command, void** args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(command, "version") == 0) {
|
else if (strcmp(command, "version") == 0) {
|
||||||
return (void*) kSynergyVers;
|
return (void*)pluginVersion(kPluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue