ReactOS 0.4.15-dev-8145-ga541a46
npfs.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite NPFS helper declarations
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#ifndef _KMTEST_NPFS_H_
9#define _KMTEST_NPFS_H_
10
11#define DEVICE_NAMED_PIPE L"\\Device\\NamedPipe"
12
13#define BYTE_STREAM FILE_PIPE_BYTE_STREAM_MODE
15#define MESSAGE FILE_PIPE_MESSAGE_MODE
17#define QUEUE FILE_PIPE_QUEUE_OPERATION
18#define COMPLETE FILE_PIPE_COMPLETE_OPERATION
19#define INBOUND FILE_PIPE_INBOUND
20#define OUTBOUND FILE_PIPE_OUTBOUND
21#define DUPLEX FILE_PIPE_FULL_DUPLEX
22
25 OUT PHANDLE ServerHandle,
26 IN PCWSTR PipePath,
27 IN ULONG ReadMode,
28 IN ULONG CompletionMode,
29 IN ULONG NamedPipeType,
31 IN ULONG MaximumInstances,
32 IN ULONG InboundQuota,
33 IN ULONG OutboundQuota,
37 IN PLARGE_INTEGER DefaultTimeout OPTIONAL);
38
41 OUT PHANDLE ServerHandle,
42 IN PCWSTR PipePath,
43 IN ULONG ReadMode,
44 IN ULONG CompletionMode,
45 IN ULONG NamedPipeType,
46 IN ULONG NamedPipeConfiguration,
47 IN ULONG MaximumInstances,
48 IN ULONG InboundQuota,
49 IN ULONG OutboundQuota);
50
53 OUT PHANDLE ClientHandle,
54 IN PCWSTR PipePath,
59
62 OUT PHANDLE ClientHandle,
63 IN PCWSTR PipePath,
64 IN ULONG NamedPipeConfiguration);
65
72
73#define NpListenPipe(ServerHandle) NpControlPipe(ServerHandle, FSCTL_PIPE_LISTEN, NULL, 0)
74#define NpDisconnectPipe(ServerHandle) NpControlPipe(ServerHandle, FSCTL_PIPE_DISCONNECT, NULL, 0)
75
78 IN PCWSTR PipeName,
80
87
91 IN const VOID *Buffer,
94
95#define NpCheckServerPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps) \
96 NpCheckServerPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)
97
98#define NpCheckServerPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file, line) \
99 NpCheckServerPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))
100
101VOID
103 IN HANDLE ServerHandle,
104 /* PipeInformation */
105 IN ULONG ReadMode,
106 IN ULONG CompletionMode,
107 /* PipeLocalInformation */
108 IN ULONG NamedPipeType,
109 IN ULONG NamedPipeConfiguration,
110 IN ULONG MaximumInstances,
111 IN ULONG CurrentInstances,
112 IN ULONG InboundQuota,
113 IN ULONG ReadDataAvailable,
114 IN ULONG OutboundQuota,
115 IN ULONG WriteQuotaAvailable,
116 IN ULONG NamedPipeState,
117 /* PipeRemoteInformation */
118 /* */
119 IN PCSTR FileAndLine);
120
121#define NpCheckClientPipe(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps) \
122 NpCheckClientPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, __FILE__, __LINE__)
123
124#define NpCheckClientPipe__(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file, line) \
125 NpCheckClientPipe_(h, rm, cm, npt, npc, mi, ci, iq, rsa, oq, wqa, nps, file ":" KMT_STRINGIZE(line))
126
127VOID
129 IN HANDLE ClientHandle,
130 /* PipeInformation */
131 IN ULONG ReadMode,
132 IN ULONG CompletionMode,
133 /* PipeLocalInformation */
134 IN ULONG NamedPipeType,
135 IN ULONG NamedPipeConfiguration,
136 IN ULONG MaximumInstances,
137 IN ULONG CurrentInstances,
138 IN ULONG InboundQuota,
139 IN ULONG ReadDataAvailable,
140 IN ULONG OutboundQuota,
141 IN ULONG WriteQuotaAvailable,
142 IN ULONG NamedPipeState,
143 /* PipeRemoteInformation */
144 /* */
145 IN PCSTR FileAndLine);
146
147#define NpQueryPipe(h, es) \
148 NpQueryPipe__(h, es, __FILE__, __LINE__)
149
150#define NpQueryPipe__(h, es, file, line) \
151 NpQueryPipe_(h, es, file ":" KMT_STRINGIZE(line))
152
153VOID
156 IN NTSTATUS ExpectedStatus,
157 IN PCSTR FileAndLine);
158
159
160struct _THREAD_CONTEXT;
163
164typedef struct _THREAD_CONTEXT
165{
167 volatile union
168 {
169 struct
170 {
176 struct
177 {
181 struct
182 {
189 };
195
196VOID
199
200VOID
203
207 IN ULONG MilliSeconds);
208
212 IN ULONG MilliSeconds);
213
214#endif /* !defined _KMTEST_NPFS_H_ */
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4147
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG FsControlCode
Definition: fltkernel.h:1370
ULONG Handle
Definition: gdb_input.c:15
#define C_ASSERT(e)
Definition: intsafe.h:73
VOID NpCheckServerPipe_(IN HANDLE ServerHandle, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG CurrentInstances, IN ULONG InboundQuota, IN ULONG ReadDataAvailable, IN ULONG OutboundQuota, IN ULONG WriteQuotaAvailable, IN ULONG NamedPipeState, IN PCSTR FileAndLine)
Definition: NpfsHelpers.c:446
struct _THREAD_CONTEXT THREAD_CONTEXT
NTSTATUS NpOpenPipeEx(OUT PHANDLE ClientHandle, IN PCWSTR PipePath, IN ACCESS_MASK DesiredAccess, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions)
Definition: NpfsHelpers.c:130
VOID() WORK_FUNCTION(IN OUT struct _THREAD_CONTEXT *)
Definition: npfs.h:161
BOOLEAN WaitForWork(IN PTHREAD_CONTEXT Context, IN ULONG MilliSeconds)
Definition: NpfsHelpers.c:692
NTSTATUS NpOpenPipe(OUT PHANDLE ClientHandle, IN PCWSTR PipePath, IN ULONG NamedPipeConfiguration)
Definition: NpfsHelpers.c:180
NTSTATUS NpCreatePipeEx(OUT PHANDLE ServerHandle, IN PCWSTR PipePath, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG ShareAccess, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota, IN ACCESS_MASK DesiredAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PLARGE_INTEGER DefaultTimeout OPTIONAL)
Definition: NpfsHelpers.c:12
NTSTATUS NpWritePipe(IN HANDLE PipeHandle, IN const VOID *Buffer, IN ULONG BufferSize, OUT PULONG_PTR BytesWritten)
Definition: NpfsHelpers.c:374
VOID FinishWorkerThread(IN PTHREAD_CONTEXT Context)
Definition: NpfsHelpers.c:685
NTSTATUS NpReadPipe(IN HANDLE PipeHandle, OUT PVOID Buffer, IN ULONG BufferSize, OUT PULONG_PTR BytesRead)
Definition: NpfsHelpers.c:322
BOOLEAN TriggerWork(IN PTHREAD_CONTEXT Context, IN ULONG MilliSeconds)
Definition: NpfsHelpers.c:710
NTSTATUS NpCreatePipe(OUT PHANDLE ServerHandle, IN PCWSTR PipePath, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota)
VOID StartWorkerThread(OUT PTHREAD_CONTEXT Context)
Definition: NpfsHelpers.c:674
WORK_FUNCTION * PWORK_FUNCTION
Definition: npfs.h:162
NTSTATUS NpWaitPipe(IN PCWSTR PipeName, IN PLARGE_INTEGER Timeout)
Definition: NpfsHelpers.c:250
struct _THREAD_CONTEXT * PTHREAD_CONTEXT
NTSTATUS NpControlPipe(IN HANDLE PipeHandle, IN ULONG FsControlCode, IN PVOID InputBuffer, IN ULONG InputBufferLength)
Definition: NpfsHelpers.c:208
VOID NpCheckClientPipe_(IN HANDLE ClientHandle, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG CurrentInstances, IN ULONG InboundQuota, IN ULONG ReadDataAvailable, IN ULONG OutboundQuota, IN ULONG WriteQuotaAvailable, IN ULONG NamedPipeState, IN PCSTR FileAndLine)
Definition: NpfsHelpers.c:520
VOID NpQueryPipe_(IN HANDLE Handle, IN NTSTATUS ExpectedStatus, IN PCSTR FileAndLine)
Definition: NpfsHelpers.c:594
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define FILE_PIPE_MESSAGE_TYPE
Definition: iotypes.h:76
#define FILE_PIPE_BYTE_STREAM_TYPE
Definition: iotypes.h:75
#define FILE_PIPE_BYTE_STREAM_MODE
Definition: iotypes.h:77
#define FILE_PIPE_MESSAGE_MODE
Definition: iotypes.h:78
ULONG ACCESS_MASK
Definition: nt_native.h:40
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
static ULONG Timeout
Definition: ping.c:61
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
NTSTATUS Status
Definition: npfs.h:174
struct _THREAD_CONTEXT::@1621::@1623 Connect
ULONG BufferSize
Definition: npfs.h:185
volatile PWORK_FUNCTION Work
Definition: npfs.h:166
KEVENT StartWorkEvent
Definition: npfs.h:191
ULONG_PTR BytesTransferred
Definition: npfs.h:186
PKTHREAD Thread
Definition: npfs.h:193
BOOLEAN ClientSynchronous
Definition: npfs.h:172
HANDLE ClientHandle
Definition: npfs.h:173
struct _THREAD_CONTEXT::@1621::@1624 Listen
PCWSTR PipePath
Definition: npfs.h:171
KEVENT WorkCompleteEvent
Definition: npfs.h:192
PVOID Buffer
Definition: npfs.h:184
HANDLE PipeHandle
Definition: npfs.h:183
KEVENT ThreadDoneEvent
Definition: npfs.h:190
HANDLE ServerHandle
Definition: npfs.h:178
struct _THREAD_CONTEXT::@1621::@1625 ReadWrite
uint32_t * PULONG_PTR
Definition: typedefs.h:65
const uint16_t * PCWSTR
Definition: typedefs.h:57
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG CreateOptions
Definition: wdfregistry.h:118