7 #ifndef _INC_cNTServiceImpl_H
8 #define _INC_cNTServiceImpl_H
15 #if defined(_WIN32) && !defined(UNDER_CE) && ! defined(_MFC_VER)
16 #include "../Thread/cSysEvent.h"
26 #define CNTSERVICECMD(a,b,c) NTS_CMD_##a,
33 :
public cSingletonStatic< cNTServiceImpl >
41 typedef cSingletonStatic< cNTServiceImpl > SUPER_t;
44 static const FILECHAR_t*
const k_szCommandLines[NTS_CMD_QTY + 1];
52 cSysEvent m_StopEvent;
53 SERVICE_STATUS_HANDLE m_hStatusHandle;
54 SERVICE_STATUS m_Status;
58 void ServiceMainStart();
61 static void WINAPI ServiceHandler(DWORD dwCtrlCode);
62 static void WINAPI ServiceMain(DWORD argc, LPSTR* lpszArgv);
75 virtual ~cNTServiceImpl();
77 bool isRunningAsService()
const
79 return m_bIsNTService;
83 void ReportEventX(WORD wType, DWORD dwMsgID,
const GChar_t* lpszMsg,
const GChar_t* lpszArgs =
nullptr);
91 static bool GRAYCALL HasServiceCommandLine();
92 APP_EXITCODE_t Main();
99 template class GRAYLIB_LINK cSingletonStatic< GrayLib::cNTServiceImpl >;
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
static const TIMESYS_t k_FREQ
milliSec per Sec
Definition: cTimeSys.h:100
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
LONG LSTATUS
AKA error_status_t. FACILITY_WIN32 codes returned from RegCreateKeyEx() etc. Maybe NOT GetLastError()...
Definition: HResult.h:74
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
cStringT< GChar_t > cString
Definition: cString.h:636