mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 10:46:33 +00:00
Build fix in tap, handling of Windows shutdown signals.
This commit is contained in:
parent
cd907a7662
commit
c247a3d991
18
main.cpp
18
main.cpp
@ -107,6 +107,23 @@ static void sighandlerQuit(int sig)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
static BOOL WINAPI _handlerRoutine(DWORD dwCtrlType)
|
||||||
|
{
|
||||||
|
switch(dwCtrlType) {
|
||||||
|
case CTRL_C_EVENT:
|
||||||
|
case CTRL_BREAK_EVENT:
|
||||||
|
case CTRL_CLOSE_EVENT:
|
||||||
|
case CTRL_SHUTDOWN_EVENT:
|
||||||
|
Node *n = node;
|
||||||
|
if (n)
|
||||||
|
n->terminate();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
int _tmain(int argc, _TCHAR* argv[])
|
int _tmain(int argc, _TCHAR* argv[])
|
||||||
#else
|
#else
|
||||||
@ -127,6 +144,7 @@ int main(int argc,char **argv)
|
|||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
WSAStartup(MAKEWORD(2,2),&wsaData);
|
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||||
|
SetConsoleCtrlHandler(&_handlerRoutine,TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_initLibCrypto();
|
_initLibCrypto();
|
||||||
|
@ -1017,7 +1017,7 @@ void EthernetTap::setDisplayName(const char *dn)
|
|||||||
{
|
{
|
||||||
HKEY ifp;
|
HKEY ifp;
|
||||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,(std::string("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\") + _myDeviceInstanceId).c_str(),0,KEY_READ|KEY_WRITE,&ifp) == ERROR_SUCCESS) {
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,(std::string("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\") + _myDeviceInstanceId).c_str(),0,KEY_READ|KEY_WRITE,&ifp) == ERROR_SUCCESS) {
|
||||||
RegSetKeyValueA(ifp,"Connection","Name",REG_SZ,(LPCVOID)dn,strlen(dn)+1);
|
RegSetKeyValueA(ifp,"Connection","Name",REG_SZ,(LPCVOID)dn,(DWORD)(strlen(dn)+1));
|
||||||
RegCloseKey(ifp);
|
RegCloseKey(ifp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user