mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-02 05:24:31 +08:00
Reorganized source tree. Moved client.cpp into cmd/synergy as
synergy.cpp and server.cpp into cmd/synergyd as synergyd.cpp. Moved and renamed related files. Moved remaining source files into lib/.... Modified and added makefiles as appropriate. Result is that library files are under lib with each library in its own directory and program files are under cmd with each command in its own directory.
This commit is contained in:
9
cmd/Makefile.am
Normal file
9
cmd/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
NULL =
|
||||
DEPTH = ..
|
||||
|
||||
EXTRA_DIST =
|
||||
SUBDIRS = \
|
||||
synergy \
|
||||
synergyd \
|
||||
$(NULL)
|
||||
32
cmd/synergy/Makefile.am
Normal file
32
cmd/synergy/Makefile.am
Normal file
@@ -0,0 +1,32 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
NULL =
|
||||
DEPTH = ../..
|
||||
|
||||
bin_PROGRAMS = synergy
|
||||
synergy_SOURCES = \
|
||||
synergy.cpp \
|
||||
$(NULL)
|
||||
synergy_LDADD = \
|
||||
$(DEPTH)/lib/client/libclient.a \
|
||||
$(DEPTH)/lib/platform/libplatform.a \
|
||||
$(DEPTH)/lib/synergy/libsynergy.a \
|
||||
$(DEPTH)/lib/net/libnet.a \
|
||||
$(DEPTH)/lib/io/libio.a \
|
||||
$(DEPTH)/lib/mt/libmt.a \
|
||||
$(DEPTH)/lib/base/libbase.a \
|
||||
$(X_LIBS) \
|
||||
$(X_PRE_LIBS) \
|
||||
-lXtst \
|
||||
-lXext \
|
||||
-lX11 \
|
||||
$(X_EXTRA_LIBS) \
|
||||
$(NULL)
|
||||
INCLUDES = \
|
||||
-I$(DEPTH)/lib/base \
|
||||
-I$(DEPTH)/lib/mt \
|
||||
-I$(DEPTH)/lib/io \
|
||||
-I$(DEPTH)/lib/net \
|
||||
-I$(DEPTH)/lib/synergy \
|
||||
-I$(DEPTH)/lib/platform \
|
||||
-I$(DEPTH)/lib/client \
|
||||
$(NULL)
|
||||
17
cmd/synergy/resource.h
Normal file
17
cmd/synergy/resource.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by client.rc
|
||||
//
|
||||
#define IDD_SYNERGY 101
|
||||
#define IDC_LOG 1000
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
667
cmd/synergy/synergy.cpp
Normal file
667
cmd/synergy/synergy.cpp
Normal file
@@ -0,0 +1,667 @@
|
||||
#include "CClient.h"
|
||||
#include "CPlatform.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "Version.h"
|
||||
#include "CNetwork.h"
|
||||
#include "CNetworkAddress.h"
|
||||
#include "XSocket.h"
|
||||
#include "CCondVar.h"
|
||||
#include "CLock.h"
|
||||
#include "CMutex.h"
|
||||
#include "CThread.h"
|
||||
#include "XThread.h"
|
||||
#include "CLog.h"
|
||||
#include "CString.h"
|
||||
#include <cstring>
|
||||
|
||||
// platform dependent name of a daemon
|
||||
#if WINDOWS_LIKE
|
||||
#define DAEMON_NAME "Synergy Client"
|
||||
#elif UNIX_LIKE
|
||||
#define DAEMON_NAME "synergy"
|
||||
#endif
|
||||
|
||||
//
|
||||
// program arguments
|
||||
//
|
||||
|
||||
static const char* pname = NULL;
|
||||
static bool s_restartable = true;
|
||||
static bool s_daemon = true;
|
||||
static bool s_camp = true;
|
||||
static bool s_install = false;
|
||||
static bool s_uninstall = false;
|
||||
static const char* s_logFilter = NULL;
|
||||
static CString s_name;
|
||||
static CNetworkAddress s_serverAddress;
|
||||
|
||||
|
||||
//
|
||||
// logging thread safety
|
||||
//
|
||||
|
||||
static CMutex* s_logMutex = NULL;
|
||||
|
||||
static
|
||||
void
|
||||
logLock(bool lock)
|
||||
{
|
||||
assert(s_logMutex != NULL);
|
||||
|
||||
if (lock) {
|
||||
s_logMutex->lock();
|
||||
}
|
||||
else {
|
||||
s_logMutex->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// platform independent main
|
||||
//
|
||||
|
||||
static CClient* s_client = NULL;
|
||||
|
||||
static
|
||||
int
|
||||
realMain(CMutex* mutex)
|
||||
{
|
||||
// caller should have mutex locked on entry
|
||||
|
||||
int result = kExitSuccess;
|
||||
do {
|
||||
try {
|
||||
// initialize threading library
|
||||
CThread::init();
|
||||
|
||||
// make logging thread safe
|
||||
CMutex logMutex;
|
||||
s_logMutex = &logMutex;
|
||||
CLog::setLock(&logLock);
|
||||
|
||||
bool opened = false;
|
||||
bool locked = true;
|
||||
try {
|
||||
// create client
|
||||
s_client = new CClient(s_name);
|
||||
s_client->camp(s_camp);
|
||||
s_client->setAddress(s_serverAddress);
|
||||
if (s_client->open()) {
|
||||
opened = true;
|
||||
|
||||
// run client
|
||||
if (mutex != NULL) {
|
||||
mutex->unlock();
|
||||
}
|
||||
locked = false;
|
||||
s_client->mainLoop();
|
||||
locked = true;
|
||||
if (mutex != NULL) {
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
// get client status
|
||||
if (s_client->wasRejected()) {
|
||||
// wait a while before retrying. we don't want
|
||||
// to bother the server very often if it doesn't
|
||||
// want us.
|
||||
if (s_restartable) {
|
||||
CThread::sleep(60.0);
|
||||
}
|
||||
else {
|
||||
result = kExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
s_client->close();
|
||||
}
|
||||
else {
|
||||
// wait a few seconds before retrying
|
||||
if (s_restartable) {
|
||||
CThread::sleep(3.0);
|
||||
}
|
||||
else {
|
||||
result = kExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
delete s_client;
|
||||
s_client = NULL;
|
||||
CLog::setLock(NULL);
|
||||
s_logMutex = NULL;
|
||||
}
|
||||
catch (...) {
|
||||
// clean up
|
||||
if (!locked && mutex != NULL) {
|
||||
mutex->lock();
|
||||
}
|
||||
if (s_client != NULL) {
|
||||
if (opened) {
|
||||
s_client->close();
|
||||
}
|
||||
delete s_client;
|
||||
s_client = NULL;
|
||||
}
|
||||
CLog::setLock(NULL);
|
||||
s_logMutex = NULL;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (XBase& e) {
|
||||
log((CLOG_CRIT "failed: %s", e.what()));
|
||||
}
|
||||
catch (XThread&) {
|
||||
// terminated
|
||||
return kExitTerminated;
|
||||
}
|
||||
} while (s_restartable);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// command line parsing
|
||||
//
|
||||
|
||||
#define BYE "\nTry `%s --help' for more information."
|
||||
|
||||
static void (*bye)(int) = &exit;
|
||||
|
||||
static
|
||||
void
|
||||
version()
|
||||
{
|
||||
log((CLOG_PRINT
|
||||
"%s %d.%d.%d, protocol version %d.%d\n"
|
||||
"%s",
|
||||
pname,
|
||||
kMajorVersion,
|
||||
kMinorVersion,
|
||||
kReleaseVersion,
|
||||
kProtocolMajorVersion,
|
||||
kProtocolMinorVersion,
|
||||
kCopyright));
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
help()
|
||||
{
|
||||
#if WINDOWS_LIKE
|
||||
|
||||
# define PLATFORM_ARGS \
|
||||
" [--install]" \
|
||||
" <server-address>\n" \
|
||||
"or\n" \
|
||||
" --uninstall\n"
|
||||
# define PLATFORM_DESC \
|
||||
" --install install server as a service.\n" \
|
||||
" --uninstall uninstall server service.\n"
|
||||
|
||||
#else
|
||||
|
||||
# define PLATFORM_ARGS \
|
||||
" <server-address>\n"
|
||||
# define PLATFORM_DESC
|
||||
|
||||
#endif
|
||||
|
||||
log((CLOG_PRINT
|
||||
"Usage: %s"
|
||||
" [--camp|--no-camp]"
|
||||
" [--daemon|--no-daemon]"
|
||||
" [--debug <level>]"
|
||||
" [--name <screen-name>]"
|
||||
" [--restart|--no-restart]"
|
||||
PLATFORM_ARGS
|
||||
"\n"
|
||||
"Start the synergy mouse/keyboard sharing server.\n"
|
||||
"\n"
|
||||
"* --camp keep attempting to connect to the server until\n"
|
||||
" successful.\n"
|
||||
" --no-camp do not camp.\n"
|
||||
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
||||
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
||||
" DEBUG, DEBUG1, DEBUG2.\n"
|
||||
" -f, --no-daemon run the client in the foreground.\n"
|
||||
"* --daemon run the client as a daemon.\n"
|
||||
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
||||
" ourself to the server.\n"
|
||||
" -1, --no-restart do not try to restart the client if it fails for\n"
|
||||
" some reason.\n"
|
||||
"* --restart restart the client automatically if it fails.\n"
|
||||
PLATFORM_DESC
|
||||
" -h, --help display this help and exit.\n"
|
||||
" --version display version information and exit.\n"
|
||||
"\n"
|
||||
"* marks defaults.\n"
|
||||
"\n"
|
||||
"The server address is of the form: [<hostname>][:<port>]. The hostname\n"
|
||||
"must be the address or hostname of the server. The port overrides the\n"
|
||||
"default port, %d.\n"
|
||||
"\n"
|
||||
"Where log messages go depends on the platform and whether or not the\n"
|
||||
"client is running as a daemon.",
|
||||
pname, kDefaultPort));
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
isArg(int argi, int argc, const char** argv,
|
||||
const char* name1, const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
{
|
||||
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
|
||||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
|
||||
// match. check args left.
|
||||
if (argi + minRequiredParameters >= argc) {
|
||||
log((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
|
||||
pname, argv[argi], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// no match
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
parse(int argc, const char** argv)
|
||||
{
|
||||
assert(pname != NULL);
|
||||
assert(argv != NULL);
|
||||
assert(argc >= 1);
|
||||
|
||||
// set defaults
|
||||
char hostname[256];
|
||||
if (CNetwork::gethostname(hostname, sizeof(hostname)) != CNetwork::Error) {
|
||||
s_name = hostname;
|
||||
}
|
||||
|
||||
// parse options
|
||||
int i;
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (isArg(i, argc, argv, "-d", "--debug", 1)) {
|
||||
// change logging level
|
||||
s_logFilter = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-n", "--name", 1)) {
|
||||
// save screen name
|
||||
s_name = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--camp")) {
|
||||
// enable camping
|
||||
s_camp = true;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--no-camp")) {
|
||||
// disable camping
|
||||
s_camp = false;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-f", "--no-daemon")) {
|
||||
// not a daemon
|
||||
s_daemon = false;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--daemon")) {
|
||||
// daemonize
|
||||
s_daemon = true;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-1", "--no-restart")) {
|
||||
// don't try to restart
|
||||
s_restartable = false;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--restart")) {
|
||||
// try to restart
|
||||
s_restartable = true;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-h", "--help")) {
|
||||
help();
|
||||
bye(kExitSuccess);
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--version")) {
|
||||
version();
|
||||
bye(kExitSuccess);
|
||||
}
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
else if (isArg(i, argc, argv, NULL, "--install")) {
|
||||
s_install = true;
|
||||
if (s_uninstall) {
|
||||
log((CLOG_PRINT "%s: `--install' and `--uninstall'"
|
||||
" are mutually exclusive" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
||||
s_uninstall = true;
|
||||
if (s_install) {
|
||||
log((CLOG_PRINT "%s: `--install' and `--uninstall'"
|
||||
" are mutually exclusive" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (isArg(i, argc, argv, "--", NULL)) {
|
||||
// remaining arguments are not options
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
|
||||
else if (argv[i][0] == '-') {
|
||||
log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
|
||||
else {
|
||||
// this and remaining arguments are not options
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// exactly one non-option argument (server-address) unless using
|
||||
// --uninstall.
|
||||
if (s_uninstall) {
|
||||
if (i != argc) {
|
||||
log((CLOG_PRINT "%s: unrecognized option `%s' to `%s'" BYE,
|
||||
pname, argv[i], pname,
|
||||
s_install ? "--install" : "--uninstall"));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (i == argc) {
|
||||
log((CLOG_PRINT "%s: a server address or name is required" BYE,
|
||||
pname, pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
if (i + 1 != argc) {
|
||||
log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
|
||||
// save server address
|
||||
try {
|
||||
s_serverAddress = CNetworkAddress(argv[i], kDefaultPort);
|
||||
}
|
||||
catch (XSocketAddress& e) {
|
||||
log((CLOG_PRINT "%s: %s" BYE,
|
||||
pname, e.what(), pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
|
||||
// increase default filter level for daemon. the user must
|
||||
// explicitly request another level for a daemon.
|
||||
if (s_daemon && s_logFilter == NULL) {
|
||||
#if WINDOWS_LIKE
|
||||
if (CPlatform::isWindows95Family()) {
|
||||
// windows 95 has no place for logging so avoid showing
|
||||
// the log console window.
|
||||
s_logFilter = "FATAL";
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
s_logFilter = "NOTE";
|
||||
}
|
||||
}
|
||||
|
||||
// set log filter
|
||||
if (!CLog::setFilter(s_logFilter)) {
|
||||
log((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
|
||||
pname, s_logFilter, pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// platform dependent entry points
|
||||
//
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
|
||||
#include "CMSWindowsScreen.h"
|
||||
|
||||
static
|
||||
bool
|
||||
logMessageBox(int priority, const char* msg)
|
||||
{
|
||||
if (priority <= CLog::kFATAL) {
|
||||
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
byeThrow(int x)
|
||||
{
|
||||
throw CWin32Platform::CDaemonFailed(x);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
daemonStop(void)
|
||||
{
|
||||
s_client->exitMainLoop();
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(IPlatform* iplatform, int argc, const char** argv)
|
||||
{
|
||||
// get platform pointer
|
||||
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
|
||||
|
||||
// catch errors that would normally exit
|
||||
bye = &byeThrow;
|
||||
|
||||
// parse command line
|
||||
s_install = false;
|
||||
s_uninstall = false;
|
||||
parse(argc, argv);
|
||||
if (s_install || s_uninstall) {
|
||||
// not allowed to install/uninstall from service
|
||||
throw CWin32Platform::CDaemonFailed(kExitArgs);
|
||||
}
|
||||
|
||||
// run as a service
|
||||
return platform->runDaemon(realMain, daemonStop);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup95(IPlatform*, int, const char**)
|
||||
{
|
||||
return realMain(NULL);
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
// save instance
|
||||
CMSWindowsScreen::init(instance);
|
||||
|
||||
// get program name
|
||||
pname = platform.getBasename(__argv[0]);
|
||||
|
||||
// initialize network library
|
||||
CNetwork::init();
|
||||
|
||||
// send PRINT and FATAL output to a message box
|
||||
CLog::setOutputter(&logMessageBox);
|
||||
|
||||
// windows NT family starts services using no command line options.
|
||||
// since i'm not sure how to tell the difference between that and
|
||||
// a user providing no options we'll assume that if there are no
|
||||
// arguments and we're on NT then we're being invoked as a service.
|
||||
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
||||
// of the service code path.
|
||||
if (__argc <= 1 && !CWin32Platform::isWindows95Family()) {
|
||||
int result = platform.daemonize(DAEMON_NAME, &daemonStartup);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to start as a service" BYE, pname));
|
||||
return kExitFailed;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// parse command line
|
||||
parse(__argc, const_cast<const char**>(__argv));
|
||||
|
||||
// install/uninstall
|
||||
if (s_install) {
|
||||
// get the full path to this program
|
||||
TCHAR path[MAX_PATH];
|
||||
if (GetModuleFileName(NULL, path,
|
||||
sizeof(path) / sizeof(path[0])) == 0) {
|
||||
log((CLOG_CRIT "cannot determine absolute path to program"));
|
||||
return kExitFailed;
|
||||
}
|
||||
|
||||
// construct the command line to start the service with
|
||||
CString commandLine = "--daemon";
|
||||
if (s_restartable) {
|
||||
commandLine += " --restart";
|
||||
}
|
||||
else {
|
||||
commandLine += " --no-restart";
|
||||
}
|
||||
if (s_logFilter != NULL) {
|
||||
commandLine += " --debug ";
|
||||
commandLine += s_logFilter;
|
||||
}
|
||||
commandLine += " ";
|
||||
commandLine += s_serverAddress.getHostname().c_str();
|
||||
|
||||
// install
|
||||
if (!platform.installDaemon(DAEMON_NAME,
|
||||
"Shares this system's mouse and keyboard with others.",
|
||||
path, commandLine.c_str())) {
|
||||
log((CLOG_CRIT "failed to install service"));
|
||||
return kExitFailed;
|
||||
}
|
||||
log((CLOG_PRINT "installed successfully"));
|
||||
return kExitSuccess;
|
||||
}
|
||||
else if (s_uninstall) {
|
||||
switch (platform.uninstallDaemon(DAEMON_NAME)) {
|
||||
case IPlatform::kSuccess:
|
||||
log((CLOG_PRINT "uninstalled successfully"));
|
||||
return kExitSuccess;
|
||||
|
||||
case IPlatform::kFailed:
|
||||
log((CLOG_CRIT "failed to uninstall service"));
|
||||
return kExitFailed;
|
||||
|
||||
case IPlatform::kAlready:
|
||||
log((CLOG_CRIT "service isn't installed"));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// daemonize if requested
|
||||
int result;
|
||||
if (s_daemon) {
|
||||
// redirect log messages
|
||||
platform.installDaemonLogger(DAEMON_NAME);
|
||||
|
||||
// start as a daemon
|
||||
if (CWin32Platform::isWindows95Family()) {
|
||||
result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to start as a service" BYE, pname));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// cannot start a service from the command line so just
|
||||
// run normally (except with log messages redirected).
|
||||
result = realMain(NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// run
|
||||
result = realMain(NULL);
|
||||
}
|
||||
|
||||
CNetwork::cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif UNIX_LIKE
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(IPlatform*, int, const char**)
|
||||
{
|
||||
return realMain(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
// get program name
|
||||
pname = platform.getBasename(argv[0]);
|
||||
|
||||
// initialize network library
|
||||
CNetwork::init();
|
||||
|
||||
// parse command line
|
||||
parse(argc, const_cast<const char**>(argv));
|
||||
|
||||
// daemonize if requested
|
||||
int result;
|
||||
if (s_daemon) {
|
||||
result = platform.daemonize(DAEMON_NAME, &daemonStartup);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to daemonize"));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = realMain(NULL);
|
||||
}
|
||||
|
||||
CNetwork::cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error no main() for platform
|
||||
|
||||
#endif
|
||||
117
cmd/synergy/synergy.dsp
Normal file
117
cmd/synergy/synergy.dsp
Normal file
@@ -0,0 +1,117 @@
|
||||
# Microsoft Developer Studio Project File - Name="synergy" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=synergy - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "synergy.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "synergy.mak" CFG="synergy - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "synergy - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "synergy - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "synergy - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /I "..\platform" /I "..\..\lib\base" /I "..\..\lib\io" /I "..\..\lib\mt" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\client" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "synergy - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\lib\base" /I "..\..\lib\io" /I "..\..\lib\mt" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\client" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "synergy - Win32 Release"
|
||||
# Name "synergy - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\synergy.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\synergy.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
97
cmd/synergy/synergy.rc
Normal file
97
cmd/synergy/synergy.rc
Normal file
@@ -0,0 +1,97 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_SYNERGY DIALOG DISCARDABLE 0, 0, 329, 158
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Synergy"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_LOG,7,7,315,144,ES_MULTILINE | ES_AUTOHSCROLL |
|
||||
ES_READONLY | WS_VSCROLL | WS_HSCROLL
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_SYNERGY, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 322
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 151
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
34
cmd/synergyd/Makefile.am
Normal file
34
cmd/synergyd/Makefile.am
Normal file
@@ -0,0 +1,34 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
NULL =
|
||||
DEPTH = ../..
|
||||
|
||||
bin_PROGRAMS = synergyd
|
||||
synergyd_SOURCES = \
|
||||
synergyd.cpp \
|
||||
$(NULL)
|
||||
synergyd_LDADD = \
|
||||
$(DEPTH)/lib/server/libserver.a \
|
||||
$(DEPTH)/lib/platform/libplatform.a \
|
||||
$(DEPTH)/lib/synergy/libsynergy.a \
|
||||
$(DEPTH)/lib/net/libnet.a \
|
||||
$(DEPTH)/lib/http/libhttp.a \
|
||||
$(DEPTH)/lib/io/libio.a \
|
||||
$(DEPTH)/lib/mt/libmt.a \
|
||||
$(DEPTH)/lib/base/libbase.a \
|
||||
$(X_LIBS) \
|
||||
$(X_PRE_LIBS) \
|
||||
-lXtst \
|
||||
-lXext \
|
||||
-lX11 \
|
||||
$(X_EXTRA_LIBS) \
|
||||
$(NULL)
|
||||
INCLUDES = \
|
||||
-I$(DEPTH)/lib/base \
|
||||
-I$(DEPTH)/lib/mt \
|
||||
-I$(DEPTH)/lib/io \
|
||||
-I$(DEPTH)/lib/http \
|
||||
-I$(DEPTH)/lib/net \
|
||||
-I$(DEPTH)/lib/synergy \
|
||||
-I$(DEPTH)/lib/platform \
|
||||
-I$(DEPTH)/lib/server \
|
||||
$(NULL)
|
||||
17
cmd/synergyd/resource.h
Normal file
17
cmd/synergyd/resource.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by server.rc
|
||||
//
|
||||
#define IDD_SYNERGY 101
|
||||
#define IDC_LOG 1000
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
778
cmd/synergyd/synergyd.cpp
Normal file
778
cmd/synergyd/synergyd.cpp
Normal file
@@ -0,0 +1,778 @@
|
||||
#include "CServer.h"
|
||||
#include "CConfig.h"
|
||||
#include "CPlatform.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "Version.h"
|
||||
#include "CNetwork.h"
|
||||
#include "XSocket.h"
|
||||
#include "CLock.h"
|
||||
#include "CMutex.h"
|
||||
#include "CThread.h"
|
||||
#include "XThread.h"
|
||||
#include "CLog.h"
|
||||
#include "stdfstream.h"
|
||||
#include <cstring>
|
||||
|
||||
// platform dependent name of a daemon
|
||||
#if WINDOWS_LIKE
|
||||
#define DAEMON_NAME "Synergy Server"
|
||||
#elif UNIX_LIKE
|
||||
#define DAEMON_NAME "synergyd"
|
||||
#endif
|
||||
|
||||
// configuration file name
|
||||
#if WINDOWS_LIKE
|
||||
#define CONFIG_NAME "synergy.sgc"
|
||||
#elif UNIX_LIKE
|
||||
#define CONFIG_NAME "synergy.conf"
|
||||
#endif
|
||||
|
||||
//
|
||||
// program arguments
|
||||
//
|
||||
|
||||
static const char* pname = NULL;
|
||||
static bool s_restartable = true;
|
||||
static bool s_daemon = true;
|
||||
#if WINDOWS_LIKE
|
||||
static bool s_install = false;
|
||||
static bool s_uninstall = false;
|
||||
#endif
|
||||
static const char* s_configFile = NULL;
|
||||
static const char* s_logFilter = NULL;
|
||||
static CString s_name;
|
||||
static CNetworkAddress s_synergyAddress;
|
||||
static CNetworkAddress s_httpAddress;
|
||||
static CConfig s_config;
|
||||
|
||||
|
||||
//
|
||||
// logging thread safety
|
||||
//
|
||||
|
||||
static CMutex* s_logMutex = NULL;
|
||||
|
||||
static
|
||||
void
|
||||
logLock(bool lock)
|
||||
{
|
||||
assert(s_logMutex != NULL);
|
||||
|
||||
if (lock) {
|
||||
s_logMutex->lock();
|
||||
}
|
||||
else {
|
||||
s_logMutex->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// platform independent main
|
||||
//
|
||||
|
||||
static CServer* s_server = NULL;
|
||||
|
||||
static
|
||||
int
|
||||
realMain(CMutex* mutex)
|
||||
{
|
||||
// caller should have mutex locked on entry
|
||||
|
||||
int result = kExitSuccess;
|
||||
do {
|
||||
try {
|
||||
// initialize threading library
|
||||
CThread::init();
|
||||
|
||||
// make logging thread safe
|
||||
CMutex logMutex;
|
||||
s_logMutex = &logMutex;
|
||||
CLog::setLock(&logLock);
|
||||
|
||||
bool opened = false;
|
||||
bool locked = true;
|
||||
try {
|
||||
// if configuration has no screens then add this system
|
||||
// as the default
|
||||
if (s_config.begin() == s_config.end()) {
|
||||
s_config.addScreen(s_name);
|
||||
}
|
||||
|
||||
// set the contact address, if provided, in the config.
|
||||
// otherwise, if the config doesn't have an address, use
|
||||
// the default.
|
||||
if (s_synergyAddress.isValid()) {
|
||||
s_config.setSynergyAddress(s_synergyAddress);
|
||||
}
|
||||
else if (!s_config.getSynergyAddress().isValid()) {
|
||||
s_config.setSynergyAddress(CNetworkAddress(kDefaultPort));
|
||||
}
|
||||
|
||||
// set HTTP address if provided
|
||||
if (s_httpAddress.isValid()) {
|
||||
s_config.setHTTPAddress(s_httpAddress);
|
||||
}
|
||||
|
||||
// create server
|
||||
s_server = new CServer(s_name);
|
||||
s_server->setConfig(s_config);
|
||||
if (s_server->open()) {
|
||||
opened = true;
|
||||
|
||||
// run server (unlocked)
|
||||
if (mutex != NULL) {
|
||||
mutex->unlock();
|
||||
}
|
||||
locked = false;
|
||||
s_server->mainLoop();
|
||||
locked = true;
|
||||
if (mutex != NULL) {
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
// clean up
|
||||
s_server->close();
|
||||
}
|
||||
else {
|
||||
// wait a few seconds before retrying
|
||||
if (s_restartable) {
|
||||
CThread::sleep(3.0);
|
||||
}
|
||||
else {
|
||||
result = kExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
delete s_server;
|
||||
s_server = NULL;
|
||||
CLog::setLock(NULL);
|
||||
s_logMutex = NULL;
|
||||
}
|
||||
catch (...) {
|
||||
// clean up
|
||||
if (!locked && mutex != NULL) {
|
||||
mutex->lock();
|
||||
}
|
||||
if (s_server != NULL) {
|
||||
if (opened) {
|
||||
s_server->close();
|
||||
}
|
||||
delete s_server;
|
||||
s_server = NULL;
|
||||
}
|
||||
CLog::setLock(NULL);
|
||||
s_logMutex = NULL;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (XBase& e) {
|
||||
log((CLOG_CRIT "failed: %s", e.what()));
|
||||
}
|
||||
catch (XThread&) {
|
||||
// terminated
|
||||
return kExitTerminated;
|
||||
}
|
||||
} while (s_restartable);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// command line parsing
|
||||
//
|
||||
|
||||
#define BYE "\nTry `%s --help' for more information."
|
||||
|
||||
static void (*bye)(int) = &exit;
|
||||
|
||||
static
|
||||
void
|
||||
version()
|
||||
{
|
||||
log((CLOG_PRINT
|
||||
"%s %d.%d.%d, protocol version %d.%d\n"
|
||||
"%s",
|
||||
pname,
|
||||
kMajorVersion,
|
||||
kMinorVersion,
|
||||
kReleaseVersion,
|
||||
kProtocolMajorVersion,
|
||||
kProtocolMinorVersion,
|
||||
kCopyright));
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
help()
|
||||
{
|
||||
#if WINDOWS_LIKE
|
||||
|
||||
# define PLATFORM_ARGS \
|
||||
" {--daemon|--no-daemon}" \
|
||||
" [--install]\n" \
|
||||
"or\n" \
|
||||
" --uninstall\n"
|
||||
# define PLATFORM_DESC \
|
||||
" --install install server as a daemon.\n" \
|
||||
" --uninstall uninstall server daemon.\n"
|
||||
# define PLATFORM_EXTRA \
|
||||
"At least one command line argument is required. If you don't otherwise\n" \
|
||||
"need an argument use `--daemon'.\n" \
|
||||
"\n"
|
||||
|
||||
#else
|
||||
|
||||
# define PLATFORM_ARGS \
|
||||
" [--daemon|--no-daemon]"
|
||||
# define PLATFORM_DESC
|
||||
# define PLATFORM_EXTRA
|
||||
|
||||
#endif
|
||||
|
||||
CPlatform platform;
|
||||
|
||||
log((CLOG_PRINT
|
||||
"Usage: %s"
|
||||
" [--address <address>]"
|
||||
" [--config <pathname>]"
|
||||
" [--debug <level>]"
|
||||
" [--name <screen-name>]"
|
||||
" [--restart|--no-restart]\n"
|
||||
PLATFORM_ARGS
|
||||
"\n"
|
||||
"Start the synergy mouse/keyboard sharing server.\n"
|
||||
"\n"
|
||||
" -a, --address <address> listen for clients on the given address.\n"
|
||||
" -c, --config <pathname> use the named configuration file instead.\n"
|
||||
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
||||
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
||||
" DEBUG, DEBUG1, DEBUG2.\n"
|
||||
" -f, --no-daemon run the server in the foreground.\n"
|
||||
"* --daemon run the server as a daemon.\n"
|
||||
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
||||
" this screen in the configuration.\n"
|
||||
" -1, --no-restart do not try to restart the server if it fails for\n"
|
||||
" some reason.\n"
|
||||
"* --restart restart the server automatically if it fails.\n"
|
||||
PLATFORM_DESC
|
||||
" -h, --help display this help and exit.\n"
|
||||
" --version display version information and exit.\n"
|
||||
"\n"
|
||||
"* marks defaults.\n"
|
||||
"\n"
|
||||
PLATFORM_EXTRA
|
||||
"The argument for --address is of the form: [<hostname>][:<port>]. The\n"
|
||||
"hostname must be the address or hostname of an interface on the system.\n"
|
||||
"The default is to listen on all interfaces. The port overrides the\n"
|
||||
"default port, %d.\n"
|
||||
"\n"
|
||||
"If no configuration file pathname is provided then the first of the\n"
|
||||
"following to load sets the configuration:\n"
|
||||
" %s\n"
|
||||
" %s\n"
|
||||
"If no configuration file can be loaded then the configuration uses its\n"
|
||||
"defaults with just the server screen.\n"
|
||||
"\n"
|
||||
"Where log messages go depends on the platform and whether or not the\n"
|
||||
"server is running as a daemon.",
|
||||
pname,
|
||||
kDefaultPort,
|
||||
platform.addPathComponent(
|
||||
platform.getUserDirectory(),
|
||||
CONFIG_NAME).c_str(),
|
||||
platform.addPathComponent(
|
||||
platform.getSystemDirectory(),
|
||||
CONFIG_NAME).c_str()));
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
isArg(int argi, int argc, const char** argv,
|
||||
const char* name1, const char* name2,
|
||||
int minRequiredParameters = 0)
|
||||
{
|
||||
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
|
||||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
|
||||
// match. check args left.
|
||||
if (argi + minRequiredParameters >= argc) {
|
||||
log((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
|
||||
pname, argv[argi], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// no match
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
parse(int argc, const char** argv)
|
||||
{
|
||||
assert(pname != NULL);
|
||||
assert(argv != NULL);
|
||||
assert(argc >= 1);
|
||||
|
||||
// set defaults
|
||||
char hostname[256];
|
||||
if (CNetwork::gethostname(hostname, sizeof(hostname)) != CNetwork::Error) {
|
||||
s_name = hostname;
|
||||
}
|
||||
|
||||
// parse options
|
||||
int i;
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (isArg(i, argc, argv, "-d", "--debug", 1)) {
|
||||
// change logging level
|
||||
s_logFilter = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-a", "--address", 1)) {
|
||||
// save listen address
|
||||
try {
|
||||
s_synergyAddress = CNetworkAddress(argv[i + 1], kDefaultPort);
|
||||
}
|
||||
catch (XSocketAddress& e) {
|
||||
log((CLOG_PRINT "%s: %s" BYE,
|
||||
pname, e.what(), pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--http", 1)) {
|
||||
// save listen address
|
||||
try {
|
||||
s_httpAddress = CNetworkAddress(argv[i + 1], kDefaultPort + 1);
|
||||
}
|
||||
catch (XSocketAddress& e) {
|
||||
log((CLOG_PRINT "%s: %s" BYE,
|
||||
pname, e.what(), pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-n", "--name", 1)) {
|
||||
// save screen name
|
||||
s_name = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-c", "--config", 1)) {
|
||||
// save configuration file path
|
||||
s_configFile = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-f", "--no-daemon")) {
|
||||
// not a daemon
|
||||
s_daemon = false;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--daemon")) {
|
||||
// daemonize
|
||||
s_daemon = true;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-1", "--no-restart")) {
|
||||
// don't try to restart
|
||||
s_restartable = false;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--restart")) {
|
||||
// try to restart
|
||||
s_restartable = true;
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, "-h", "--help")) {
|
||||
help();
|
||||
bye(kExitSuccess);
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--version")) {
|
||||
version();
|
||||
bye(kExitSuccess);
|
||||
}
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
else if (isArg(i, argc, argv, NULL, "--install")) {
|
||||
s_install = true;
|
||||
if (s_uninstall) {
|
||||
log((CLOG_PRINT "%s: `--install' and `--uninstall'"
|
||||
" are mutually exclusive" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
||||
s_uninstall = true;
|
||||
if (s_install) {
|
||||
log((CLOG_PRINT "%s: `--install' and `--uninstall'"
|
||||
" are mutually exclusive" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (isArg(i, argc, argv, "--", NULL)) {
|
||||
// remaining arguments are not options
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
|
||||
else if (argv[i][0] == '-') {
|
||||
log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
|
||||
else {
|
||||
// this and remaining arguments are not options
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// no non-option arguments are allowed
|
||||
if (i != argc) {
|
||||
log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
|
||||
pname, argv[i], pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
|
||||
// increase default filter level for daemon. the user must
|
||||
// explicitly request another level for a daemon.
|
||||
if (s_daemon && s_logFilter == NULL) {
|
||||
#if WINDOWS_LIKE
|
||||
if (CPlatform::isWindows95Family()) {
|
||||
// windows 95 has no place for logging so avoid showing
|
||||
// the log console window.
|
||||
s_logFilter = "FATAL";
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
s_logFilter = "NOTE";
|
||||
}
|
||||
}
|
||||
|
||||
// set log filter
|
||||
if (!CLog::setFilter(s_logFilter)) {
|
||||
log((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
|
||||
pname, s_logFilter, pname));
|
||||
bye(kExitArgs);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
loadConfig(const char* pathname, bool require)
|
||||
{
|
||||
assert(pathname != NULL);
|
||||
|
||||
try {
|
||||
// load configuration
|
||||
log((CLOG_DEBUG "opening configuration \"%s\"", pathname));
|
||||
std::ifstream configStream(pathname);
|
||||
if (!configStream) {
|
||||
throw XConfigRead("cannot open configuration");
|
||||
}
|
||||
configStream >> s_config;
|
||||
log((CLOG_DEBUG "configuration read successfully"));
|
||||
return true;
|
||||
}
|
||||
catch (XConfigRead& e) {
|
||||
if (require) {
|
||||
log((CLOG_PRINT "%s: cannot read configuration '%s': %s",
|
||||
pname, pathname, e.what()));
|
||||
bye(kExitConfig);
|
||||
}
|
||||
else {
|
||||
log((CLOG_DEBUG "cannot read configuration \"%s\": %s",
|
||||
pathname, e.what()));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
loadConfig()
|
||||
{
|
||||
// load the config file, if specified
|
||||
if (s_configFile != NULL) {
|
||||
// require the user specified file to load correctly
|
||||
loadConfig(s_configFile, true);
|
||||
}
|
||||
|
||||
// load the default configuration if no explicit file given
|
||||
else {
|
||||
// get the user's home directory. use the effective user id
|
||||
// so a user can't get a setuid root program to load his file.
|
||||
CPlatform platform;
|
||||
bool loaded = false;
|
||||
CString path = platform.getUserDirectory();
|
||||
if (!path.empty()) {
|
||||
// complete path
|
||||
path = platform.addPathComponent(path, CONFIG_NAME);
|
||||
|
||||
// now try loading the user's configuration
|
||||
loaded = loadConfig(path.c_str(), false);
|
||||
}
|
||||
if (!loaded) {
|
||||
// try the system-wide config file
|
||||
path = platform.getSystemDirectory();
|
||||
if (!path.empty()) {
|
||||
path = platform.addPathComponent(path, CONFIG_NAME);
|
||||
loadConfig(path.c_str(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// platform dependent entry points
|
||||
//
|
||||
|
||||
#if WINDOWS_LIKE
|
||||
|
||||
#include "CMSWindowsScreen.h"
|
||||
|
||||
static
|
||||
bool
|
||||
logMessageBox(int priority, const char* msg)
|
||||
{
|
||||
if (priority <= CLog::kFATAL) {
|
||||
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
byeThrow(int x)
|
||||
{
|
||||
throw CWin32Platform::CDaemonFailed(x);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
daemonStop(void)
|
||||
{
|
||||
s_server->exitMainLoop();
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(IPlatform* iplatform, int argc, const char** argv)
|
||||
{
|
||||
// get platform pointer
|
||||
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
|
||||
|
||||
// catch errors that would normally exit
|
||||
bye = &byeThrow;
|
||||
|
||||
// parse command line
|
||||
s_install = false;
|
||||
s_uninstall = false;
|
||||
parse(argc, argv);
|
||||
if (s_install || s_uninstall) {
|
||||
// not allowed to install/uninstall from service
|
||||
throw CWin32Platform::CDaemonFailed(kExitArgs);
|
||||
}
|
||||
|
||||
// load configuration
|
||||
loadConfig();
|
||||
|
||||
// run as a service
|
||||
return platform->runDaemon(realMain, daemonStop);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup95(IPlatform*, int, const char**)
|
||||
{
|
||||
return realMain(NULL);
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
// save instance
|
||||
CMSWindowsScreen::init(instance);
|
||||
|
||||
// get program name
|
||||
pname = platform.getBasename(__argv[0]);
|
||||
|
||||
// initialize network library
|
||||
CNetwork::init();
|
||||
|
||||
// send PRINT and FATAL output to a message box
|
||||
CLog::setOutputter(&logMessageBox);
|
||||
|
||||
// windows NT family starts services using no command line options.
|
||||
// since i'm not sure how to tell the difference between that and
|
||||
// a user providing no options we'll assume that if there are no
|
||||
// arguments and we're on NT then we're being invoked as a service.
|
||||
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
||||
// of the service code path.
|
||||
if (__argc <= 1 && !CWin32Platform::isWindows95Family()) {
|
||||
int result = platform.daemonize(DAEMON_NAME, &daemonStartup);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to start as a service" BYE, pname));
|
||||
return kExitFailed;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// parse command line
|
||||
parse(__argc, const_cast<const char**>(__argv));
|
||||
|
||||
// install/uninstall
|
||||
if (s_install) {
|
||||
// get the full path to this program
|
||||
TCHAR path[MAX_PATH];
|
||||
if (GetModuleFileName(NULL, path,
|
||||
sizeof(path) / sizeof(path[0])) == 0) {
|
||||
log((CLOG_CRIT "cannot determine absolute path to program"));
|
||||
return kExitFailed;
|
||||
}
|
||||
|
||||
// construct the command line to start the service with
|
||||
CString commandLine;
|
||||
commandLine += "--daemon";
|
||||
if (s_restartable) {
|
||||
commandLine += " --restart";
|
||||
}
|
||||
else {
|
||||
commandLine += " --no-restart";
|
||||
}
|
||||
if (s_logFilter != NULL) {
|
||||
commandLine += " --debug ";
|
||||
commandLine += s_logFilter;
|
||||
}
|
||||
if (s_configFile != NULL) {
|
||||
commandLine += " --config \"";
|
||||
commandLine += s_configFile;
|
||||
commandLine += "\"";
|
||||
}
|
||||
|
||||
// install
|
||||
if (!platform.installDaemon(DAEMON_NAME,
|
||||
"Shares this system's mouse and keyboard with others.",
|
||||
path, commandLine.c_str())) {
|
||||
log((CLOG_CRIT "failed to install service"));
|
||||
return kExitFailed;
|
||||
}
|
||||
log((CLOG_PRINT "installed successfully"));
|
||||
return kExitSuccess;
|
||||
}
|
||||
else if (s_uninstall) {
|
||||
switch (platform.uninstallDaemon(DAEMON_NAME)) {
|
||||
case IPlatform::kSuccess:
|
||||
log((CLOG_PRINT "uninstalled successfully"));
|
||||
return kExitSuccess;
|
||||
|
||||
case IPlatform::kFailed:
|
||||
log((CLOG_CRIT "failed to uninstall service"));
|
||||
return kExitFailed;
|
||||
|
||||
case IPlatform::kAlready:
|
||||
log((CLOG_CRIT "service isn't installed"));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// load configuration
|
||||
loadConfig();
|
||||
|
||||
// daemonize if requested
|
||||
int result;
|
||||
if (s_daemon) {
|
||||
// redirect log messages
|
||||
platform.installDaemonLogger(DAEMON_NAME);
|
||||
|
||||
// start as a daemon
|
||||
if (CWin32Platform::isWindows95Family()) {
|
||||
result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to start as a service" BYE, pname));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// cannot start a service from the command line so just
|
||||
// run normally (except with log messages redirected).
|
||||
result = realMain(NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// run
|
||||
result = realMain(NULL);
|
||||
}
|
||||
|
||||
CNetwork::cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif UNIX_LIKE
|
||||
|
||||
static
|
||||
int
|
||||
daemonStartup(IPlatform*, int, const char**)
|
||||
{
|
||||
return realMain(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
CPlatform platform;
|
||||
|
||||
// get program name
|
||||
pname = platform.getBasename(argv[0]);
|
||||
|
||||
// initialize network library
|
||||
CNetwork::init();
|
||||
|
||||
// parse command line
|
||||
parse(argc, const_cast<const char**>(argv));
|
||||
|
||||
// load configuration
|
||||
loadConfig();
|
||||
|
||||
// daemonize if requested
|
||||
int result;
|
||||
if (s_daemon) {
|
||||
result = platform.daemonize(DAEMON_NAME, &daemonStartup);
|
||||
if (result == -1) {
|
||||
log((CLOG_CRIT "failed to daemonize"));
|
||||
return kExitFailed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = realMain(NULL);
|
||||
}
|
||||
|
||||
CNetwork::cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error no main() for platform
|
||||
|
||||
#endif
|
||||
117
cmd/synergyd/synergyd.dsp
Normal file
117
cmd/synergyd/synergyd.dsp
Normal file
@@ -0,0 +1,117 @@
|
||||
# Microsoft Developer Studio Project File - Name="synergyd" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=synergyd - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "synergyd.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "synergyd.mak" CFG="synergyd - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "synergyd - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "synergyd - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "synergyd - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\..\lib\base" /I "..\..\lib\mt" /I "..\..\lib\io" /I "..\..\lib\http" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\server" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "synergyd - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\lib\base" /I "..\..\lib\mt" /I "..\..\lib\io" /I "..\..\lib\http" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\server" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "synergyd - Win32 Release"
|
||||
# Name "synergyd - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\synergyd.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\synergyd.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
97
cmd/synergyd/synergyd.rc
Normal file
97
cmd/synergyd/synergyd.rc
Normal file
@@ -0,0 +1,97 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_SYNERGY DIALOG DISCARDABLE 0, 0, 531, 159
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Synergy"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_LOG,7,7,517,145,ES_MULTILINE | ES_AUTOHSCROLL |
|
||||
ES_READONLY | WS_VSCROLL | WS_HSCROLL
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_SYNERGY, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 524
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 152
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Reference in New Issue
Block a user