ReactOS 0.4.15-dev-8138-g1e75ea8
fltmgr_register.c File Reference
#include <kmt_test.h>
#include <fltkernel.h>
#include <fltmgrint.h>
#include <debug.h>
Include dependency graph for fltmgr_register.c:

Go to the source code of this file.

Macros

#define RESET_REGISTRATION(basic)
 
#define RESET_UNLOAD(DO)   DO->DriverUnload = NULL;
 

Functions

NTSTATUS FLTAPI TestRegFilterUnload (_In_ FLT_FILTER_UNLOAD_FLAGS Flags)
 
BOOLEAN TestFltRegisterFilter (_In_ PDRIVER_OBJECT DriverObject)
 
NTSTATUS TestEntry (IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags)
 
VOID TestFilterUnload (IN ULONG Flags)
 
NTSTATUS TestInstanceSetup (_In_ PCFLT_RELATED_OBJECTS FltObjects, _In_ FLT_INSTANCE_SETUP_FLAGS Flags, _In_ DEVICE_TYPE VolumeDeviceType, _In_ FLT_FILESYSTEM_TYPE VolumeFilesystemType, _In_ PUNICODE_STRING VolumeName, _In_ ULONG SectorSize, _In_ ULONG ReportedSectorSize)
 
VOID TestQueryTeardown (_In_ PCFLT_RELATED_OBJECTS FltObjects, _In_ FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags)
 

Variables

static PDRIVER_OBJECT TestDriverObject
 
static FLT_REGISTRATION FilterRegistration
 
static PFLT_FILTER TestFilter = NULL
 

Macro Definition Documentation

◆ RESET_REGISTRATION

#define RESET_REGISTRATION (   basic)
Value:
do { \
RtlZeroMemory(&FilterRegistration, sizeof(FLT_REGISTRATION)); \
if (basic) { \
} \
} while (0)
struct _FLT_REGISTRATION FLT_REGISTRATION
#define FLT_REGISTRATION_VERSION
Definition: fltkernel.h:718
static FLT_REGISTRATION FilterRegistration

Definition at line 19 of file fltmgr_register.c.

◆ RESET_UNLOAD

#define RESET_UNLOAD (   DO)    DO->DriverUnload = NULL;

Definition at line 28 of file fltmgr_register.c.

Function Documentation

◆ TestEntry()

NTSTATUS TestEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PCUNICODE_STRING  RegistryPath,
OUT PCWSTR DeviceName,
IN OUT INT Flags 
)

Definition at line 191 of file fltmgr_register.c.

196{
198
199 PAGED_CODE();
200
202
203 DPRINT("FltMgrReg Entry!\n");
204 trace("Entered FltMgrReg tests\n");
205
206 /* We'll do the work ourselves in this test */
207 *Flags = TESTENTRY_NO_ALL;
208
209 ok_irql(PASSIVE_LEVEL);
211
212
213 /* Run the tests */
215
216 return Status;
217}
#define PAGED_CODE()
#define VOID
Definition: acefi.h:82
#define trace
Definition: atltest.h:70
LONG NTSTATUS
Definition: precomp.h:26
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
static PDRIVER_OBJECT TestDriverObject
BOOLEAN TestFltRegisterFilter(_In_ PDRIVER_OBJECT DriverObject)
Status
Definition: gdiplustypes.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

◆ TestFilterUnload()

VOID TestFilterUnload ( IN ULONG  Flags)

Definition at line 220 of file fltmgr_register.c.

222{
223 PAGED_CODE();
224 ok_irql(PASSIVE_LEVEL);
225}

◆ TestFltRegisterFilter()

BOOLEAN TestFltRegisterFilter ( _In_ PDRIVER_OBJECT  DriverObject)

Definition at line 46 of file fltmgr_register.c.

