- 3


/* Do whatever it takes to pause here. */

ServerDoPause();

ServiceStatus.dwCurrentState = SERVICE_PAUSED;

break;

case SERVICE_CONTROL_CONTINUE:

/* Do whatever it takes to continue here.*/

ServerDoContinue();

ServiceStatus.dwCurrentState = SERVICE_RUNNING;

break;

case SERVICE_CONTROL_STOP:

/* Do whatever it takes to stop here. */

ServerDoStop();

ServiceStatus.dwWin32ExitCode = 0;

ServiceStatus.dwCurrentState = SERVICE_STOPPED;

ServiceStatus.dwCheckPoint = 0;

ServiceStatus.dwWaitHint = 0;

if (!SetServiceStatus (ServiceStatusHandle, &ServiceStatus))

{

status = GetLastError();

}

return;

case SERVICE_CONTROL_INTERROGATE:

/* fall through to send current status */

break;

default:

/* Error handling */

break;

}

/* Send current status.*/

if (!SetServiceStatus (ServiceStatusHandle, &ServiceStatus)) {

status = GetLastError();

}

return;

}

CommonConfig.c

CommonConfig.c -

#include <windows.h>

#include "CommonConfig.h"

#include "EventLog.h"

#define REGVALUENAME_LENGTH 255

DWORD ConfigWatchingThread;

HANDLE hConfigMutex = NULL;

HANDLE hTaskMutex = NULL;

unsigned char * pszProtocolSequence = "ncacn_np";

unsigned char * pszSecurity = NULL;

unsigned char * pszEndpoint = "\\pipe\\CommServ";

unsigned int cMinCalls = 1;

unsigned int cMaxCalls = 20;

unsigned int fDontWait = FALSE;

struct TASKENTRY TaskTable[TASK_COUNT];

int EntryCount = 0;

DWORD TaskThreads[TASK_COUNT];

int TaskCount = 0;

void UpdateVariables()