Windows service works now!

This commit is contained in:
Adam Ierymenko 2014-02-27 16:28:55 -08:00
parent cbeb9c5236
commit 9d05897f7a
7 changed files with 246 additions and 78 deletions

View file

@ -27,6 +27,8 @@
#pragma once
#include <stdio.h>
#include "ServiceBase.h"
#include <string>
@ -37,11 +39,23 @@
#include "../../node/Mutex.hpp"
#include "../../node/Utils.hpp"
// Uncomment to make debugging Windows services suck slightly less hard.
//#define ZT_DEBUG_SERVICE "C:\\ZeroTierOneServiceDebugLog.txt"
#ifdef ZT_DEBUG_SERVICE
extern FILE *SVCDBGfile;
extern ZeroTier::Mutex SVCDBGfile_m;
#define ZT_SVCDBG(f,...) { SVCDBGfile_m.lock(); fprintf(SVCDBGfile,f,##__VA_ARGS__); fflush(SVCDBGfile); SVCDBGfile_m.unlock(); }
#else
#define ZT_SVCDBG(f,...) {}
#endif
#define ZT_SERVICE_NAME "ZeroTierOneService"
#define ZT_SERVICE_DISPLAY_NAME "ZeroTier One"
#define ZT_SERVICE_START_TYPE SERVICE_AUTO_START
#define ZT_SERVICE_DEPENDENCIES ""
#define ZT_SERVICE_ACCOUNT "NT AUTHORITY\\LocalService"
//#define ZT_SERVICE_ACCOUNT "NT AUTHORITY\\LocalService"
#define ZT_SERVICE_ACCOUNT NULL
#define ZT_SERVICE_PASSWORD NULL
class ZeroTierOneService : public CServiceBase