forked from somma/_MyLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscm_context.h
More file actions
54 lines (47 loc) · 1.51 KB
/
scm_context.h
File metadata and controls
54 lines (47 loc) · 1.51 KB
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
52
53
54
/******************************************************************************
* scm_context.cpp
******************************************************************************
*
******************************************************************************
* All rights reserved by somma (fixbrain@gmail.com)
******************************************************************************
* 2011/11/30 created
******************************************************************************/
#pragma once
#include <string>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <sal.h>
#include <stdint.h>
typedef class scm_context
{
public:
scm_context(
_In_z_ const wchar_t* driver_path,
_In_z_ const wchar_t* service_name,
_In_z_ const wchar_t* service_display_name,
_In_ bool uninstall_service_on_free = true
);
~scm_context();
bool install_driver();
bool uninstall_driver();
bool start_driver();
bool stop_driver();
bool send_command(
_In_ uint32_t io_code,
_In_ uint32_t input_buffer_size,
_In_bytecount_(input_buffer_size) void* input_buffer,
_In_ uint32_t output_buffer_size,
_In_bytecount_(output_buffer_size) void* output_buffer,
_Out_ uint32_t* bytes_returned
);
private:
bool _uninstall_service_on_free;
HANDLE _driver_handle;
std::wstring _driver_path;
std::wstring _service_name;
std::wstring _service_display_name;
bool _installed;
bool _running;
HANDLE open_driver();
} *pscm_context;