Author: gedmurphy
Date: Tue Sep 6 16:59:11 2016
New Revision: 72595
URL:
http://svn.reactos.org/svn/reactos?rev=72595&view=rev
Log:
[FLTMGR]
- Add stubs for context registration
- Add dispatch and device control handlers
- Implement the load IOCTL. We can now load minifilters with 'fltmc load
<myfilter>'
Added:
trunk/reactos/drivers/filters/fltmgr/Context.c (with props)
trunk/reactos/drivers/filters/fltmgr/Dispatch.c (with props)
Added: trunk/reactos/drivers/filters/fltmgr/Context.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/Con…
==============================================================================
--- trunk/reactos/drivers/filters/fltmgr/Context.c (added)
+++ trunk/reactos/drivers/filters/fltmgr/Context.c [iso-8859-1] Tue Sep 6 16:59:11 2016
@@ -0,0 +1,79 @@
+/*
+* PROJECT: Filesystem Filter Manager
+* LICENSE: GPL - See COPYING in the top level directory
+* FILE: drivers/filters/fltmgr/Context.c
+* PURPOSE: Contains context routines
+* PROGRAMMERS: Ged Murphy (gedmurphy(a)reactos.org)
+*/
+
+/* INCLUDES ******************************************************************/
+
+#include "fltmgr.h"
+#include "fltmgrint.h"
+
+#define NDEBUG
+#include <debug.h>
+
+
+/* DATA *********************************************************************/
+
+static
+BOOLEAN
+IsContextTypeValid(
+ _In_ FLT_CONTEXT_TYPE ContextType
+);
+
+static
+NTSTATUS
+SetupContextHeader(
+ _In_ PFLT_FILTER Filter,
+ _In_ PFLT_CONTEXT_REGISTRATION ContextPtr,
+ _Out_ PALLOCATE_CONTEXT_HEADER ContextHeader
+);
+
+/* EXPORTED FUNCTIONS ******************************************************/
+
+
+
+
+/* INTERNAL FUNCTIONS ******************************************************/
+
+
+NTSTATUS
+FltpRegisterContexts(_In_ PFLT_FILTER Filter,
+ _In_ const FLT_CONTEXT_REGISTRATION *Context)
+{
+ UNREFERENCED_PARAMETER(Filter);
+ UNREFERENCED_PARAMETER(Context);
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* PRIVATE FUNCTIONS ******************************************************/
+
+static
+BOOLEAN
+IsContextTypeValid(_In_ FLT_CONTEXT_TYPE ContextType)
+{
+ switch (ContextType)
+ {
+ case FLT_VOLUME_CONTEXT:
+ case FLT_INSTANCE_CONTEXT:
+ case FLT_FILE_CONTEXT:
+ case FLT_STREAM_CONTEXT:
+ case FLT_STREAMHANDLE_CONTEXT:
+ case FLT_TRANSACTION_CONTEXT:
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static
+NTSTATUS
+SetupContextHeader(_In_ PFLT_FILTER Filter,
+ _In_ PFLT_CONTEXT_REGISTRATION ContextPtr,
+ _Out_ PALLOCATE_CONTEXT_HEADER ContextHeader)
+{
+ return 0;
+}
Propchange: trunk/reactos/drivers/filters/fltmgr/Context.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/drivers/filters/fltmgr/Dispatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/Dis…
==============================================================================
--- trunk/reactos/drivers/filters/fltmgr/Dispatch.c (added)
+++ trunk/reactos/drivers/filters/fltmgr/Dispatch.c [iso-8859-1] Tue Sep 6 16:59:11 2016
@@ -0,0 +1,129 @@
+/*
+* PROJECT: Filesystem Filter Manager
+* LICENSE: GPL - See COPYING in the top level directory
+* FILE: drivers/filters/fltmgr/Dispatch.c
+* PURPOSE: Contains dispatch handler routines
+* PROGRAMMERS: Ged Murphy (gedmurphy(a)reactos.org)
+*/
+
+/* INCLUDES ******************************************************************/
+
+#include "fltmgr.h"
+#include "fltmgrint.h"
+#include "fltmgr_shared.h"
+
+#define NDEBUG
+#include <debug.h>
+
+
+/* DATA *********************************************************************/
+
+NTSTATUS
+HandleLoadUnloadIoctl(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp
+);
+
+NTSTATUS
+HandleFindFirstIoctl(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp
+);
+
+
+/* sdsfds *******************************************************************/
+
+NTSTATUS
+FltpDeviceControlHandler(_In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp)
+{
+ PIO_STACK_LOCATION StackPtr;
+ ULONG ControlCode;
+ NTSTATUS Status;
+
+ StackPtr = IoGetCurrentIrpStackLocation(Irp);
+ FLT_ASSERT(StackPtr->MajorFunction == IRP_MJ_DEVICE_CONTROL);
+
+ ControlCode = StackPtr->Parameters.DeviceIoControl.IoControlCode;
+ switch (ControlCode)
+ {
+ case IOCTL_LOAD_FILTER:
+ Status = HandleLoadUnloadIoctl(DeviceObject, Irp);
+ break;
+
+ case IOCTL_UNLOAD_FILTER:
+ Status = HandleLoadUnloadIoctl(DeviceObject, Irp);
+ break;
+
+ case IOCTL_FIND_FIRST_FILTER:
+ Status = HandleFindFirstIoctl(DeviceObject, Irp);
+ break;
+
+ default:
+ Status = STATUS_INVALID_PARAMETER;
+ break;
+ }
+
+ return Status;
+}
+
+NTSTATUS
+FltpDispatchHandler(_In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp)
+{
+ PIO_STACK_LOCATION StackPtr;
+ StackPtr = IoGetCurrentIrpStackLocation(Irp);
+ UNREFERENCED_PARAMETER(StackPtr);
+
+ // implement me
+
+ return STATUS_SUCCESS;
+}
+
+
+/* INTERNAL FUNCTIONS ******************************************************/
+
+NTSTATUS
+HandleLoadUnloadIoctl(_In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp)
+{
+ PIO_STACK_LOCATION StackPtr;
+ UNICODE_STRING Name;
+ PFILTER_NAME FilterName;
+ ULONG BufferLength;
+ ULONG ControlCode;
+
+ /* Get the IOCTL data from the stack pointer */
+ StackPtr = IoGetCurrentIrpStackLocation(Irp);
+ BufferLength = StackPtr->Parameters.DeviceIoControl.InputBufferLength;
+ ControlCode = StackPtr->Parameters.DeviceIoControl.IoControlCode;
+
+ FLT_ASSERT(ControlCode == IOCTL_LOAD_FILTER || ControlCode == IOCTL_UNLOAD_FILTER);
+
+ /* Make sure the buffer is valid */
+ if (BufferLength < sizeof(FILTER_NAME))
+ return STATUS_INVALID_PARAMETER;
+
+ /* Convert the file name buffer into a string */
+ FilterName = (PFILTER_NAME)Irp->AssociatedIrp.SystemBuffer;
+ Name.Length = FilterName->Length;
+ Name.MaximumLength = FilterName->Length;
+ Name.Buffer = (PWCH)((PCHAR)FilterName + FIELD_OFFSET(FILTER_NAME, FilterName[0]));
+
+ /* Forward the request to our Flt routines */
+ if (ControlCode == IOCTL_LOAD_FILTER)
+ {
+ return FltLoadFilter(&Name);
+ }
+ else
+ {
+ return FltUnloadFilter(&Name);
+ }
+}
+
+NTSTATUS
+HandleFindFirstIoctl(_In_ PDEVICE_OBJECT DeviceObject,
+ _Inout_ PIRP Irp)
+{
+ return STATUS_NOT_SUPPORTED;
+}
Propchange: trunk/reactos/drivers/filters/fltmgr/Dispatch.c
------------------------------------------------------------------------------
svn:eol-style = native