47{
51 PFLT_FILTER Temp = NULL;
53
55#if 0
59
63
67#endif
68
73
78
84
85
86 /* Test invalid sizes. MSDN says this is required, but it doesn't appear to be */
92
94 FilterRegistration.Size = 0xFFFF;
98
99
100 /* Now make a valid registration */
104
105 /* Try to register again */
108
109
111
112 /* Check we have the right filter name */
113 RtlInitUnicodeString(&Name, L"Kmtest-FltMgrReg");
115
116 /* And the altitude is corect */
119
120 //
121 // FIXME: More checks
122 //
123
124 /* Cleanup the valid registration */
126
127 /*
128 * The last thing we'll do before we exit is to properly register with the filter manager
129 * and set an unload routine. This'll let us test the FltUnregisterFilter routine
130 */
132
133 /* Set a fake unload routine we'll use to test */
134 DriverObject->DriverUnload = (PDRIVER_UNLOAD)0x1234FFFF;
135
139
140 /* Test all the unlod routines */
143
144 // This should equal the fltmgr's private unload routine, but there's no easy way of testing it...
145 //ok_eq_pointer(DriverObject->DriverUnload, FltpMiniFilterDriverUnload);
146
147 /* Make sure our test address is never actually called */
149
150 return TRUE;
151}
VOID FLTAPI FltUnregisterFilter(_In_ PFLT_FILTER Filter)
Definition: Filter.c:319
NTSTATUS NTAPI FltRegisterFilter(_In_ PDRIVER_OBJECT DriverObject, _In_ const FLT_REGISTRATION *Registration, _Out_ PFLT_FILTER *RetFilter)
Definition: Filter.c:112
struct NameRec_ * Name
Definition: cdprocs.h:460
#define ok_eq_pointer(value, expected)
Definition: apitest.h:59
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_eq_long(value, expected)
Definition: apitest.h:62
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
_Must_inspect_result_ _Inout_ PFLT_VOLUME _In_ PCUNICODE_STRING Altitude
Definition: fltkernel.h:1173
NTSTATUS(FLTAPI * PFLT_FILTER_UNLOAD_CALLBACK)(FLT_FILTER_UNLOAD_FLAGS Flags)
Definition: fltkernel.h:654
#define RESET_REGISTRATION(basic)
static PFLT_FILTER TestFilter
NTSTATUS FLTAPI TestRegFilterUnload(_In_ FLT_FILTER_UNLOAD_FLAGS Flags)
@ FLT_OBFL_TYPE_FILTER
Definition: fltmgrint.h:13
#define KmtStartSeh()
Definition: kmt_test.h:282
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:288
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_FLT_INSTANCE_ALTITUDE_COLLISION
Definition: ntstatus.h:1438
#define L(x)
Definition: ntvdm.h:50
FLT_OBJECT Base
Definition: fltmgrint.h:98
PFLT_FILTER_UNLOAD_CALLBACK OldDriverUnload
Definition: fltmgrint.h:119
PFLT_FILTER_UNLOAD_CALLBACK FilterUnload
Definition: fltmgrint.h:106
UNICODE_STRING Name
Definition: fltmgrint.h:100
UNICODE_STRING DefaultAltitude
Definition: fltmgrint.h:101
volatile FLT_OBJECT_FLAGS Flags
Definition: fltmgrint.h:27
PFLT_FILTER_UNLOAD_CALLBACK FilterUnloadCallback
Definition: fltkernel.h:734
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
DRIVER_UNLOAD * PDRIVER_UNLOAD
Definition: iotypes.h:2253

Referenced by TestEntry().

◆ TestInstanceSetup()

NTSTATUS TestInstanceSetup ( _In_ PCFLT_RELATED_OBJECTS  FltObjects,
_In_ FLT_INSTANCE_SETUP_FLAGS  Flags,
_In_ DEVICE_TYPE  VolumeDeviceType,
_In_ FLT_FILESYSTEM_TYPE  VolumeFilesystemType,
_In_ PUNICODE_STRING  VolumeName,
_In_ ULONG  SectorSize,
_In_ ULONG  ReportedSectorSize 
)

Definition at line 228 of file fltmgr_register.c.

237{
239}
#define STATUS_FLT_DO_NOT_ATTACH
Definition: ntstatus.h:1436

◆ TestQueryTeardown()

VOID TestQueryTeardown ( _In_ PCFLT_RELATED_OBJECTS  FltObjects,
_In_ FLT_INSTANCE_QUERY_TEARDOWN_FLAGS  Flags 
)

Definition at line 242 of file fltmgr_register.c.

245{
246 UNREFERENCED_PARAMETER(FltObjects);
248}

◆ TestRegFilterUnload()

NTSTATUS FLTAPI TestRegFilterUnload ( _In_ FLT_FILTER_UNLOAD_FLAGS  Flags)

Definition at line 156 of file fltmgr_register.c.

158{
159 //__debugbreak();
160
161 ok_irql(PASSIVE_LEVEL);
162 ok(TestFilter != NULL, "Buffer is NULL\n");
163
164 //
165 // FIXME: Add tests
166 //
167
169
170 //
171 // FIXME: Add tests
172 //
173
174 return STATUS_SUCCESS;
175}
#define ok(value,...)
Definition: atltest.h:57

Referenced by TestFltRegisterFilter().

Variable Documentation

◆ FilterRegistration

FLT_REGISTRATION FilterRegistration
static

Definition at line 39 of file fltmgr_register.c.

Referenced by TestFltRegisterFilter().

◆ TestDriverObject

PDRIVER_OBJECT TestDriverObject
static

Definition at line 38 of file fltmgr_register.c.

Referenced by TestEntry().

◆ TestFilter

PFLT_FILTER TestFilter = NULL
static

Definition at line 40 of file fltmgr_register.c.

Referenced by TestFltRegisterFilter(), and TestRegFilterUnload().