-
Notifications
You must be signed in to change notification settings - Fork 4
/
BaseSrv.h
51 lines (40 loc) · 1.31 KB
/
BaseSrv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright (C) 2016-2020 Thomas Hauck - All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
The author would be happy if changes and
improvements were reported back to him.
Author: Thomas Hauck
Email: [email protected]
*/
#ifndef BASESRV_H
#define BASESRV_H
#if defined(_WIN32) || defined(_WIN64)
#include "windows.h"
#include <string>
using namespace std;
class CBaseSrv
{
public:
explicit CBaseSrv(const wchar_t* szSrvName);
virtual ~CBaseSrv(void);
CBaseSrv() = delete;
CBaseSrv(const CBaseSrv&) = delete;
CBaseSrv(CBaseSrv&&) = delete;
CBaseSrv& operator=(const CBaseSrv&) = delete;
CBaseSrv& operator=(CBaseSrv&&) = delete;
int Run(void) noexcept;
static void WINAPI ServiceStartCB(DWORD argc, LPTSTR *argv);
static void WINAPI ServiceCtrlHandler(DWORD Opcode);
virtual int Init(void) noexcept { return 1;}
virtual void Start(void) = 0;
virtual void Stop(void) = 0;
virtual void Pause(void) noexcept {;}
virtual void Continue(void) noexcept {;}
private:
static wstring s_strSrvName;
static SERVICE_STATUS s_stSrvStatus;
static SERVICE_STATUS_HANDLE s_hSrvStatus;
static CBaseSrv* s_This;
};
#endif
#endif // BASESRV_H