#include "tcpsvcs.h"
+#include <winsvc.h>
+
static WCHAR ServiceName[] = L"tcpsvcs";
volatile BOOL bShutdown = FALSE;
if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0)
{
- _swprintf(buf, L"WSAStartup() failed : %lu\n", RetVal);
+ swprintf(buf, L"WSAStartup() failed : %lu\n", RetVal);
LogEvent(buf, 0, 100, LOG_ALL);
return FALSE;
}
/* Create worker threads. */
for (i = 0; i < NUM_SERVICES; i++)
{
- _swprintf(buf, L"Creating thread for %s server", Services[i].lpName);
+ swprintf(buf, L"Creating thread for %s server", Services[i].lpName);
LogEvent(buf, 0, 0, LOG_FILE);
hThread[i] = CreateThread(NULL,
if (hThread[i] == NULL)
{
- _swprintf(buf, L"\nError creating %s server thread\n", Services[i].lpName);
+ swprintf(buf, L"\nError creating %s server thread\n", Services[i].lpName);
LogEvent(buf, GetLastError(), 0, LOG_ALL);
return FALSE;
}
LogEvent(L"\nSetting the service to SERVICE_STOP_PENDING", 0, 0, LOG_FILE);
InterlockedExchange((LONG *)&bShutdown, TRUE);
pServInfo->servStatus.dwWin32ExitCode = 0;
- pServInfo->servStatus.dwWaitHint = 0;
+ pServInfo->servStatus.dwWaitHint = 5000;
UpdateStatus(pServInfo, SERVICE_STOP_PENDING, 1);
break;
break;
case SERVICE_CONTROL_INTERROGATE:
+ SetServiceStatus(pServInfo->hStatus, &pServInfo->servStatus);
break;
default: