-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSrvCtrl.h
45 lines (35 loc) · 1.17 KB
/
SrvCtrl.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
/* 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 SVRCTRL_H
#define SVRCTRL_H
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
class CSvrCtrl
{
public:
CSvrCtrl(void) noexcept;
~CSvrCtrl(void);
CSvrCtrl(const CSvrCtrl&) = delete;
CSvrCtrl(CSvrCtrl&&) = delete;
CSvrCtrl& operator=(const CSvrCtrl&) = delete;
CSvrCtrl& operator=(CSvrCtrl&&) = delete;
int Install(const wchar_t* szSvrName, const wchar_t* szDisplayName, const wchar_t* szDescription = nullptr);
int Remove(const wchar_t* szSvrName);
int Start(const wchar_t* szSvrName);
int Stop(const wchar_t* szSvrName);
int Pause(const wchar_t* szSvrName);
int Continue(const wchar_t* szSvrName);
private:
bool SelfElevat();
bool SetServiceDescription(const wchar_t* szSvrName, const wchar_t* szDescription) noexcept;
private:
SC_HANDLE m_hSCManager;
};
#endif
#endif // !SVRCTRL_H