ACE  6.1.0
Classes | Defines
NT_Service.h File Reference
#include "ace/ACE.h"
#include "ace/OS_Log_Msg_Attributes.h"
#include "ace/Service_Object.h"
#include "ace/Task.h"
#include "ace/OS_NS_errno.h"
#include "ace/NT_Service.inl"

Classes

class  ACE_NT_Service
 Provide the base class which defines the interface for controlling an NT service. More...

Defines

#define ACE_NT_SERVICE_START_TIMEOUT   5000
#define ACE_NT_SERVICE_DEFINE(SVCNAME, SVCCLASS, SVCDESC)
#define ACE_NT_SERVICE_REFERENCE(SVCNAME)
#define ACE_NT_SERVICE_ENTRY(SVCDESC, SVCNAME)
#define ACE_NT_SERVICE_RUN(SVCNAME, SVCINSTANCE, RET)

Detailed Description

Id:
NT_Service.h 93117 2011-01-20 12:11:28Z mcorino
Author:
Steve Huston <shuston@riverace.com>

Define Documentation

#define ACE_NT_SERVICE_DEFINE (   SVCNAME,
  SVCCLASS,
  SVCDESC 
)
Value:
ACE_NT_Service * _ace_nt_svc_obj_##SVCNAME = 0;                           \
  VOID WINAPI ace_nt_svc_handler_##SVCNAME (DWORD fdwControl) {             \
    _ace_nt_svc_obj_##SVCNAME->handle_control(fdwControl);                  \
  }                                                                         \
  VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc,                      \
                                         ACE_TCHAR **lpszArgv) {            \
    bool delete_svc_obj = false;                                            \
    if (_ace_nt_svc_obj_##SVCNAME == 0) {                                   \
      ACE_NEW (_ace_nt_svc_obj_##SVCNAME, SVCCLASS);                        \
      if (_ace_nt_svc_obj_##SVCNAME == 0)                                   \
        return;                                                             \
      delete_svc_obj = true;                                                \
    }                                                                       \
    else                                                                    \
      _ace_nt_svc_obj_##SVCNAME->inherit_log_msg_attributes ();             \
    _ace_nt_svc_obj_##SVCNAME->init(dwArgc, lpszArgv);                      \
    _ace_nt_svc_obj_##SVCNAME->svc_handle(                                  \
                  ACE_TEXT_RegisterServiceCtrlHandler(SVCDESC,              \
                                          &ace_nt_svc_handler_##SVCNAME));  \
    _ace_nt_svc_obj_##SVCNAME->open();                                      \
    _ace_nt_svc_obj_##SVCNAME->wait();                                      \
    _ace_nt_svc_obj_##SVCNAME->fini();                                      \
    if (delete_svc_obj) {                                                   \
      delete _ace_nt_svc_obj_##SVCNAME;                                     \
      _ace_nt_svc_obj_##SVCNAME = 0;                                        \
    }                                                                       \
    return;                                                                 \
  }
#define ACE_NT_SERVICE_ENTRY (   SVCDESC,
  SVCNAME 
)
Value:
{ const_cast<ACE_TCHAR*> (SVCDESC),                  \
                        &ace_nt_svc_main_##SVCNAME }
#define ACE_NT_SERVICE_REFERENCE (   SVCNAME)
Value:
extern ACE_NT_Service * _ace_nt_svc_obj_##SVCNAME;                         \
extern VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc,                \
                                              ACE_TCHAR **lpszArgv);
#define ACE_NT_SERVICE_RUN (   SVCNAME,
  SVCINSTANCE,
  RET 
)
Value:
ACE_TEXT_SERVICE_TABLE_ENTRY _ace_nt_svc_table[2] =                      \
  {                                                                        \
    ACE_NT_SERVICE_ENTRY(ACE_TEXT (#SVCNAME), SVCNAME),                    \
    { 0, 0 }                                                               \
  };                                                                       \
  _ace_nt_svc_obj_##SVCNAME = SVCINSTANCE;                                 \
  _ace_nt_svc_obj_##SVCNAME->capture_log_msg_attributes ();                \
  ACE_OS::last_error (0);                                                  \
  int RET = ACE_TEXT_StartServiceCtrlDispatcher(_ace_nt_svc_table);
#define ACE_NT_SERVICE_START_TIMEOUT   5000
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines