- 5


#include "CommonConfig.h"

#include "ClientHandler.h"

#include "EventLog.h"

#include "ShedulerServ.h"

void ServerProcess() {

hConfigMutex = CreateMutex(NULL, FALSE, NULL);

hTaskMutex = CreateMutex(NULL, FALSE, NULL);

CreateThread(NULL, 0, ShedulingProc, NULL, 0, &ShedulingThread);

CreateThread(NULL, 0, RPCClientHandling, NULL, 0, &ClientHandlingThread);

}

DWORD ServerInit() {

RPC_STATUS status;

status = RpcServerUseProtseqEp(

pszProtocolSequence,

cMaxCalls,

pszEndpoint,

pszSecurity); // Security descriptor

if (status != NO_ERROR) {

return(1);

}

status = RpcServerRegisterIf(

CommService_ServerIfHandle, // !!!

NULL, // MgrTypeUuid

NULL); // MgrEpv; null means use default

if (status != NO_ERROR) {

return(2);

}

LogEvent(EVENTLOG_INFORMATION_TYPE, "\"Svyazinform\" Communicatin Service Initialized");

return(0);

}

void ServerDoPause()

{

SuspendThread(&ShedulingThread);

SuspendThread(&ClientHandlingThread);

LogEvent(EVENTLOG_INFORMATION_TYPE, "\"Svyazinform\" Communicatin Service Paused");

}

void ServerDoContinue()

{

ResumeThread(&ShedulingThread);

ResumeThread(&ClientHandlingThread);

LogEvent(EVENTLOG_INFORMATION_TYPE, "\"Svyazinform\" Communicatin Service Resumed");

}

void ServerDoStop() {

RPC_STATUS status;

status = RpcMgmtStopServerListening(NULL);

if (status != NO_ERROR) {

// Error handling

}

status = RpcServerUnregisterIf(NULL, NULL, FALSE);

if (status != NO_ERROR) {

// Error handling