mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 02:37:06 +00:00
![Ged Murphy](/assets/img/avatar_default.png)
[FLTMGR] - Partially implement registering contexts - Add a misc file which contains stubs of the APIs needed in the test suite - Export some APIs needed by the test suite [KMTESTS] - Create a File System Mini-filter wrapper to host drivers for the filter manager tests - Add a test file which will be used for testing that mini-filters load correctly - Add a test file which will be used to write tests for IRP_MJ_CREATE requests
147 lines
3.1 KiB
C
147 lines
3.1 KiB
C
/*
|
|
* PROJECT: ReactOS kernel-mode tests - Filter Manager
|
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
|
* PURPOSE: Tests for checking the create operations
|
|
* PROGRAMMER: Ged Murphy <gedmurphy@reactos.org>
|
|
*/
|
|
|
|
#include <kmt_test.h>
|
|
#include <fltkernel.h>
|
|
|
|
//#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
/* prototypes */
|
|
static
|
|
FLT_PREOP_CALLBACK_STATUS
|
|
FLTAPI
|
|
TestFilterPreOperation(
|
|
_Inout_ PFLT_CALLBACK_DATA Data,
|
|
_In_ PCFLT_RELATED_OBJECTS FltObjects,
|
|
_Outptr_result_maybenull_ PVOID *CompletionContext
|
|
);
|
|
|
|
static
|
|
FLT_POSTOP_CALLBACK_STATUS
|
|
FLTAPI
|
|
TestFilterPostOperation(
|
|
_Inout_ PFLT_CALLBACK_DATA Data,
|
|
_In_ PCFLT_RELATED_OBJECTS FltObjects,
|
|
_In_opt_ PVOID CompletionContext,
|
|
_In_ FLT_POST_OPERATION_FLAGS Flags
|
|
);
|
|
|
|
|
|
/* Globals */
|
|
static PDRIVER_OBJECT TestDriverObject;
|
|
|
|
|
|
CONST FLT_OPERATION_REGISTRATION Callbacks[] =
|
|
{
|
|
{ IRP_MJ_CREATE,
|
|
0,
|
|
TestFilterPreOperation,
|
|
TestFilterPostOperation },
|
|
|
|
{ IRP_MJ_OPERATION_END }
|
|
};
|
|
|
|
|
|
NTSTATUS
|
|
TestEntry(
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PCUNICODE_STRING RegistryPath,
|
|
OUT PCWSTR *DeviceName,
|
|
IN OUT INT *Flags)
|
|
{
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PAGED_CODE();
|
|
|
|
UNREFERENCED_PARAMETER(RegistryPath);
|
|
UNREFERENCED_PARAMETER(Flags);
|
|
|
|
DPRINT("Entry!\n");
|
|
|
|
ok_irql(PASSIVE_LEVEL);
|
|
TestDriverObject = DriverObject;
|
|
|
|
*DeviceName = L"fltmgr_create";
|
|
|
|
trace("Hi, this is the filter manager create test driver\n");
|
|
|
|
(VOID)KmtFilterRegisterCallbacks(Callbacks);
|
|
|
|
return Status;
|
|
}
|
|
|
|
VOID
|
|
TestFilterUnload(
|
|
IN ULONG Flags)
|
|
{
|
|
PAGED_CODE();
|
|
|
|
DPRINT("Unload!\n");
|
|
|
|
ok_irql(PASSIVE_LEVEL);
|
|
|
|
trace("Unloading filter manager test driver\n");
|
|
}
|
|
|
|
VOID
|
|
TestQueryTeardown(
|
|
_In_ PCFLT_RELATED_OBJECTS FltObjects,
|
|
_In_ FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags)
|
|
{
|
|
UNREFERENCED_PARAMETER(FltObjects);
|
|
UNREFERENCED_PARAMETER(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
|
|
)
|
|
{
|
|
trace("Received an attach request for VolumeType 0x%X, FileSystemType %d\n",
|
|
VolumeDeviceType,
|
|
VolumeFilesystemType);
|
|
|
|
return STATUS_FLT_DO_NOT_ATTACH;
|
|
}
|
|
|
|
static
|
|
FLT_PREOP_CALLBACK_STATUS
|
|
FLTAPI
|
|
TestFilterPreOperation(
|
|
_Inout_ PFLT_CALLBACK_DATA Data,
|
|
_In_ PCFLT_RELATED_OBJECTS FltObjects,
|
|
_Outptr_result_maybenull_ PVOID *CompletionContext)
|
|
{
|
|
PFLT_IO_PARAMETER_BLOCK Iopb = Data->Iopb;
|
|
|
|
ok_eq_hex(Iopb->MajorFunction, IRP_MJ_CREATE);
|
|
|
|
return FLT_PREOP_SUCCESS_NO_CALLBACK;
|
|
}
|
|
|
|
static
|
|
FLT_POSTOP_CALLBACK_STATUS
|
|
FLTAPI
|
|
TestFilterPostOperation(
|
|
_Inout_ PFLT_CALLBACK_DATA Data,
|
|
_In_ PCFLT_RELATED_OBJECTS FltObjects,
|
|
_In_opt_ PVOID CompletionContext,
|
|
_In_ FLT_POST_OPERATION_FLAGS Flags)
|
|
{
|
|
PFLT_IO_PARAMETER_BLOCK Iopb = Data->Iopb;
|
|
|
|
ok_eq_hex(Iopb->MajorFunction, IRP_MJ_CREATE);
|
|
|
|
return FLT_POSTOP_FINISHED_PROCESSING;
|
|
} |