Adam Ierymenko vor 6 Jahren
Ursprung
Commit
27c8eb0d6d

+ 14 - 1
windows/ZeroTierOne/ZeroTierOne.vcxproj

@@ -113,7 +113,20 @@
     <ClCompile Include="..\..\service\SoftwareUpdater.cpp" />
     <ClCompile Include="ServiceBase.cpp" />
     <ClCompile Include="ServiceInstaller.cpp" />
-    <ClCompile Include="ZeroTierOneService.cpp" />
+    <ClCompile Include="ZeroTierOneService.cpp">
+      <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</FunctionLevelLinking>
+      <EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnableParallelCodeGeneration>
+      <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</FunctionLevelLinking>
+      <EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</EnableParallelCodeGeneration>
+      <EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+      <EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NoExtensions</EnableEnhancedInstructionSet>
+      <FloatingPointExceptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</FloatingPointExceptions>
+      <CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CreateHotpatchableImage>
+      <FloatingPointExceptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</FloatingPointExceptions>
+      <CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CreateHotpatchableImage>
+      <EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+      <EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NoExtensions</EnableEnhancedInstructionSet>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\controller\DB.hpp" />

+ 8 - 4
windows/ZeroTierOne/ZeroTierOneService.cpp

@@ -76,9 +76,7 @@ restart_node:
 			ZeroTier::Mutex::Lock _l(_lock);
 			delete _service;
 			_service = (ZeroTier::OneService *)0; // in case newInstance() fails
-			_service = ZeroTier::OneService::newInstance(
-				ZeroTier::OneService::platformDefaultHomePath().c_str(),
-				ZT_DEFAULT_PORT);
+			_service = ZeroTier::OneService::newInstance(_path.c_str(), ZT_DEFAULT_PORT);
 		}
 		switch(_service->run()) {
 			case ZeroTier::OneService::ONE_UNRECOVERABLE_ERROR: {
@@ -120,10 +118,16 @@ restart_node:
 	}
 }
 
-void ZeroTierOneService::OnStart(DWORD dwArgc, LPSTR *lpszArgv)
+void ZeroTierOneService::OnStart(DWORD dwArgc, PSTR *lpszArgv)
 {
 	ZT_SVCDBG("ZeroTierOneService::OnStart()\r\n");
 
+	if ((dwArgc > 1)&&(lpszArgv[1])&&(strlen(lpszArgv[1]) > 0)) {
+		this->_path = lpszArgv[1];
+	} else {
+		this->_path = ZeroTier::OneService::platformDefaultHomePath();
+	}
+
 	try {
 		_thread = ZeroTier::Thread::start(this);
 	} catch ( ... ) {

+ 3 - 2
windows/ZeroTierOne/ZeroTierOneService.h

@@ -57,11 +57,12 @@ public:
 		throw();
 
 protected:
-    virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
-    virtual void OnStop();
+	virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
+	virtual void OnStop();
 	virtual void OnShutdown();
 
 private:
+	std::string _path;
 	ZeroTier::OneService *volatile _service;
 	ZeroTier::Mutex _lock;
 	ZeroTier::Thread _thread;