ReactOS  0.4.14-dev-98-gb0d4763
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) { \
FilterRegistration.Size = sizeof(FLT_REGISTRATION); \
FilterRegistration.Version = FLT_REGISTRATION_VERSION; \
} \
} while (0)
static FLT_REGISTRATION FilterRegistration
#define FLT_REGISTRATION_VERSION
Definition: fltkernel.h:718
struct _FLT_REGISTRATION FLT_REGISTRATION

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 UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static PDRIVER_OBJECT TestDriverObject
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN TestFltRegisterFilter(_In_ PDRIVER_OBJECT DriverObject)
#define trace
Definition: atltest.h:70
#define VOID
Definition: acefi.h:82
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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 }
#define PAGED_CODE()
Definition: video.h:57
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

◆ 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
56  KmtStartSeh()
59 
60  KmtStartSeh()
63 
64  KmtStartSeh()
67 #endif
68 
70  FilterRegistration.Version = 0x0100;
73 
75  FilterRegistration.Version = 0x0300;
78 
80  FilterRegistration.Version = 0x0200;
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 */
117  RtlInitUnicodeString(&Altitude, L"123456");
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 */
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 }
#define TRUE
Definition: types.h:120
FLT_OBJECT Base
Definition: fltmgrint.h:98
NTSTATUS FLTAPI TestRegFilterUnload(_In_ FLT_FILTER_UNLOAD_FLAGS Flags)
#define STATUS_FLT_INSTANCE_ALTITUDE_COLLISION
Definition: ntstatus.h:1220
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ok_eq_pointer(value, expected)
LONG NTSTATUS
Definition: precomp.h:26
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:283
PFLT_FILTER_UNLOAD_CALLBACK OldDriverUnload
Definition: fltmgrint.h:119
DRIVER_UNLOAD * PDRIVER_UNLOAD
Definition: iotypes.h:2145
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
VOID FLTAPI FltUnregisterFilter(_In_ PFLT_FILTER Filter)
Definition: Filter.c:319
_Must_inspect_result_ _Inout_ PFLT_VOLUME _In_ PCUNICODE_STRING Altitude
Definition: fltkernel.h:1172
#define RESET_REGISTRATION(basic)
PFLT_FILTER_UNLOAD_CALLBACK FilterUnloadCallback
Definition: fltkernel.h:734
static PFLT_FILTER TestFilter
static const WCHAR L[]
Definition: oid.c:1250
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
NTSTATUS(FLTAPI * PFLT_FILTER_UNLOAD_CALLBACK)(FLT_FILTER_UNLOAD_FLAGS Flags)
Definition: fltkernel.h:654
#define KmtStartSeh()
Definition: kmt_test.h:277
volatile FLT_OBJECT_FLAGS Flags
Definition: fltmgrint.h:27
PFLT_FILTER_UNLOAD_CALLBACK FilterUnload
Definition: fltmgrint.h:106
Status
Definition: gdiplustypes.h:24
UNICODE_STRING Name
Definition: fltmgrint.h:100
static FLT_REGISTRATION FilterRegistration
NTSTATUS NTAPI FltRegisterFilter(_In_ PDRIVER_OBJECT DriverObject, _In_ const FLT_REGISTRATION *Registration, _Out_ PFLT_FILTER *RetFilter)
Definition: Filter.c:112
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ok_eq_long(value, expected)
Definition: kmt_test.h:240
UNICODE_STRING DefaultAltitude
Definition: fltmgrint.h:101

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:1218

◆ 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 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
VOID FLTAPI FltUnregisterFilter(_In_ PFLT_FILTER Filter)
Definition: Filter.c:319
static PFLT_FILTER TestFilter
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define ok(value,...)
Definition: atltest.h:57
return STATUS_SUCCESS
Definition: btrfs.c:2966

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().