Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# NT_Service.h File Reference

`#include "ace/pre.h"`
`#include "ace/config-all.h"`
`#include "ace/OS_Log_Msg_Attributes.h"`
`#include "ace/Service_Object.h"`
`#include "ace/Synch.h"`
`#include "ace/Task.h"`
`#include "ace/post.h"`

Include dependency graph for NT_Service.h:

This graph shows which files directly or indirectly include this file:

## Compounds
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) { SVCDESC, &ace_nt_svc_main_##SVCNAME }
#define | ACE_NT_SERVICE_RUN(SVCNAME, SVCINSTANCE, RET)

## Detailed Description

NT_Service.h,v 4.21 2002/02/01 00:25:09 shuston Exp

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) {            \
        int delete_svc_obj = 0;                                                 \
        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 = 1;                                                   \
        }                                                                       \
        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 |  | ) | { 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