First Commit
/ build_macos (push) Has been cancelled
/ build_windows (push) Has been cancelled
/ build_ubuntu (push) Has been cancelled

This commit is contained in:
2025-11-19 16:23:45 +07:00
commit dbdc5bcc4a
1791 changed files with 489451 additions and 0 deletions
+563
View File
@@ -0,0 +1,563 @@
/****************************** Module Header ******************************\
* Module Name: ServiceBase.cpp
* Project: CppWindowsService
* Copyright (c) Microsoft Corporation.
*
* Provides a base class for a service that will exist as part of a service
* application. CServiceBase must be derived from when creating a new service
* class.
*
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
* All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
#pragma region Includes
#include "ServiceBase.h"
#include <assert.h>
#include <strsafe.h>
#include <string>
#pragma endregion
#pragma region Static Members
// Initialize the singleton service instance.
CServiceBase *CServiceBase::s_service = NULL;
//
// FUNCTION: CServiceBase::Run(CServiceBase &)
//
// PURPOSE: Register the executable for a service with the Service Control
// Manager (SCM). After you call Run(ServiceBase), the SCM issues a Start
// command, which results in a call to the OnStart method in the service.
// This method blocks until the service has stopped.
//
// PARAMETERS:
// * service - the reference to a CServiceBase object. It will become the
// singleton service instance of this service application.
//
// RETURN VALUE: If the function succeeds, the return value is TRUE. If the
// function fails, the return value is FALSE. To get extended error
// information, call GetLastError.
//
BOOL CServiceBase::Run(CServiceBase &service)
{
s_service = &service;
SERVICE_TABLE_ENTRYA serviceTable[] =
{
{ service.m_name, ServiceMain },
{ NULL, NULL }
};
// Connects the main thread of a service process to the service control
// manager, which causes the thread to be the service control dispatcher
// thread for the calling process. This call returns when the service has
// stopped. The process should simply terminate when the call returns.
return StartServiceCtrlDispatcher(serviceTable);
}
//
// FUNCTION: CServiceBase::ServiceMain(DWORD, PWSTR *)
//
// PURPOSE: Entry point for the service. It registers the handler function
// for the service and starts the service.
//
// PARAMETERS:
// * dwArgc - number of command line arguments
// * lpszArgv - array of command line arguments
//
void WINAPI CServiceBase::ServiceMain(DWORD dwArgc, PSTR *pszArgv)
{
assert(s_service != NULL);
// Register the handler function for the service
s_service->m_statusHandle = RegisterServiceCtrlHandler(
s_service->m_name, ServiceCtrlHandler);
if (s_service->m_statusHandle == NULL)
{
throw GetLastError();
}
// Start the service.
s_service->Start(dwArgc, pszArgv);
}
//
// FUNCTION: CServiceBase::ServiceCtrlHandler(DWORD)
//
// PURPOSE: The function is called by the SCM whenever a control code is
// sent to the service.
//
// PARAMETERS:
// * dwCtrlCode - the control code. This parameter can be one of the
// following values:
//
// SERVICE_CONTROL_CONTINUE
// SERVICE_CONTROL_INTERROGATE
// SERVICE_CONTROL_NETBINDADD
// SERVICE_CONTROL_NETBINDDISABLE
// SERVICE_CONTROL_NETBINDREMOVE
// SERVICE_CONTROL_PARAMCHANGE
// SERVICE_CONTROL_PAUSE
// SERVICE_CONTROL_SHUTDOWN
// SERVICE_CONTROL_STOP
//
// This parameter can also be a user-defined control code ranges from 128
// to 255.
//
void WINAPI CServiceBase::ServiceCtrlHandler(DWORD dwCtrl)
{
switch (dwCtrl)
{
case SERVICE_CONTROL_STOP: s_service->Stop(); break;
case SERVICE_CONTROL_PAUSE: s_service->Pause(); break;
case SERVICE_CONTROL_CONTINUE: s_service->Continue(); break;
case SERVICE_CONTROL_SHUTDOWN: s_service->Shutdown(); break;
case SERVICE_CONTROL_INTERROGATE: break;
default: break;
}
}
#pragma endregion
#pragma region Service Constructor and Destructor
//
// FUNCTION: CServiceBase::CServiceBase(PWSTR, BOOL, BOOL, BOOL)
//
// PURPOSE: The constructor of CServiceBase. It initializes a new instance
// of the CServiceBase class. The optional parameters (fCanStop,
/// fCanShutdown and fCanPauseContinue) allow you to specify whether the
// service can be stopped, paused and continued, or be notified when system
// shutdown occurs.
//
// PARAMETERS:
// * pszServiceName - the name of the service
// * fCanStop - the service can be stopped
// * fCanShutdown - the service is notified when system shutdown occurs
// * fCanPauseContinue - the service can be paused and continued
//
CServiceBase::CServiceBase(PSTR pszServiceName,
BOOL fCanStop,
BOOL fCanShutdown,
BOOL fCanPauseContinue)
{
// Service name must be a valid string and cannot be NULL.
m_name = (pszServiceName == NULL) ? "" : pszServiceName;
m_statusHandle = NULL;
// The service runs in its own process.
m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
// The service is starting.
m_status.dwCurrentState = SERVICE_START_PENDING;
// The accepted commands of the service.
DWORD dwControlsAccepted = 0;
if (fCanStop)
dwControlsAccepted |= SERVICE_ACCEPT_STOP;
if (fCanShutdown)
dwControlsAccepted |= SERVICE_ACCEPT_SHUTDOWN;
if (fCanPauseContinue)
dwControlsAccepted |= SERVICE_ACCEPT_PAUSE_CONTINUE;
m_status.dwControlsAccepted = dwControlsAccepted;
m_status.dwWin32ExitCode = NO_ERROR;
m_status.dwServiceSpecificExitCode = 0;
m_status.dwCheckPoint = 0;
m_status.dwWaitHint = 0;
}
//
// FUNCTION: CServiceBase::~CServiceBase()
//
// PURPOSE: The virtual destructor of CServiceBase.
//
CServiceBase::~CServiceBase(void)
{
}
#pragma endregion
#pragma region Service Start, Stop, Pause, Continue, and Shutdown
//
// FUNCTION: CServiceBase::Start(DWORD, PWSTR *)
//
// PURPOSE: The function starts the service. It calls the OnStart virtual
// function in which you can specify the actions to take when the service
// starts. If an error occurs during the startup, the error will be logged
// in the Application event log, and the service will be stopped.
//
// PARAMETERS:
// * dwArgc - number of command line arguments
// * lpszArgv - array of command line arguments
//
void CServiceBase::Start(DWORD dwArgc, PSTR *pszArgv)
{
try
{
// Tell SCM that the service is starting.
SetServiceStatus(SERVICE_START_PENDING);
// Perform service-specific initialization.
OnStart(dwArgc, pszArgv);
// Tell SCM that the service is started.
SetServiceStatus(SERVICE_RUNNING);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry("Service Start", dwError);
// Set the service status to be stopped.
SetServiceStatus(SERVICE_STOPPED, dwError);
}
catch (...)
{
// Log the error.
WriteEventLogEntry("Service failed to start.", EVENTLOG_ERROR_TYPE);
// Set the service status to be stopped.
SetServiceStatus(SERVICE_STOPPED);
}
}
//
// FUNCTION: CServiceBase::OnStart(DWORD, PWSTR *)
//
// PURPOSE: When implemented in a derived class, executes when a Start
// command is sent to the service by the SCM or when the operating system
// starts (for a service that starts automatically). Specifies actions to
// take when the service starts. Be sure to periodically call
// CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the
// procedure is going to take long time. You may also consider spawning a
// new thread in OnStart to perform time-consuming initialization tasks.
//
// PARAMETERS:
// * dwArgc - number of command line arguments
// * lpszArgv - array of command line arguments
//
void CServiceBase::OnStart(DWORD dwArgc, PSTR *pszArgv)
{
}
//
// FUNCTION: CServiceBase::Stop()
//
// PURPOSE: The function stops the service. It calls the OnStop virtual
// function in which you can specify the actions to take when the service
// stops. If an error occurs, the error will be logged in the Application
// event log, and the service will be restored to the original state.
//
void CServiceBase::Stop()
{
DWORD dwOriginalState = m_status.dwCurrentState;
try
{
// Tell SCM that the service is stopping.
SetServiceStatus(SERVICE_STOP_PENDING);
// Perform service-specific stop operations.
OnStop();
// Tell SCM that the service is stopped.
SetServiceStatus(SERVICE_STOPPED);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry("Service Stop", dwError);
// Set the orginal service status.
SetServiceStatus(dwOriginalState);
}
catch (...)
{
// Log the error.
WriteEventLogEntry("Service failed to stop.", EVENTLOG_ERROR_TYPE);
// Set the orginal service status.
SetServiceStatus(dwOriginalState);
}
}
//
// FUNCTION: CServiceBase::OnStop()
//
// PURPOSE: When implemented in a derived class, executes when a Stop
// command is sent to the service by the SCM. Specifies actions to take
// when a service stops running. Be sure to periodically call
// CServiceBase::SetServiceStatus() with SERVICE_STOP_PENDING if the
// procedure is going to take long time.
//
void CServiceBase::OnStop()
{
}
//
// FUNCTION: CServiceBase::Pause()
//
// PURPOSE: The function pauses the service if the service supports pause
// and continue. It calls the OnPause virtual function in which you can
// specify the actions to take when the service pauses. If an error occurs,
// the error will be logged in the Application event log, and the service
// will become running.
//
void CServiceBase::Pause()
{
try
{
// Tell SCM that the service is pausing.
SetServiceStatus(SERVICE_PAUSE_PENDING);
// Perform service-specific pause operations.
OnPause();
// Tell SCM that the service is paused.
SetServiceStatus(SERVICE_PAUSED);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry("Service Pause", dwError);
// Tell SCM that the service is still running.
SetServiceStatus(SERVICE_RUNNING);
}
catch (...)
{
// Log the error.
WriteEventLogEntry("Service failed to pause.", EVENTLOG_ERROR_TYPE);
// Tell SCM that the service is still running.
SetServiceStatus(SERVICE_RUNNING);
}
}
//
// FUNCTION: CServiceBase::OnPause()
//
// PURPOSE: When implemented in a derived class, executes when a Pause
// command is sent to the service by the SCM. Specifies actions to take
// when a service pauses.
//
void CServiceBase::OnPause()
{
}
//
// FUNCTION: CServiceBase::Continue()
//
// PURPOSE: The function resumes normal functioning after being paused if
// the service supports pause and continue. It calls the OnContinue virtual
// function in which you can specify the actions to take when the service
// continues. If an error occurs, the error will be logged in the
// Application event log, and the service will still be paused.
//
void CServiceBase::Continue()
{
try
{
// Tell SCM that the service is resuming.
SetServiceStatus(SERVICE_CONTINUE_PENDING);
// Perform service-specific continue operations.
OnContinue();
// Tell SCM that the service is running.
SetServiceStatus(SERVICE_RUNNING);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry("Service Continue", dwError);
// Tell SCM that the service is still paused.
SetServiceStatus(SERVICE_PAUSED);
}
catch (...)
{
// Log the error.
WriteEventLogEntry("Service failed to resume.", EVENTLOG_ERROR_TYPE);
// Tell SCM that the service is still paused.
SetServiceStatus(SERVICE_PAUSED);
}
}
//
// FUNCTION: CServiceBase::OnContinue()
//
// PURPOSE: When implemented in a derived class, OnContinue runs when a
// Continue command is sent to the service by the SCM. Specifies actions to
// take when a service resumes normal functioning after being paused.
//
void CServiceBase::OnContinue()
{
}
//
// FUNCTION: CServiceBase::Shutdown()
//
// PURPOSE: The function executes when the system is shutting down. It
// calls the OnShutdown virtual function in which you can specify what
// should occur immediately prior to the system shutting down. If an error
// occurs, the error will be logged in the Application event log.
//
void CServiceBase::Shutdown()
{
try
{
// Perform service-specific shutdown operations.
OnShutdown();
// Tell SCM that the service is stopped.
SetServiceStatus(SERVICE_STOPPED);
}
catch (DWORD dwError)
{
// Log the error.
WriteErrorLogEntry("Service Shutdown", dwError);
}
catch (...)
{
// Log the error.
WriteEventLogEntry("Service failed to shut down.", EVENTLOG_ERROR_TYPE);
}
}
//
// FUNCTION: CServiceBase::OnShutdown()
//
// PURPOSE: When implemented in a derived class, executes when the system
// is shutting down. Specifies what should occur immediately prior to the
// system shutting down.
//
void CServiceBase::OnShutdown()
{
}
#pragma endregion
#pragma region Helper Functions
//
// FUNCTION: CServiceBase::SetServiceStatus(DWORD, DWORD, DWORD)
//
// PURPOSE: The function sets the service status and reports the status to
// the SCM.
//
// PARAMETERS:
// * dwCurrentState - the state of the service
// * dwWin32ExitCode - error code to report
// * dwWaitHint - estimated time for pending operation, in milliseconds
//
void CServiceBase::SetServiceStatus(DWORD dwCurrentState,
DWORD dwWin32ExitCode,
DWORD dwWaitHint)
{
static DWORD dwCheckPoint = 1;
// Fill in the SERVICE_STATUS structure of the service.
m_status.dwCurrentState = dwCurrentState;
m_status.dwWin32ExitCode = dwWin32ExitCode;
m_status.dwWaitHint = dwWaitHint;
m_status.dwCheckPoint =
((dwCurrentState == SERVICE_RUNNING) ||
(dwCurrentState == SERVICE_STOPPED)) ?
0 : dwCheckPoint++;
// Report the status of the service to the SCM.
::SetServiceStatus(m_statusHandle, &m_status);
}
//
// FUNCTION: CServiceBase::WriteEventLogEntry(PWSTR, WORD)
//
// PURPOSE: Log a message to the Application event log.
//
// PARAMETERS:
// * pszMessage - string message to be logged.
// * wType - the type of event to be logged. The parameter can be one of
// the following values.
//
// EVENTLOG_SUCCESS
// EVENTLOG_AUDIT_FAILURE
// EVENTLOG_AUDIT_SUCCESS
// EVENTLOG_ERROR_TYPE
// EVENTLOG_INFORMATION_TYPE
// EVENTLOG_WARNING_TYPE
//
void CServiceBase::WriteEventLogEntry(PSTR pszMessage, WORD wType)
{
HANDLE hEventSource = NULL;
LPCSTR lpszStrings[2] = { NULL, NULL };
hEventSource = RegisterEventSource(NULL, m_name);
if (hEventSource)
{
lpszStrings[0] = m_name;
lpszStrings[1] = pszMessage;
ReportEvent(hEventSource, // Event log handle
wType, // Event type
0, // Event category
0, // Event identifier
NULL, // No security identifier
2, // Size of lpszStrings array
0, // No binary data
lpszStrings, // Array of strings
NULL // No binary data
);
DeregisterEventSource(hEventSource);
}
}
//
// FUNCTION: CServiceBase::WriteErrorLogEntry(PWSTR, DWORD)
//
// PURPOSE: Log an error message to the Application event log.
//
// PARAMETERS:
// * pszFunction - the function that gives the error
// * dwError - the error code
//
void CServiceBase::WriteErrorLogEntry(PSTR pszFunction, DWORD dwError)
{
char szMessage[260];
StringCchPrintf(szMessage, ARRAYSIZE(szMessage),
"%s failed w/err 0x%08lx", pszFunction, dwError);
WriteEventLogEntry(szMessage, EVENTLOG_ERROR_TYPE);
}
#pragma endregion
+122
View File
@@ -0,0 +1,122 @@
/****************************** Module Header ******************************\
* Module Name: ServiceBase.h
* Project: CppWindowsService
* Copyright (c) Microsoft Corporation.
*
* Provides a base class for a service that will exist as part of a service
* application. CServiceBase must be derived from when creating a new service
* class.
*
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
* All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
#pragma once
#include <winsock2.h>
#include <windows.h>
class CServiceBase
{
public:
// Register the executable for a service with the Service Control Manager
// (SCM). After you call Run(ServiceBase), the SCM issues a Start command,
// which results in a call to the OnStart method in the service. This
// method blocks until the service has stopped.
static BOOL Run(CServiceBase &service);
// Service object constructor. The optional parameters (fCanStop,
// fCanShutdown and fCanPauseContinue) allow you to specify whether the
// service can be stopped, paused and continued, or be notified when
// system shutdown occurs.
CServiceBase(LPSTR pszServiceName,
BOOL fCanStop = TRUE,
BOOL fCanShutdown = TRUE,
BOOL fCanPauseContinue = FALSE);
// Service object destructor.
virtual ~CServiceBase(void);
// Stop the service.
void Stop();
protected:
// When implemented in a derived class, executes when a Start command is
// sent to the service by the SCM or when the operating system starts
// (for a service that starts automatically). Specifies actions to take
// when the service starts.
virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
// When implemented in a derived class, executes when a Stop command is
// sent to the service by the SCM. Specifies actions to take when a
// service stops running.
virtual void OnStop();
// When implemented in a derived class, executes when a Pause command is
// sent to the service by the SCM. Specifies actions to take when a
// service pauses.
virtual void OnPause();
// When implemented in a derived class, OnContinue runs when a Continue
// command is sent to the service by the SCM. Specifies actions to take
// when a service resumes normal functioning after being paused.
virtual void OnContinue();
// When implemented in a derived class, executes when the system is
// shutting down. Specifies what should occur immediately prior to the
// system shutting down.
virtual void OnShutdown();
// Set the service status and report the status to the SCM.
void SetServiceStatus(DWORD dwCurrentState,
DWORD dwWin32ExitCode = NO_ERROR,
DWORD dwWaitHint = 0);
// Log a message to the Application event log.
void WriteEventLogEntry(PSTR pszMessage, WORD wType);
// Log an error message to the Application event log.
void WriteErrorLogEntry(PSTR pszFunction,
DWORD dwError = GetLastError());
private:
// Entry point for the service. It registers the handler function for the
// service and starts the service.
static void WINAPI ServiceMain(DWORD dwArgc, LPSTR *lpszArgv);
// The function is called by the SCM whenever a control code is sent to
// the service.
static void WINAPI ServiceCtrlHandler(DWORD dwCtrl);
// Start the service.
void Start(DWORD dwArgc, PSTR *pszArgv);
// Pause the service.
void Pause();
// Resume the service after being paused.
void Continue();
// Execute when the system is shutting down.
void Shutdown();
// The singleton service instance.
static CServiceBase *s_service;
// The name of the service
LPSTR m_name;
// The status of the service
SERVICE_STATUS m_status;
// The service status handle
SERVICE_STATUS_HANDLE m_statusHandle;
};
+197
View File
@@ -0,0 +1,197 @@
/****************************** Module Header ******************************\
* Module Name: ServiceInstaller.cpp
* Project: CppWindowsService
* Copyright (c) Microsoft Corporation.
*
* The file implements functions that install and uninstall the service.
*
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
* All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
#pragma region "Includes"
#include <stdio.h>
#include <windows.h>
#include "ServiceInstaller.h"
#pragma endregion
//
// FUNCTION: InstallService
//
// PURPOSE: Install the current application as a service to the local
// service control manager database.
//
// PARAMETERS:
// * pszServiceName - the name of the service to be installed
// * pszDisplayName - the display name of the service
// * dwStartType - the service start option. This parameter can be one of
// the following values: SERVICE_AUTO_START, SERVICE_BOOT_START,
// SERVICE_DEMAND_START, SERVICE_DISABLED, SERVICE_SYSTEM_START.
// * pszDependencies - a pointer to a double null-terminated array of null-
// separated names of services or load ordering groups that the system
// must start before this service.
// * pszAccount - the name of the account under which the service runs.
// * pszPassword - the password to the account name.
//
// NOTE: If the function fails to install the service, it prints the error
// in the standard output stream for users to diagnose the problem.
//
std::string InstallService(PSTR pszServiceName,
PSTR pszDisplayName,
DWORD dwStartType,
PSTR pszDependencies,
PSTR pszAccount,
PSTR pszPassword)
{
std::string ret;
std::string path(0x7FFF, '\0');
SC_HANDLE schSCManager = NULL;
SC_HANDLE schService = NULL;
SERVICE_DESCRIPTION sd;
LPTSTR szDesc = TEXT("ZeroTier network virtualization service.");
DWORD dwCharacters = GetModuleFileName(NULL, path.data(), path.size());
if (dwCharacters == 0)
{
ret = "GetModuleFileName failed, unable to get path to self";
goto Cleanup;
}
// Trim excess nulls which the returned size does not include
path.resize(dwCharacters);
// Quote path in case it contains spaces
path = '"' + path + '"';
// Open the local default service control manager database
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT |
SC_MANAGER_CREATE_SERVICE);
if (schSCManager == NULL)
{
ret = "OpenSCManager failed";
goto Cleanup;
}
// Install the service into SCM by calling CreateService
schService = CreateService(
schSCManager, // SCManager database
pszServiceName, // Name of service
pszDisplayName, // Name to display
SERVICE_ALL_ACCESS, // Desired access
SERVICE_WIN32_OWN_PROCESS, // Service type
dwStartType, // Service start type
SERVICE_ERROR_NORMAL, // Error control type
path.c_str(), // Service's binary
NULL, // No load ordering group
NULL, // No tag identifier
pszDependencies, // Dependencies
pszAccount, // Service running account
pszPassword // Password of the account
);
if (schService == NULL)
{
ret = "CreateService failed";
goto Cleanup;
}
// Setup service description
sd.lpDescription = szDesc;
ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd);
Cleanup:
// Centralized cleanup for all allocated resources.
if (schSCManager)
{
CloseServiceHandle(schSCManager);
schSCManager = NULL;
}
if (schService)
{
CloseServiceHandle(schService);
schService = NULL;
}
return ret;
}
//
// FUNCTION: UninstallService
//
// PURPOSE: Stop and remove the service from the local service control
// manager database.
//
// PARAMETERS:
// * pszServiceName - the name of the service to be removed.
//
// NOTE: If the function fails to uninstall the service, it prints the
// error in the standard output stream for users to diagnose the problem.
//
std::string UninstallService(PSTR pszServiceName)
{
std::string ret;
SC_HANDLE schSCManager = NULL;
SC_HANDLE schService = NULL;
SERVICE_STATUS ssSvcStatus = {};
// Open the local default service control manager database
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (schSCManager == NULL)
{
ret = "OpenSCManager failed";
goto Cleanup;
}
// Open the service with delete, stop, and query status permissions
schService = OpenService(schSCManager, pszServiceName, SERVICE_STOP |
SERVICE_QUERY_STATUS | DELETE);
if (schService == NULL)
{
ret = "OpenService failed (is service installed?)";
goto Cleanup;
}
// Try to stop the service
if (ControlService(schService, SERVICE_CONTROL_STOP, &ssSvcStatus))
{
Sleep(500);
while (QueryServiceStatus(schService, &ssSvcStatus))
{
if (ssSvcStatus.dwCurrentState == SERVICE_STOP_PENDING)
{
Sleep(500);
}
else break;
}
}
// Now remove the service by calling DeleteService.
if (!DeleteService(schService))
{
ret = "DeleteService failed (is service running?)";
goto Cleanup;
}
Cleanup:
// Centralized cleanup for all allocated resources.
if (schSCManager)
{
CloseServiceHandle(schSCManager);
schSCManager = NULL;
}
if (schService)
{
CloseServiceHandle(schService);
schService = NULL;
}
return ret;
}
+64
View File
@@ -0,0 +1,64 @@
/****************************** Module Header ******************************\
* Module Name: ServiceInstaller.h
* Project: CppWindowsService
* Copyright (c) Microsoft Corporation.
*
* The file declares functions that install and uninstall the service.
*
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
* All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
#pragma once
#include <string>
//
// FUNCTION: InstallService
//
// PURPOSE: Install the current application as a service to the local
// service control manager database.
//
// PARAMETERS:
// * pszServiceName - the name of the service to be installed
// * pszDisplayName - the display name of the service
// * dwStartType - the service start option. This parameter can be one of
// the following values: SERVICE_AUTO_START, SERVICE_BOOT_START,
// SERVICE_DEMAND_START, SERVICE_DISABLED, SERVICE_SYSTEM_START.
// * pszDependencies - a pointer to a double null-terminated array of null-
// separated names of services or load ordering groups that the system
// must start before this service.
// * pszAccount - the name of the account under which the service runs.
// * pszPassword - the password to the account name.
//
// NOTE: If the function fails to install the service, it prints the error
// in the standard output stream for users to diagnose the problem.
//
// modified for ZT1 to return an error or empty string on success
std::string InstallService(PSTR pszServiceName,
PSTR pszDisplayName,
DWORD dwStartType,
PSTR pszDependencies,
PSTR pszAccount,
PSTR pszPassword);
//
// FUNCTION: UninstallService
//
// PURPOSE: Stop and remove the service from the local service control
// manager database.
//
// PARAMETERS:
// * pszServiceName - the name of the service to be removed.
//
// NOTE: If the function fails to uninstall the service, it prints the
// error in the standard output stream for users to diagnose the problem.
//
// Also modified to return rather than print errors
std::string UninstallService(PSTR pszServiceName);
Binary file not shown.
Binary file not shown.
+660
View File
@@ -0,0 +1,660 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|ARM64">
<Configuration>Profile</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|Win32">
<Configuration>Profile</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|x64">
<Configuration>Profile</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\controller\DB.cpp" />
<ClCompile Include="..\..\controller\DBMirrorSet.cpp" />
<ClCompile Include="..\..\controller\EmbeddedNetworkController.cpp" />
<ClCompile Include="..\..\controller\FileDB.cpp" />
<ClCompile Include="..\..\controller\LFDB.cpp" />
<ClCompile Include="..\..\controller\PostgreSQL.cpp" />
<ClCompile Include="..\..\ext\http-parser\http_parser.c" />
<ClCompile Include="..\..\ext\libnatpmp\getgateway.c" />
<ClCompile Include="..\..\ext\libnatpmp\natpmp.c" />
<ClCompile Include="..\..\ext\libnatpmp\wingettimeofday.c" />
<ClCompile Include="..\..\ext\miniupnpc\connecthostport.c" />
<ClCompile Include="..\..\ext\miniupnpc\igd_desc_parse.c" />
<ClCompile Include="..\..\ext\miniupnpc\minisoap.c" />
<ClCompile Include="..\..\ext\miniupnpc\minissdpc.c" />
<ClCompile Include="..\..\ext\miniupnpc\miniupnpc.c" />
<ClCompile Include="..\..\ext\miniupnpc\miniwget.c" />
<ClCompile Include="..\..\ext\miniupnpc\minixml.c" />
<ClCompile Include="..\..\ext\miniupnpc\portlistingparse.c" />
<ClCompile Include="..\..\ext\miniupnpc\receivedata.c" />
<ClCompile Include="..\..\ext\miniupnpc\upnpcommands.c" />
<ClCompile Include="..\..\ext\miniupnpc\upnpdev.c" />
<ClCompile Include="..\..\ext\miniupnpc\upnperrors.c" />
<ClCompile Include="..\..\ext\miniupnpc\upnpreplyparse.c" />
<ClCompile Include="..\..\node\AES.cpp" />
<ClCompile Include="..\..\node\AES_aesni.cpp" />
<ClCompile Include="..\..\node\AES_armcrypto.cpp" />
<ClCompile Include="..\..\node\Bond.cpp" />
<ClCompile Include="..\..\node\C25519.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">MaxSpeed</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Default</BasicRuntimeChecks>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Default</BasicRuntimeChecks>
</ClCompile>
<ClCompile Include="..\..\node\Capability.cpp" />
<ClCompile Include="..\..\node\CertificateOfMembership.cpp" />
<ClCompile Include="..\..\node\CertificateOfOwnership.cpp" />
<ClCompile Include="..\..\node\Identity.cpp" />
<ClCompile Include="..\..\node\IncomingPacket.cpp" />
<ClCompile Include="..\..\node\InetAddress.cpp" />
<ClCompile Include="..\..\node\Membership.cpp" />
<ClCompile Include="..\..\node\Metrics.cpp" />
<ClCompile Include="..\..\node\Multicaster.cpp" />
<ClCompile Include="..\..\node\Network.cpp" />
<ClCompile Include="..\..\node\NetworkConfig.cpp" />
<ClCompile Include="..\..\node\Node.cpp" />
<ClCompile Include="..\..\node\OutboundMulticast.cpp" />
<ClCompile Include="..\..\node\Packet.cpp" />
<ClCompile Include="..\..\node\PacketMultiplexer.cpp" />
<ClCompile Include="..\..\node\Path.cpp" />
<ClCompile Include="..\..\node\Peer.cpp" />
<ClCompile Include="..\..\node\Poly1305.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">MaxSpeed</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Default</BasicRuntimeChecks>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Default</BasicRuntimeChecks>
</ClCompile>
<ClCompile Include="..\..\node\Revocation.cpp" />
<ClCompile Include="..\..\node\Salsa20.cpp" />
<ClCompile Include="..\..\node\SelfAwareness.cpp" />
<ClCompile Include="..\..\node\SHA512.cpp" />
<ClCompile Include="..\..\node\Switch.cpp" />
<ClCompile Include="..\..\node\Tag.cpp" />
<ClCompile Include="..\..\node\Topology.cpp" />
<ClCompile Include="..\..\node\Trace.cpp" />
<ClCompile Include="..\..\node\Utils.cpp" />
<ClCompile Include="..\..\one.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\osdep\EthernetTap.cpp" />
<ClCompile Include="..\..\osdep\Http.cpp" />
<ClCompile Include="..\..\osdep\ManagedRoute.cpp" />
<ClCompile Include="..\..\osdep\OSUtils.cpp" />
<ClCompile Include="..\..\osdep\PortMapper.cpp" />
<ClCompile Include="..\..\osdep\WinDNSHelper.cpp" />
<ClCompile Include="..\..\osdep\WindowsEthernetTap.cpp" />
<ClCompile Include="..\..\osdep\WinFWHelper.cpp" />
<ClCompile Include="..\..\selftest.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\service\OneService.cpp" />
<ClCompile Include="..\..\service\SoftwareUpdater.cpp" />
<ClCompile Include="ServiceBase.cpp" />
<ClCompile Include="ServiceInstaller.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>
<FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</FunctionLevelLinking>
<EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</EnableParallelCodeGeneration>
<EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">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>
<FloatingPointExceptions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</FloatingPointExceptions>
<CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CreateHotpatchableImage>
<CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</CreateHotpatchableImage>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\controller\DB.hpp" />
<ClInclude Include="..\..\controller\DBMirrorSet.hpp" />
<ClInclude Include="..\..\controller\EmbeddedNetworkController.hpp" />
<ClInclude Include="..\..\controller\FileDB.hpp" />
<ClInclude Include="..\..\controller\LFDB.hpp" />
<ClInclude Include="..\..\controller\PostgreSQL.hpp" />
<ClInclude Include="..\..\controller\Redis.hpp" />
<ClInclude Include="..\..\ext\cpp-httplib\httplib.h" />
<ClInclude Include="..\..\ext\http-parser\http_parser.h" />
<ClInclude Include="..\..\ext\json\json.hpp" />
<ClInclude Include="..\..\ext\libnatpmp\getgateway.h" />
<ClInclude Include="..\..\ext\libnatpmp\natpmp.h" />
<ClInclude Include="..\..\ext\libnatpmp\wingettimeofday.h" />
<ClInclude Include="..\..\ext\miniupnpc\codelength.h" />
<ClInclude Include="..\..\ext\miniupnpc\connecthostport.h" />
<ClInclude Include="..\..\ext\miniupnpc\igd_desc_parse.h" />
<ClInclude Include="..\..\ext\miniupnpc\minisoap.h" />
<ClInclude Include="..\..\ext\miniupnpc\minissdpc.h" />
<ClInclude Include="..\..\ext\miniupnpc\miniupnpc.h" />
<ClInclude Include="..\..\ext\miniupnpc\miniupnpctypes.h" />
<ClInclude Include="..\..\ext\miniupnpc\miniupnpc_declspec.h" />
<ClInclude Include="..\..\ext\miniupnpc\miniwget.h" />
<ClInclude Include="..\..\ext\miniupnpc\minixml.h" />
<ClInclude Include="..\..\ext\miniupnpc\portlistingparse.h" />
<ClInclude Include="..\..\ext\miniupnpc\receivedata.h" />
<ClInclude Include="..\..\ext\miniupnpc\upnpcommands.h" />
<ClInclude Include="..\..\ext\miniupnpc\upnpdev.h" />
<ClInclude Include="..\..\ext\miniupnpc\upnperrors.h" />
<ClInclude Include="..\..\ext\miniupnpc\upnpreplyparse.h" />
<ClInclude Include="..\..\ext\x64-salsa2012-asm\salsa2012.h" />
<ClInclude Include="..\..\include\ZeroTierOne.h" />
<ClInclude Include="..\..\node\Address.hpp" />
<ClInclude Include="..\..\node\AtomicCounter.hpp" />
<ClInclude Include="..\..\node\Bond.hpp" />
<ClInclude Include="..\..\node\BondController.hpp" />
<ClInclude Include="..\..\node\Buffer.hpp" />
<ClInclude Include="..\..\node\C25519.hpp" />
<ClInclude Include="..\..\node\CertificateOfMembership.hpp" />
<ClInclude Include="..\..\node\CertificateOfOwnership.hpp" />
<ClInclude Include="..\..\node\Constants.hpp" />
<ClInclude Include="..\..\node\Credential.hpp" />
<ClInclude Include="..\..\node\Dictionary.hpp" />
<ClInclude Include="..\..\node\Hashtable.hpp" />
<ClInclude Include="..\..\node\Identity.hpp" />
<ClInclude Include="..\..\node\IncomingPacket.hpp" />
<ClInclude Include="..\..\node\InetAddress.hpp" />
<ClInclude Include="..\..\node\MAC.hpp" />
<ClInclude Include="..\..\node\Membership.hpp" />
<ClInclude Include="..\..\node\Metrics.hpp" />
<ClInclude Include="..\..\node\Multicaster.hpp" />
<ClInclude Include="..\..\node\MulticastGroup.hpp" />
<ClInclude Include="..\..\node\Mutex.hpp" />
<ClInclude Include="..\..\node\Network.hpp" />
<ClInclude Include="..\..\node\NetworkConfig.hpp" />
<ClInclude Include="..\..\node\NetworkController.hpp" />
<ClInclude Include="..\..\node\Node.hpp" />
<ClInclude Include="..\..\node\OutboundMulticast.hpp" />
<ClInclude Include="..\..\node\Packet.hpp" />
<ClInclude Include="..\..\node\Path.hpp" />
<ClInclude Include="..\..\node\Peer.hpp" />
<ClInclude Include="..\..\node\Poly1305.hpp" />
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp" />
<ClInclude Include="..\..\node\Salsa20.hpp" />
<ClInclude Include="..\..\node\SelfAwareness.hpp" />
<ClInclude Include="..\..\node\SHA512.hpp" />
<ClInclude Include="..\..\node\SharedPtr.hpp" />
<ClInclude Include="..\..\node\Switch.hpp" />
<ClInclude Include="..\..\node\Topology.hpp" />
<ClInclude Include="..\..\node\Trace.hpp" />
<ClInclude Include="..\..\node\Utils.hpp" />
<ClInclude Include="..\..\node\World.hpp" />
<ClInclude Include="..\..\osdep\Binder.hpp" />
<ClInclude Include="..\..\osdep\EthernetTap.hpp" />
<ClInclude Include="..\..\osdep\Http.hpp" />
<ClInclude Include="..\..\osdep\ManagedRoute.hpp" />
<ClInclude Include="..\..\osdep\OSUtils.hpp" />
<ClInclude Include="..\..\osdep\Phy.hpp" />
<ClInclude Include="..\..\osdep\PortMapper.hpp" />
<ClInclude Include="..\..\osdep\Thread.hpp" />
<ClInclude Include="..\..\osdep\WinDNSHelper.hpp" />
<ClInclude Include="..\..\osdep\WindowsEthernetTap.hpp" />
<ClInclude Include="..\..\osdep\WinFWHelper.hpp" />
<ClInclude Include="..\..\service\OneService.hpp" />
<ClInclude Include="..\..\service\SoftwareUpdater.hpp" />
<ClInclude Include="..\..\version.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ServiceBase.h" />
<ClInclude Include="ServiceInstaller.h" />
<ClInclude Include="ZeroTierOneService.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZeroTierOne.rc" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B00A4957-5977-4AC1-9EF4-571DC27EADA2}</ProjectGuid>
<RootNamespace>ZeroTierOne</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x86</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x86</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x86</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_arm64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_arm64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_x64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<TargetExt>.exe</TargetExt>
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<TargetName>zerotier-one_arm64</TargetName>
<IntDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)\..\rustybits\target\i686-pc-windows-msvc\debug\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_RULES_ENGINE_DEBUGGING;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wbemuuid.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalOptions>"notelemetry.obj" %(AdditionalOptions)</AdditionalOptions>
<AdditionalLibraryDirectories>$(SolutionDir)..\rustybits\target\x86_64-pc-windows-msvc\debug\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_RULES_ENGINE_DEBUGGING;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wbemuuid.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)..\rustybits\target\aarch64-pc-windows-msvc\debug\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalOptions>"notelemetry.obj" %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|ARM64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalOptions>"notelemetry.obj" %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level1</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;STATICLIB;ZT_SALSA20_SSE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;WIN32;NOMINMAX;ZT_SOFTWARE_UPDATE_DEFAULT="apply";ZT_BUILD_PLATFORM=2;ZT_BUILD_ARCHITECTURE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<ControlFlowGuard>Guard</ControlFlowGuard>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableParallelCodeGeneration>false</EnableParallelCodeGeneration>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)..\rustybits\target\i686-pc-windows-msvc\release\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level1</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="apply";ZT_SALSA20_SSE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;WIN32;NOMINMAX;ZT_BUILD_PLATFORM=2;ZT_BUILD_ARCHITECTURE=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnableParallelCodeGeneration>false</EnableParallelCodeGeneration>
<CallingConvention>Cdecl</CallingConvention>
<LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wbemuuid.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)..\rustybits\target\x86_64-pc-windows-msvc\release\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<WarningLevel>Level1</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)\..\ext;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\core\include;$(SolutionDir)\..\ext\prometheus-cpp-lite-1.0\simpleapi\include;$(SolutionDir)\..\rustybits\target;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_SSO_ENABLED=1;ZT_EXPORT;FD_SETSIZE=1024;STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="apply";ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;WIN32;NOMINMAX;ZT_BUILD_PLATFORM=2;ZT_BUILD_ARCHITECTURE=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnableParallelCodeGeneration>false</EnableParallelCodeGeneration>
<CallingConvention>Cdecl</CallingConvention>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<GuardEHContMetadata>false</GuardEHContMetadata>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wbemuuid.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;zeroidc.lib;bcrypt.lib;userenv.lib;crypt32.lib;secur32.lib;ncrypt.lib;ntdll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)..\rustybits\target\aarch64-pc-windows-msvc\release\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,575 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\node">
<UniqueIdentifier>{67b1c0f8-b018-4169-9c14-7032ed12c786}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\include">
<UniqueIdentifier>{40761a4c-e8db-4a91-9cab-7afef332f4a8}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\node">
<UniqueIdentifier>{da3b8126-840c-45db-8abe-9d7e7976f8be}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\osdep">
<UniqueIdentifier>{6054dfae-4ed2-4d69-8cf5-d6f27646f2d7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\service">
<UniqueIdentifier>{9944293a-4a1a-40e9-b92a-eff31fe87e2c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\osdep">
<UniqueIdentifier>{ca21bd6b-ff4e-4f9e-bedd-c9f603d2d0d6}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\service">
<UniqueIdentifier>{e1743b3c-1d18-47f1-ab5a-f5703c19f1df}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext">
<UniqueIdentifier>{71865460-d693-4c73-84f6-dbff42f49df6}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\http-parser">
<UniqueIdentifier>{17ae9a01-d39f-4c6d-a800-8f2cd0804c96}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ext">
<UniqueIdentifier>{7784af31-5b60-4300-b07e-44cf864c54db}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ext\http-parser">
<UniqueIdentifier>{f8a1c208-15b8-4d85-a4cb-11d2b82f2d1e}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\windows">
<UniqueIdentifier>{43f75f84-c70d-4d44-a0ef-28a7a399abd4}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\windows\ZeroTierOne">
<UniqueIdentifier>{0da07a2f-8922-4827-ac51-29ca3f30f881}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\windows">
<UniqueIdentifier>{b74916eb-bb6c-4449-a2a2-fa0b17f60121}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\windows\ZeroTierOne">
<UniqueIdentifier>{bf604491-14c4-4a74-81a6-6105d07c5c7c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\miniupnpc">
<UniqueIdentifier>{5423fb64-896b-432e-a19d-88d4467f89f9}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ext\miniupnpc">
<UniqueIdentifier>{56cc3ab8-3336-4a22-9471-c267ee46cd54}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\libnatpmp">
<UniqueIdentifier>{d7292d0d-72a0-4ed6-b717-21debb120737}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ext\libnatpmp">
<UniqueIdentifier>{409ec37e-ff36-4c13-b18d-52d6052e0ca2}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\controller">
<UniqueIdentifier>{3cad34c8-c436-43ae-8323-57803637c832}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\json">
<UniqueIdentifier>{ff20532b-d9a2-440d-a7b4-b49e26a9b2f8}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\x64-salsa2012-asm">
<UniqueIdentifier>{05d9cde8-03ae-4e37-b9f7-7417de98cbe9}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\controller">
<UniqueIdentifier>{7dc22e9c-f869-41e7-b43d-f07f5b94f6fb}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\ext\cpp-httplib">
<UniqueIdentifier>{4dfde4c7-2950-40ee-92f2-05e0916d36c5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\service\OneService.cpp">
<Filter>Source Files\service</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\Http.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\OSUtils.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\node\C25519.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\CertificateOfMembership.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Identity.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\IncomingPacket.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\InetAddress.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Multicaster.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Network.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\NetworkConfig.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Node.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\OutboundMulticast.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Packet.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Peer.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Poly1305.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Salsa20.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\SelfAwareness.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\SHA512.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Switch.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Topology.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Utils.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\http-parser\http_parser.c">
<Filter>Source Files\ext\http-parser</Filter>
</ClCompile>
<ClCompile Include="ServiceBase.cpp">
<Filter>Source Files\windows\ZeroTierOne</Filter>
</ClCompile>
<ClCompile Include="ServiceInstaller.cpp">
<Filter>Source Files\windows\ZeroTierOne</Filter>
</ClCompile>
<ClCompile Include="ZeroTierOneService.cpp">
<Filter>Source Files\windows\ZeroTierOne</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Path.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\connecthostport.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\igd_desc_parse.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\minisoap.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\minissdpc.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\miniupnpc.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\miniwget.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\minixml.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\portlistingparse.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\receivedata.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\upnpcommands.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\upnpdev.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\upnperrors.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\miniupnpc\upnpreplyparse.c">
<Filter>Source Files\ext\miniupnpc</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\PortMapper.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\libnatpmp\getgateway.c">
<Filter>Source Files\ext\libnatpmp</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\libnatpmp\natpmp.c">
<Filter>Source Files\ext\libnatpmp</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\libnatpmp\wingettimeofday.c">
<Filter>Source Files\ext\libnatpmp</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\ManagedRoute.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Membership.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Capability.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Revocation.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Tag.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\EmbeddedNetworkController.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\service\SoftwareUpdater.cpp">
<Filter>Source Files\service</Filter>
</ClCompile>
<ClCompile Include="..\..\node\CertificateOfOwnership.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\one.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\selftest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Trace.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\DB.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\FileDB.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\PostgreSQL.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\LFDB.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\controller\DBMirrorSet.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\EthernetTap.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Bond.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\WinDNSHelper.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\WindowsEthernetTap.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\node\AES.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\AES_aesni.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\AES_armcrypto.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\WinFWHelper.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Metrics.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\PacketMultiplexer.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\ZeroTierOne.h">
<Filter>Header Files\include</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\Http.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\OSUtils.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\Phy.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\Thread.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\WindowsEthernetTap.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\service\OneService.hpp">
<Filter>Header Files\service</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Address.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\AtomicCounter.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Buffer.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\C25519.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\CertificateOfMembership.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Constants.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Dictionary.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Identity.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\IncomingPacket.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\InetAddress.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\MAC.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Multicaster.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\MulticastGroup.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Mutex.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Network.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\NetworkConfig.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\NetworkController.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Node.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\OutboundMulticast.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Packet.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Path.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Peer.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Poly1305.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Salsa20.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\SelfAwareness.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\SHA512.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\SharedPtr.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Switch.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Topology.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Utils.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\http-parser\http_parser.h">
<Filter>Header Files\ext\http-parser</Filter>
</ClInclude>
<ClInclude Include="ServiceBase.h">
<Filter>Header Files\windows\ZeroTierOne</Filter>
</ClInclude>
<ClInclude Include="ServiceInstaller.h">
<Filter>Header Files\windows\ZeroTierOne</Filter>
</ClInclude>
<ClInclude Include="ZeroTierOneService.h">
<Filter>Header Files\windows\ZeroTierOne</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Hashtable.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\World.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\codelength.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\connecthostport.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\igd_desc_parse.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\minisoap.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\minissdpc.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\miniupnpc.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\miniupnpc_declspec.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\miniupnpctypes.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\miniwget.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\minixml.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\portlistingparse.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\receivedata.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\upnpcommands.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\upnpdev.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\upnperrors.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\miniupnpc\upnpreplyparse.h">
<Filter>Header Files\ext\miniupnpc</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\PortMapper.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\libnatpmp\getgateway.h">
<Filter>Header Files\ext\libnatpmp</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\libnatpmp\natpmp.h">
<Filter>Header Files\ext\libnatpmp</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\libnatpmp\wingettimeofday.h">
<Filter>Header Files\ext\libnatpmp</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\Binder.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\ManagedRoute.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\service\SoftwareUpdater.hpp">
<Filter>Header Files\service</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\json\json.hpp">
<Filter>Header Files\ext\json</Filter>
</ClInclude>
<ClInclude Include="..\..\node\CertificateOfOwnership.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Credential.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\x64-salsa2012-asm\salsa2012.h">
<Filter>Header Files\ext\x64-salsa2012-asm</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\EmbeddedNetworkController.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Trace.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\DB.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\FileDB.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Membership.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\PostgreSQL.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\LFDB.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\cpp-httplib\httplib.h">
<Filter>Header Files\ext\cpp-httplib</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\DBMirrorSet.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\EthernetTap.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Bond.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\node\BondController.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
<ClInclude Include="..\..\controller\Redis.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\WinDNSHelper.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\WinFWHelper.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\node\Metrics.hpp">
<Filter>Header Files\node</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZeroTierOne.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
+160
View File
@@ -0,0 +1,160 @@
/*
* Copyright (c)2019 ZeroTier, Inc.
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file in the project's root directory.
*
* Change Date: 2026-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2.0 of the Apache License.
*/
/****/
#pragma region Includes
#if defined(_WIN32) || defined(_WIN64)
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "ZeroTierOneService.h"
#include "../../version.h"
#include "../../include/ZeroTierOne.h"
#include "../../node/Constants.hpp"
#include "../../node/Utils.hpp"
#include "../../osdep/OSUtils.hpp"
#include "../../service/OneService.hpp"
#pragma endregion // Includes
#ifdef ZT_DEBUG_SERVICE
FILE *SVCDBGfile = (FILE *)0;
ZeroTier::Mutex SVCDBGfile_m;
#endif
ZeroTierOneService::ZeroTierOneService() :
CServiceBase(ZT_SERVICE_NAME,TRUE,TRUE,FALSE),
_service((ZeroTier::OneService *)0)
{
#ifdef ZT_DEBUG_SERVICE
SVCDBGfile_m.lock();
if (!SVCDBGfile)
SVCDBGfile = fopen(ZT_DEBUG_SERVICE,"a");
SVCDBGfile_m.unlock();
#endif
ZT_SVCDBG("ZeroTierOneService::ZeroTierOneService()\r\n");
}
ZeroTierOneService::~ZeroTierOneService(void)
{
ZT_SVCDBG("ZeroTierOneService::~ZeroTierOneService()\r\n");
#ifdef ZT_DEBUG_SERVICE
SVCDBGfile_m.lock();
if (SVCDBGfile) {
fclose(SVCDBGfile);
SVCDBGfile = (FILE *)0;
}
SVCDBGfile_m.unlock();
#endif
}
void ZeroTierOneService::threadMain()
throw()
{
ZT_SVCDBG("ZeroTierOneService::threadMain()\r\n");
restart_node:
try {
{
ZeroTier::Mutex::Lock _l(_lock);
delete _service;
_service = (ZeroTier::OneService *)0; // in case newInstance() fails
_service = ZeroTier::OneService::newInstance(_path.c_str(), ZT_DEFAULT_PORT);
}
switch(_service->run()) {
case ZeroTier::OneService::ONE_UNRECOVERABLE_ERROR: {
std::string err("ZeroTier One encountered an unrecoverable error: ");
err.append(_service->fatalErrorMessage());
err.append(" (restarting in 5 seconds)");
WriteEventLogEntry(const_cast <PSTR>(err.c_str()),EVENTLOG_ERROR_TYPE);
Sleep(5000);
} goto restart_node;
case ZeroTier::OneService::ONE_IDENTITY_COLLISION: {
std::string homeDir(ZeroTier::OneService::platformDefaultHomePath());
delete _service;
_service = (ZeroTier::OneService *)0;
std::string oldid;
ZeroTier::OSUtils::readFile((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret").c_str(),oldid);
if (oldid.length()) {
ZeroTier::OSUtils::writeFile((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret.saved_after_collision").c_str(),oldid);
ZeroTier::OSUtils::rm((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret").c_str());
ZeroTier::OSUtils::rm((homeDir + ZT_PATH_SEPARATOR_S + "identity.public").c_str());
}
} goto restart_node;
default: // normal termination
break;
}
} catch ( ... ) {
// sanity check, shouldn't happen since Node::run() should catch all its own errors
// could also happen if we're out of memory though!
WriteEventLogEntry("unexpected exception (out of memory?) (trying again in 5 seconds)",EVENTLOG_ERROR_TYPE);
Sleep(5000);
goto restart_node;
}
{
ZeroTier::Mutex::Lock _l(_lock);
delete _service;
_service = (ZeroTier::OneService *)0;
}
}
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 ( ... ) {
throw (DWORD)ERROR_EXCEPTION_IN_SERVICE;
}
}
void ZeroTierOneService::OnStop()
{
ZT_SVCDBG("ZeroTierOneService::OnStop()\r\n");
_lock.lock();
ZeroTier::OneService *s = _service;
_lock.unlock();
if (s) {
s->terminate();
ZeroTier::Thread::join(_thread);
}
}
void ZeroTierOneService::OnShutdown()
{
ZT_SVCDBG("ZeroTierOneService::OnShutdown()\r\n");
// stop thread on system shutdown (if it hasn't happened already)
OnStop();
}
#endif
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright (c)2019 ZeroTier, Inc.
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file in the project's root directory.
*
* Change Date: 2026-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2.0 of the Apache License.
*/
/****/
#pragma once
#if defined(_WIN32) || defined(_WIN64)
#include <stdio.h>
#include "ServiceBase.h"
#include <string>
#include "../../node/Mutex.hpp"
#include "../../osdep/Thread.hpp"
#include "../../service/OneService.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 NULL
#define ZT_SERVICE_PASSWORD NULL
class ZeroTierOneService : public CServiceBase
{
public:
ZeroTierOneService();
virtual ~ZeroTierOneService(void);
/**
* Thread main method; do not call elsewhere
*/
void threadMain()
throw();
protected:
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;
};
#endif
+14
View File
@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ZeroTierOne.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif