[FLTMGR] Latest from my branch (#135)
[reactos.git] / modules / rostests / kmtests / kmtest / kmtest.h
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Loader Application
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8 #ifndef _KMTESTS_H_
9 #define _KMTESTS_H_
10
11 extern PCSTR ErrorFileAndLine;
12
13 #ifndef KMT_STRINGIZE
14 #define KMT_STRINGIZE(x) #x
15 #endif /* !defined KMT_STRINGIZE */
16
17 #define location(file, line) do { ErrorFileAndLine = file ":" KMT_STRINGIZE(line); } while (0)
18 #define error_value(Error, value) do { location(__FILE__, __LINE__); Error = value; } while (0)
19 #define error(Error) error_value(Error, GetLastError())
20 #define error_goto(Error, label) do { error(Error); goto label; } while (0)
21 #define error_value_goto(Error, value, label) do { error_value(Error, value); goto label; } while (0)
22
23 /* service management functions */
24 DWORD
25 KmtServiceInit(VOID);
26
27 DWORD
28 KmtServiceCleanup(
29 BOOLEAN IgnoreErrors);
30
31 DWORD
32 KmtCreateService(
33 IN PCWSTR ServiceName,
34 IN PCWSTR ServicePath,
35 IN PCWSTR DisplayName OPTIONAL,
36 OUT SC_HANDLE *ServiceHandle);
37
38 DWORD
39 KmtStartService(
40 IN PCWSTR ServiceName OPTIONAL,
41 IN OUT SC_HANDLE *ServiceHandle);
42
43 DWORD
44 KmtCreateAndStartService(
45 IN PCWSTR ServiceName,
46 IN PCWSTR ServicePath,
47 IN PCWSTR DisplayName OPTIONAL,
48 OUT SC_HANDLE *ServiceHandle,
49 IN BOOLEAN RestartIfRunning);
50
51 DWORD
52 KmtStopService(
53 IN PCWSTR ServiceName OPTIONAL,
54 IN OUT SC_HANDLE *ServiceHandle);
55
56 DWORD
57 KmtDeleteService(
58 IN PCWSTR ServiceName OPTIONAL,
59 IN OUT SC_HANDLE *ServiceHandle);
60
61 DWORD KmtCloseService(
62 IN OUT SC_HANDLE *ServiceHandle);
63
64
65 #ifdef KMT_FLT_USER_MODE
66
67 DWORD
68 KmtFltLoad(
69 _In_z_ PCWSTR ServiceName);
70
71 DWORD
72 KmtFltCreateAndStartService(
73 _In_z_ PCWSTR ServiceName,
74 _In_z_ PCWSTR ServicePath,
75 _In_z_ PCWSTR DisplayName OPTIONAL,
76 _Out_ SC_HANDLE *ServiceHandle,
77 _In_ BOOLEAN RestartIfRunning);
78
79 DWORD
80 KmtFltConnect(
81 _In_z_ PCWSTR ServiceName,
82 _Out_ HANDLE *hPort);
83
84 DWORD
85 KmtFltDisconnect(
86 _Out_ HANDLE *hPort);
87
88 DWORD
89 KmtFltSendMessage(
90 _In_ HANDLE hPort,
91 _In_reads_bytes_(dwInBufferSize) LPVOID lpInBuffer,
92 _In_ DWORD dwInBufferSize,
93 _Out_writes_bytes_to_opt_(dwOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
94 _In_ DWORD dwOutBufferSize,
95 _Out_opt_ LPDWORD lpBytesReturned);
96
97 DWORD
98 KmtFltGetMessage(
99 _In_ HANDLE hPort,
100 _Out_writes_bytes_(dwMessageBufferSize) PFILTER_MESSAGE_HEADER lpMessageBuffer,
101 _In_ DWORD dwMessageBufferSize,
102 _In_opt_ LPOVERLAPPED Overlapped);
103
104 DWORD
105 KmtFltReplyMessage(
106 _In_ HANDLE hPort,
107 _In_reads_bytes_(dwReplyBufferSize) PFILTER_REPLY_HEADER lpReplyBuffer,
108 _In_ DWORD dwReplyBufferSize);
109
110 DWORD
111 KmtFltGetMessageResult(
112 _In_ HANDLE hPort,
113 _In_ LPOVERLAPPED Overlapped,
114 _Out_ LPDWORD BytesTransferred);
115
116 DWORD
117 KmtFltUnload(
118 _In_z_ PCWSTR ServiceName);
119
120 DWORD
121 KmtFltDeleteService(
122 _In_z_ PCWSTR ServiceName OPTIONAL,
123 _Inout_ SC_HANDLE *ServiceHandle);
124
125 DWORD KmtFltCloseService(
126 _Inout_ SC_HANDLE *ServiceHandle);
127
128 #endif /* KMT_FILTER_DRIVER */
129
130 #endif /* !defined _KMTESTS_H_ */