33 #include <sys/types.h>
46 const char*
_subkey =
"Software\\IBR-DTN";
54 _shutdown_cond.
signal(
true);
73 DWORD dwBufSize =
sizeof(buf);
76 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
_subkey, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
81 dwBufSize =
sizeof(dwValue);
82 if ( RegQueryValueEx(hKey,
"loglevel", NULL, &dwType, (LPBYTE)&dwValue, &dwBufSize) == ERROR_SUCCESS )
92 dwBufSize =
sizeof(dwValue);
93 if ( RegQueryValueEx(hKey,
"debuglevel", NULL, &dwType, (LPBYTE)&dwValue, &dwBufSize) == ERROR_SUCCESS )
103 dwBufSize =
sizeof(buf);
104 if ( RegQueryValueEx(hKey,
"logfile", NULL, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS )
114 dwBufSize =
sizeof(buf);
115 if ( RegQueryValueEx(hKey,
"configfile", NULL, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS )
132 if (error)
return -1;
143 case SERVICE_CONTROL_STOP:
147 case SERVICE_CONTROL_SHUTDOWN:
166 ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
174 if (
hStatus == (SERVICE_STATUS_HANDLE)0)
217 SERVICE_TABLE_ENTRY ServiceTable[2];
218 ServiceTable[0].lpServiceName = LPSTR(
"IBR-DTN");
219 ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)
ServiceMain;
221 ServiceTable[1].lpServiceName = NULL;
222 ServiceTable[1].lpServiceProc = NULL;
225 StartServiceCtrlDispatcher(ServiceTable);