2 * PROJECT: ReactOS kernel-mode tests - Filter Manager
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Tests for checking filters load correctly
5 * PROGRAMMER: Ged Murphy <gedmurphy@reactos.org>
18 _In_ PFLT_PORT ClientPort
,
19 _In_opt_ PVOID ServerPortCookie
,
20 _In_reads_bytes_opt_(SizeOfContext
) PVOID ConnectionContext
,
21 _In_ ULONG SizeOfContext
,
22 _Outptr_result_maybenull_ PVOID
*ConnectionPortCookie
28 _In_opt_ PVOID ConnectionCookie
34 _In_opt_ PVOID ConnectionCookie
,
35 _In_reads_bytes_opt_(InputBufferLength
) PVOID InputBuffer
,
36 _In_ ULONG InputBufferLength
,
37 _Out_writes_bytes_to_opt_(OutputBufferLength
, *ReturnOutputBufferLength
) PVOID OutputBuffer
,
38 _In_ ULONG OutputBufferLength
,
39 _Out_ PULONG ReturnOutputBufferLength
44 static PDRIVER_OBJECT TestDriverObject
;
52 * This is called by DriverEntry as early as possible, but with ResultBuffer
53 * initialized, so that test macros work correctly
57 * This is guaranteed not to have been touched by DriverEntry before
58 * the call to TestEntry
60 * Driver Registry Path
61 * This is guaranteed not to have been touched by DriverEntry before
62 * the call to TestEntry
64 * Pointer to receive a test-specific name for the device to create
66 * Pointer to a flags variable instructing DriverEntry how to proceed.
67 * See the KMT_TESTENTRY_FLAGS enumeration for possible values
68 * Initialized to zero on entry
71 * DriverEntry will fail if this is a failure status
75 IN PDRIVER_OBJECT DriverObject
,
76 IN PCUNICODE_STRING RegistryPath
,
77 OUT PCWSTR
*DeviceName
,
80 NTSTATUS Status
= STATUS_SUCCESS
;
84 UNREFERENCED_PARAMETER(RegistryPath
);
85 UNREFERENCED_PARAMETER(Flags
);
89 ok_irql(PASSIVE_LEVEL
);
90 TestDriverObject
= DriverObject
;
92 *DeviceName
= L
"FltMgrLoad";
94 trace("Hi, this is the filter manager load test driver\n");
96 KmtFilterRegisterComms(TestClientConnect
, TestClientDisconnect
, TestMessageHandler
, 1);
104 * Test unload routine.
105 * This is called by the driver's Unload routine as early as possible, with
106 * ResultBuffer and the test device object still valid, so that test macros
109 * @param DriverObject
111 * This is guaranteed not to have been touched by Unload before the call
124 ok_irql(PASSIVE_LEVEL
);
126 trace("Unloading filter manager load test driver\n");
131 * @name TestInstanceSetup
133 * Test volume attach routine.
134 * This is called by the driver's InstanceSetupCallback routine in response to
135 * a new volume attaching.
138 * Filter Object Pointers
139 * Pointer to an FLT_RELATED_OBJECTS structure that contains opaque pointers
140 * for the objects related to the current operation
142 * Bitmask of flags that indicate why the instance is being attached
143 * @param VolumeDeviceType
144 * Device type of the file system volume
145 * @param VolumeFilesystemType
146 * File system type of the volume
148 * Unicode string containing the name of the volume.
149 * The string is only valid within the context of this function
151 * Adjusts the sector size to a minimum of 0x200, which is more reliable
152 * @param ReportedSectorSize
153 * Sector size of the volume as reported by the filter manager
156 * Return STATUS_SUCCESS to attach or STATUS_FLT_DO_NOT_ATTACH to ignore
160 _In_ PCFLT_RELATED_OBJECTS FltObjects
,
161 _In_ FLT_INSTANCE_SETUP_FLAGS Flags
,
162 _In_ DEVICE_TYPE VolumeDeviceType
,
163 _In_ FLT_FILESYSTEM_TYPE VolumeFilesystemType
,
164 _In_ PUNICODE_STRING VolumeName
,
165 _In_ ULONG SectorSize
,
166 _In_ ULONG ReportedSectorSize
169 trace("Received an attach request for VolumeType 0x%X, FileSystemType %d\n",
171 VolumeFilesystemType
);
173 /* We're not interested in attaching to any volumes in this test */
174 return STATUS_FLT_DO_NOT_ATTACH
;
178 * @name TestQueryTeardown
180 * Test volume attach routine.
181 * This is called by the driver's InstanceSetupCallback routine in response to
182 * a new volume attaching.
185 * Filter Object Pointers
186 * Pointer to an FLT_RELATED_OBJECTS structure that contains opaque pointers
187 * for the objects related to the current operation
189 * Flag that indicates why the minifilter driver instance is being torn down
194 _In_ PCFLT_RELATED_OBJECTS FltObjects
,
195 _In_ FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags
)
197 trace("Received a teardown request, Flags %lu\n", Flags
);
199 UNREFERENCED_PARAMETER(FltObjects
);
200 UNREFERENCED_PARAMETER(Flags
);
206 _In_ PFLT_PORT ClientPort
,
207 _In_opt_ PVOID ServerPortCookie
,
208 _In_reads_bytes_opt_(SizeOfContext
) PVOID ConnectionContext
,
209 _In_ ULONG SizeOfContext
,
210 _Outptr_result_maybenull_ PVOID
*ConnectionPortCookie
)
217 TestClientDisconnect(
218 _In_opt_ PVOID ConnectionCookie
)
226 _In_opt_ PVOID ConnectionCookie
,
227 _In_reads_bytes_opt_(InputBufferLength
) PVOID InputBuffer
,
228 _In_ ULONG InputBufferLength
,
229 _Out_writes_bytes_to_opt_(OutputBufferLength
, *ReturnOutputBufferLength
) PVOID OutputBuffer
,
230 _In_ ULONG OutputBufferLength
,
231 _Out_ PULONG ReturnOutputBufferLength
)