From 487eb17ec075dd2bdc91f78b41577b070d90f8f5 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 26 Aug 2013 17:22:20 -0400 Subject: ZeroTierOne for Windows binary project, builds and runs and mostly works but still some issues with tap. --- main.cpp | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index ed1ca19c..b0713da8 100644 --- a/main.cpp +++ b/main.cpp @@ -30,14 +30,17 @@ #include #include #include + #include #include -#include #include "node/Constants.hpp" #ifdef __WINDOWS__ +#include #include +#include +#include #else #include #include @@ -48,8 +51,10 @@ #include -#include "node/Node.hpp" +#include "node/Constants.hpp" +#include "node/Defaults.hpp" #include "node/Utils.hpp" +#include "node/Node.hpp" #include "launcher.h" @@ -89,10 +94,10 @@ static Node *node = (Node *)0; static void printHelp(const char *cn,FILE *out) { - fprintf(out,"ZeroTier One version %d.%d.%d\n(c)2012-2013 ZeroTier Networks LLC\nLicensed under the GNU General Public License v3\n\nUsage: %s \n",Node::versionMajor(),Node::versionMinor(),Node::versionRevision(),cn); + fprintf(out,"ZeroTier One version %d.%d.%d"ZT_EOL_S"(c)2012-2013 ZeroTier Networks LLC"ZT_EOL_S"Licensed under the GNU General Public License v3"ZT_EOL_S""ZT_EOL_S"Usage: %s [home directory]"ZT_EOL_S,Node::versionMajor(),Node::versionMinor(),Node::versionRevision(),cn); } -#ifndef _WIN32 +#ifdef __UNIX_LIKE__ static void sighandlerQuit(int sig) { Node *n = node; @@ -102,9 +107,13 @@ static void sighandlerQuit(int sig) } #endif +#ifdef __WINDOWS__ +int _tmain(int argc, _TCHAR* argv[]) +#else int main(int argc,char **argv) +#endif { -#ifndef _WIN32 +#ifdef __UNIX_LIKE__ signal(SIGHUP,SIG_IGN); signal(SIGPIPE,SIG_IGN); signal(SIGUSR1,SIG_IGN); @@ -115,17 +124,19 @@ int main(int argc,char **argv) signal(SIGQUIT,&sighandlerQuit); #endif - _initLibCrypto(); +#ifdef __WINDOWS__ + WSADATA wsaData; + WSAStartup(MAKEWORD(2,2),&wsaData); +#endif - if (argc < 2) { - printHelp(argv[0],stderr); - return ZT_EXEC_RETURN_VALUE_NORMAL_TERMINATION; - } + _initLibCrypto(); const char *homeDir = (const char *)0; for(int i=1;i