Pol  Revision:cb584c9
NTService.h
Go to the documentation of this file.
1 
9 #ifndef _NTSERVICE_H_
10 #define _NTSERVICE_H_
11 
12 #include "Header_Windows.h"
13 
14 #define SERVICE_CONTROL_USER 128
15 namespace Pol
16 {
17 namespace Clib
18 {
20 {
21 public:
22  CNTService( const char* szServiceName );
23  virtual ~CNTService();
24  BOOL ParseStandardArgs( int argc, char* argv[] );
25  BOOL IsInstalled();
26  BOOL Install();
27  BOOL Uninstall();
28  void LogEvent( WORD wType, DWORD dwID, const char* pszS1 = NULL, const char* pszS2 = NULL,
29  const char* pszS3 = NULL );
31  void SetStatus( DWORD dwState );
32  BOOL Initialize();
33  virtual void Run();
34  virtual BOOL OnInit();
35  virtual void OnStop();
36  virtual void OnInterrogate();
37  virtual void OnPause();
38  virtual void OnContinue();
39  virtual void OnShutdown();
40  virtual BOOL OnUserControl( DWORD dwOpcode );
41  void DebugMsg( const char* pszFormat, ... );
42 
43  // static member functions
44  static void WINAPI ServiceMain( DWORD dwArgc, LPTSTR* lpszArgv );
45  static void WINAPI Handler( DWORD dwOpcode );
46 
47  // data members
48  char m_szServiceName[64];
51  SERVICE_STATUS_HANDLE m_hServiceStatus;
52  SERVICE_STATUS m_Status;
54 
55  // static data
56  static CNTService* m_pThis; // nasty hack to get object ptr
57 
58 private:
60 };
61 }
62 }
63 #endif // _NTSERVICE_H_
char m_szServiceName[64]
Definition: NTService.h:48
SERVICE_STATUS m_Status
Definition: NTService.h:52
virtual void Run()
Definition: NTService.cpp:386
virtual void OnInterrogate()
Definition: NTService.cpp:471
BOOL ParseStandardArgs(int argc, char *argv[])
Definition: NTService.cpp:62
virtual void OnPause()
Definition: NTService.cpp:477
typedef DWORD(WINAPI *__SymGetOptions)(VOID)
void SetStatus(DWORD dwState)
Definition: NTService.cpp:343
virtual void OnContinue()
Definition: NTService.cpp:483
void DebugMsg(const char *pszFormat,...)
Definition: NTService.cpp:526
virtual void OnStop()
Definition: NTService.cpp:465
virtual BOOL OnInit()
Definition: NTService.cpp:458
typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess
SERVICE_STATUS_HANDLE m_hServiceStatus
Definition: NTService.h:51
void LogEvent(WORD wType, DWORD dwID, const char *pszS1=NULL, const char *pszS2=NULL, const char *pszS3=NULL)
Definition: NTService.cpp:257
static CNTService * m_pThis
Definition: NTService.h:56
CNTService(const char *szServiceName)
Definition: NTService.cpp:23
static void WINAPI Handler(DWORD dwOpcode)
Definition: NTService.cpp:405
static void WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv)
Definition: NTService.cpp:307
virtual BOOL OnUserControl(DWORD dwOpcode)
Definition: NTService.cpp:495
virtual void OnShutdown()
Definition: NTService.cpp:489
Definition: berror.cpp:12