ReactOS  0.4.13-dev-1089-g05f0b08
kmtest.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE: Kernel-Mode Test Suite loader application declarations
5  * COPYRIGHT: Copyright 2011-2018 Thomas Faber <thomas.faber@reactos.org>
6  * Copyright 2017 Ged Murphy <gedmurphy@reactos.org>
7  */
8 
9 #ifndef _KMTESTS_H_
10 #define _KMTESTS_H_
11 
12 extern PCSTR ErrorFileAndLine;
13 
14 #ifndef KMT_STRINGIZE
15 #define KMT_STRINGIZE(x) #x
16 #endif /* !defined KMT_STRINGIZE */
17 
18 #define location(file, line) do { ErrorFileAndLine = file ":" KMT_STRINGIZE(line); } while (0)
19 #define error_value(Error, value) do { location(__FILE__, __LINE__); Error = value; } while (0)
20 #define error(Error) error_value(Error, GetLastError())
21 #define error_goto(Error, label) do { error(Error); goto label; } while (0)
22 #define error_value_goto(Error, value, label) do { error_value(Error, value); goto label; } while (0)
23 
24 /* service management functions */
25 DWORD
27 
28 DWORD
30  BOOLEAN IgnoreErrors);
31 
32 DWORD
35  IN PCWSTR ServicePath,
36  IN PCWSTR DisplayName OPTIONAL,
37  OUT SC_HANDLE *ServiceHandle);
38 
39 DWORD
42  IN OUT SC_HANDLE *ServiceHandle);
43 
44 DWORD
47  IN PCWSTR ServicePath,
48  IN PCWSTR DisplayName OPTIONAL,
49  OUT SC_HANDLE *ServiceHandle,
50  IN BOOLEAN RestartIfRunning);
51 
52 DWORD
55  IN OUT SC_HANDLE *ServiceHandle);
56 
57 DWORD
60  IN OUT SC_HANDLE *ServiceHandle);
61 
63  IN OUT SC_HANDLE *ServiceHandle);
64 
65 
66 #ifdef KMT_FLT_USER_MODE
67 
68 DWORD
71 
72 DWORD
73 KmtFltCreateAndStartService(
75  _In_z_ PCWSTR ServicePath,
76  _In_z_ PCWSTR DisplayName OPTIONAL,
77  _Out_ SC_HANDLE *ServiceHandle,
78  _In_ BOOLEAN RestartIfRunning);
79 
80 DWORD
83  _Out_ HANDLE *hPort);
84 
85 DWORD
87  _Out_ HANDLE *hPort);
88 
89 DWORD
91  _In_ HANDLE hPort,
92  _In_reads_bytes_(dwInBufferSize) LPVOID lpInBuffer,
93  _In_ DWORD dwInBufferSize,
94  _Out_writes_bytes_to_opt_(dwOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
95  _In_ DWORD dwOutBufferSize,
97 
98 DWORD
100  _In_ HANDLE hPort,
101  _Out_writes_bytes_(dwMessageBufferSize) PFILTER_MESSAGE_HEADER lpMessageBuffer,
102  _In_ DWORD dwMessageBufferSize,
103  _In_opt_ LPOVERLAPPED Overlapped);
104 
105 DWORD
107  _In_ HANDLE hPort,
108  _In_reads_bytes_(dwReplyBufferSize) PFILTER_REPLY_HEADER lpReplyBuffer,
109  _In_ DWORD dwReplyBufferSize);
110 
111 DWORD
113  _In_ HANDLE hPort,
114  _In_ LPOVERLAPPED Overlapped,
115  _Out_ LPDWORD BytesTransferred);
116 
117 DWORD
120 
121 DWORD
124  _Inout_ SC_HANDLE *ServiceHandle);
125 
127  _Inout_ SC_HANDLE *ServiceHandle);
128 
129 #endif /* KMT_FILTER_DRIVER */
130 
131 #endif /* !defined _KMTESTS_H_ */
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
DWORD KmtFltSendMessage(_In_ HANDLE hPort, _In_reads_bytes_(dwInBufferSize) LPVOID InBuffer, _In_ DWORD InBufferSize, _Out_writes_bytes_to_opt_(dutBufferSize, *BytesReturned) LPVOID OutBuffer, _In_ DWORD OutBufferSize, _Out_opt_ LPDWORD BytesReturned)
Definition: filter.c:187
DWORD KmtStopService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
Definition: service.c:315
#define _Out_writes_bytes_to_opt_(size, count)
Definition: no_sal2.h:375
DWORD KmtCloseService(IN OUT SC_HANDLE *ServiceHandle)
Definition: service.c:392
#define _In_opt_
Definition: no_sal2.h:213
PCSTR ErrorFileAndLine
Definition: kmtest.c:34
DWORD KmtFltDeleteService(_In_opt_z_ PCWSTR ServiceName, _Inout_ SC_HANDLE *ServiceHandle)
Definition: fltsupport.c:97
DWORD KmtCreateService(IN PCWSTR ServiceName, IN PCWSTR ServicePath, IN PCWSTR DisplayName OPTIONAL, OUT SC_HANDLE *ServiceHandle)
Definition: service.c:92
unsigned char BOOLEAN
#define _Out_writes_bytes_(size)
Definition: no_sal2.h:370
#define _Out_
Definition: no_sal2.h:323
DWORD KmtFltGetMessageResult(_In_ HANDLE hPort, _In_ LPOVERLAPPED Overlapped, _Out_ LPDWORD BytesTransferred)
Definition: filter.c:306
#define _Out_opt_
Definition: no_sal2.h:339
LPTSTR ServiceName
Definition: ServiceMain.c:15
DWORD KmtDeleteService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
Definition: service.c:356
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _Inout_
Definition: no_sal2.h:244
DWORD KmtFltLoad(_In_z_ PCWSTR ServiceName)
Definition: filter.c:30
DWORD KmtFltReplyMessage(_In_ HANDLE hPort, _In_reads_bytes_(ReplyBufferSize) PFILTER_REPLY_HEADER ReplyBuffer, _In_ DWORD ReplyBufferSize)
Definition: filter.c:276
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
#define _In_
Definition: no_sal2.h:204
#define _In_z_
Definition: no_sal2.h:239
DWORD KmtStartService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
Definition: service.c:217
DWORD KmtFltGetMessage(_In_ HANDLE hPort, _Out_writes_bytes_(MessageBufferSize) PFILTER_MESSAGE_HEADER MessageBuffer, _In_ DWORD MessageBufferSize, _In_opt_ LPOVERLAPPED Overlapped)
Definition: filter.c:241
_In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpBytesReturned
Definition: winddi.h:1704
DWORD KmtServiceCleanup(BOOLEAN IgnoreErrors)
Definition: service.c:64
DWORD KmtServiceInit(VOID)
Definition: service.c:40
#define OUT
Definition: typedefs.h:39
uint32_t * LPDWORD
Definition: typedefs.h:57
DWORD KmtFltUnload(_In_z_ PCWSTR ServiceName)
Definition: filter.c:336
DWORD KmtFltConnect(_In_z_ PCWSTR ServiceName, _Out_ HANDLE *hPort)
Definition: filter.c:119
const char * PCSTR
Definition: typedefs.h:51
DWORD KmtCreateAndStartService(IN PCWSTR ServiceName, IN PCWSTR ServicePath, IN PCWSTR DisplayName OPTIONAL, OUT SC_HANDLE *ServiceHandle, IN BOOLEAN RestartIfRunning)
Definition: service.c:262
DWORD KmtFltCloseService(_Inout_ SC_HANDLE *ServiceHandle)
Definition: fltsupport.c:242
DWORD KmtFltDisconnect(_In_ HANDLE hPort)
Definition: filter.c:151
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68