ReactOS  0.4.14-dev-52-g6116262
fltmgrint.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _FLT_OBJECT
 
struct  _ALLOCATE_CONTEXT_HEADER
 
struct  _FLT_RESOURCE_LIST_HEAD
 
struct  _FLT_MUTEX_LIST_HEAD
 
struct  _FLT_TYPE
 
struct  _FLTP_FRAME
 
struct  _FLT_FILTER
 
struct  _FLT_INSTANCE
 
struct  _TREE_ROOT
 
struct  _CONTEXT_LIST_CTRL
 
struct  _STREAM_LIST_CTRL
 
struct  _FLT_SERVER_PORT_OBJECT
 
struct  _FLT_MESSAGE_WAITER_QUEUE
 
struct  _FLT_PORT_OBJECT
 
struct  _CALLBACK_CTRL
 
struct  _NAME_CACHE_LIST_CTRL_STATS
 
struct  _NAME_CACHE_VOLUME_CTRL_STATS
 
struct  _NAME_CACHE_VOLUME_CTRL
 
struct  _FLT_VOLUME
 
struct  _MANAGER_CCB
 
struct  _FILTER_CCB
 
struct  _INSTANCE_CCB
 
struct  _VOLUME_CCB
 
struct  _PORT_CCB
 
union  _CCB_TYPE
 
struct  _FLT_CCB
 

Macros

#define MAX_CONTEXT_TYPES   6
 

Typedefs

typedef enum _FLT_OBJECT_FLAGS FLT_OBJECT_FLAGS
 
typedef enum _FLT_OBJECT_FLAGSPFLT_OBJECT_FLAGS
 
typedef enum _FLT_FILTER_FLAGS FLT_FILTER_FLAGS
 
typedef enum _FLT_FILTER_FLAGSPFLT_FILTER_FLAGS
 
typedef struct _FLT_OBJECT FLT_OBJECT
 
typedef struct _FLT_OBJECTPFLT_OBJECT
 
typedef struct _ALLOCATE_CONTEXT_HEADER ALLOCATE_CONTEXT_HEADER
 
typedef struct _ALLOCATE_CONTEXT_HEADERPALLOCATE_CONTEXT_HEADER
 
typedef struct _FLT_RESOURCE_LIST_HEAD FLT_RESOURCE_LIST_HEAD
 
typedef struct _FLT_RESOURCE_LIST_HEADPFLT_RESOURCE_LIST_HEAD
 
typedef struct _FLT_MUTEX_LIST_HEAD FLT_MUTEX_LIST_HEAD
 
typedef struct _FLT_MUTEX_LIST_HEADPFLT_MUTEX_LIST_HEAD
 
typedef struct _FLT_TYPE FLT_TYPE
 
typedef struct _FLT_TYPEPFLT_TYPE
 
typedef struct _FLTP_FRAME FLTP_FRAME
 
typedef struct _FLTP_FRAMEPFLTP_FRAME
 
typedef struct _FLT_FILTER FLT_FILTER
 
typedef struct _FLT_FILTERPFLT_FILTER
 
typedef enum _FLT_yINSTANCE_FLAGS FLT_INSTANCE_FLAGS
 
typedef enum _FLT_yINSTANCE_FLAGSPFLT_INSTANCE_FLAGS
 
typedef struct _FLT_INSTANCE FLT_INSTANCE
 
typedef struct _FLT_INSTANCEPFLT_INSTANCE
 
typedef struct _TREE_ROOT TREE_ROOT
 
typedef struct _TREE_ROOTPTREE_ROOT
 
typedef struct _CONTEXT_LIST_CTRL CONTEXT_LIST_CTRL
 
typedef struct _CONTEXT_LIST_CTRLPCONTEXT_LIST_CTRL
 
typedef struct _STREAM_LIST_CTRL STREAM_LIST_CTRL
 
typedef struct _STREAM_LIST_CTRLPSTREAM_LIST_CTRL
 
typedef struct _FLT_SERVER_PORT_OBJECT FLT_SERVER_PORT_OBJECT
 
typedef struct _FLT_SERVER_PORT_OBJECTPFLT_SERVER_PORT_OBJECT
 
typedef struct _FLT_MESSAGE_WAITER_QUEUE FLT_MESSAGE_WAITER_QUEUE
 
typedef struct _FLT_MESSAGE_WAITER_QUEUEPFLT_MESSAGE_WAITER_QUEUE
 
typedef struct _FLT_PORT_OBJECT FLT_PORT_OBJECT
 
typedef struct _FLT_PORT_OBJECTPFLT_PORT_OBJECT
 
typedef enum _FLT_VOLUME_FLAGS FLT_VOLUME_FLAGS
 
typedef enum _FLT_VOLUME_FLAGSPFLT_VOLUME_FLAGS
 
typedef enum _CALLBACK_NODE_FLAGS CALLBACK_NODE_FLAGS
 
typedef enum _CALLBACK_NODE_FLAGSPCALLBACK_NODE_FLAGS
 
typedef struct _CALLBACK_CTRL CALLBACK_CTRL
 
typedef struct _CALLBACK_CTRLPCALLBACK_CTRL
 
typedef struct _NAME_CACHE_LIST_CTRL_STATS NAME_CACHE_LIST_CTRL_STATS
 
typedef struct _NAME_CACHE_LIST_CTRL_STATSPNAME_CACHE_LIST_CTRL_STATS
 
typedef struct _NAME_CACHE_VOLUME_CTRL_STATS NAME_CACHE_VOLUME_CTRL_STATS
 
typedef struct _NAME_CACHE_VOLUME_CTRL_STATSPNAME_CACHE_VOLUME_CTRL_STATS
 
typedef struct _NAME_CACHE_VOLUME_CTRL NAME_CACHE_VOLUME_CTRL
 
typedef struct _NAME_CACHE_VOLUME_CTRLPNAME_CACHE_VOLUME_CTRL
 
typedef struct _FLT_VOLUME FLT_VOLUME
 
typedef struct _FLT_VOLUMEPFLT_VOLUME
 
typedef struct _MANAGER_CCB MANAGER_CCB
 
typedef struct _MANAGER_CCBPMANAGER_CCB
 
typedef struct _FILTER_CCB FILTER_CCB
 
typedef struct _FILTER_CCBPFILTER_CCB
 
typedef struct _INSTANCE_CCB INSTANCE_CCB
 
typedef struct _INSTANCE_CCBPINSTANCE_CCB
 
typedef struct _VOLUME_CCB VOLUME_CCB
 
typedef struct _VOLUME_CCBPVOLUME_CCB
 
typedef struct _PORT_CCB PORT_CCB
 
typedef struct _PORT_CCBPPORT_CCB
 
typedef union _CCB_TYPE CCB_TYPE
 
typedef union _CCB_TYPEPCCB_TYPE
 
typedef struct _FLT_CCB FLT_CCB
 
typedef struct _FLT_CCBPFLT_CCB
 

Enumerations

enum  _FLT_OBJECT_FLAGS {
  FLT_OBFL_DRAINING = 1, FLT_OBFL_ZOMBIED = 2, FLT_OBFL_TYPE_INSTANCE = 0x1000000, FLT_OBFL_TYPE_FILTER = 0x2000000,
  FLT_OBFL_TYPE_VOLUME = 0x4000000
}
 
enum  _FLT_FILTER_FLAGS { FLTFL_MANDATORY_UNLOAD_IN_PROGRESS = 1, FLTFL_FILTERING_INITIATED = 2 }
 
enum  _FLT_yINSTANCE_FLAGS { INSFL_CAN_BE_DETACHED = 0x01, INSFL_DELETING = 0x02, INSFL_INITING = 0x04 }
 
enum  _FLT_VOLUME_FLAGS {
  VOLFL_NETWORK_FILESYSTEM = 0x1, VOLFL_PENDING_MOUNT_SETUP_NOTIFIES = 0x2, VOLFL_MOUNT_SETUP_NOTIFIES_CALLED = 0x4, VOLFL_MOUNTING = 0x8,
  VOLFL_SENT_SHUTDOWN_IRP = 0x10, VOLFL_ENABLE_NAME_CACHING = 0x20, VOLFL_FILTER_EVER_ATTACHED = 0x40, VOLFL_STANDARD_LINK_NOT_SUPPORTED = 0x80
}
 
enum  _CALLBACK_NODE_FLAGS { CBNFL_SKIP_PAGING_IO = 0x1, CBNFL_SKIP_CACHED_IO = 0x2, CBNFL_USE_NAME_CALLBACK_EX = 0x4, CBNFL_SKIP_NON_DASD_IO = 0x8 }
 

Functions

VOID FltpExInitializeRundownProtection (_Out_ PEX_RUNDOWN_REF RundownRef)
 
BOOLEAN FltpExAcquireRundownProtection (_Inout_ PEX_RUNDOWN_REF RundownRef)
 
BOOLEAN FltpExReleaseRundownProtection (_Inout_ PEX_RUNDOWN_REF RundownRef)
 
NTSTATUS NTAPI FltpObjectRundownWait (_Inout_ PEX_RUNDOWN_REF RundownRef)
 
BOOLEAN FltpExRundownCompleted (_Inout_ PEX_RUNDOWN_REF RundownRef)
 
NTSTATUS FltpGetBaseDeviceObjectName (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PUNICODE_STRING ObjectName)
 
NTSTATUS FltpGetObjectName (_In_ PVOID Object, _Inout_ PUNICODE_STRING ObjectName)
 
ULONG FltpObjectPointerReference (_In_ PFLT_OBJECT Object)
 
VOID FltpObjectPointerDereference (_In_ PFLT_OBJECT Object)
 
NTSTATUS FltpReallocateUnicodeString (_In_ PUNICODE_STRING String, _In_ SIZE_T NewLength, _In_ BOOLEAN CopyExisting)
 
VOID FltpFreeUnicodeString (_In_ PUNICODE_STRING String)
 
NTSTATUS FltpDeviceControlHandler (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS FltpDispatchHandler (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS FltpMsgCreate (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS FltpMsgDispatch (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS FltpSetupCommunicationObjects (_In_ PDRIVER_OBJECT DriverObject)
 

Macro Definition Documentation

◆ MAX_CONTEXT_TYPES

#define MAX_CONTEXT_TYPES   6

Definition at line 5 of file fltmgrint.h.

Typedef Documentation

◆ ALLOCATE_CONTEXT_HEADER

◆ CALLBACK_CTRL

◆ CALLBACK_NODE_FLAGS

◆ CCB_TYPE

typedef union _CCB_TYPE CCB_TYPE

◆ CONTEXT_LIST_CTRL

◆ FILTER_CCB

◆ FLT_CCB

◆ FLT_FILTER

◆ FLT_FILTER_FLAGS

◆ FLT_INSTANCE

◆ FLT_INSTANCE_FLAGS

◆ FLT_MESSAGE_WAITER_QUEUE

◆ FLT_MUTEX_LIST_HEAD

◆ FLT_OBJECT

◆ FLT_OBJECT_FLAGS

◆ FLT_PORT_OBJECT

◆ FLT_RESOURCE_LIST_HEAD

◆ FLT_SERVER_PORT_OBJECT

◆ FLT_TYPE

◆ FLT_VOLUME

◆ FLT_VOLUME_FLAGS

◆ FLTP_FRAME

◆ INSTANCE_CCB

◆ MANAGER_CCB

◆ NAME_CACHE_LIST_CTRL_STATS

◆ NAME_CACHE_VOLUME_CTRL

◆ NAME_CACHE_VOLUME_CTRL_STATS

◆ PALLOCATE_CONTEXT_HEADER

◆ PCALLBACK_CTRL

◆ PCALLBACK_NODE_FLAGS

◆ PCCB_TYPE

typedef union _CCB_TYPE * PCCB_TYPE

◆ PCONTEXT_LIST_CTRL

◆ PFILTER_CCB

◆ PFLT_CCB

◆ PFLT_FILTER

◆ PFLT_FILTER_FLAGS

◆ PFLT_INSTANCE

◆ PFLT_INSTANCE_FLAGS

◆ PFLT_MESSAGE_WAITER_QUEUE

◆ PFLT_MUTEX_LIST_HEAD

◆ PFLT_OBJECT

◆ PFLT_OBJECT_FLAGS

◆ PFLT_PORT_OBJECT

◆ PFLT_RESOURCE_LIST_HEAD

◆ PFLT_SERVER_PORT_OBJECT

◆ PFLT_TYPE

◆ PFLT_VOLUME

◆ PFLT_VOLUME_FLAGS

◆ PFLTP_FRAME

◆ PINSTANCE_CCB

◆ PMANAGER_CCB

◆ PNAME_CACHE_LIST_CTRL_STATS

◆ PNAME_CACHE_VOLUME_CTRL

◆ PNAME_CACHE_VOLUME_CTRL_STATS

◆ PORT_CCB

◆ PPORT_CCB

◆ PSTREAM_LIST_CTRL

◆ PTREE_ROOT

◆ PVOLUME_CCB

◆ STREAM_LIST_CTRL

◆ TREE_ROOT

◆ VOLUME_CCB

Enumeration Type Documentation

◆ _CALLBACK_NODE_FLAGS

Enumerator
CBNFL_SKIP_PAGING_IO 
CBNFL_SKIP_CACHED_IO 
CBNFL_USE_NAME_CALLBACK_EX 
CBNFL_SKIP_NON_DASD_IO 

Definition at line 243 of file fltmgrint.h.

244 {
245  CBNFL_SKIP_PAGING_IO = 0x1,
246  CBNFL_SKIP_CACHED_IO = 0x2,
249 
enum _CALLBACK_NODE_FLAGS * PCALLBACK_NODE_FLAGS
enum _CALLBACK_NODE_FLAGS CALLBACK_NODE_FLAGS

◆ _FLT_FILTER_FLAGS

Enumerator
FLTFL_MANDATORY_UNLOAD_IN_PROGRESS 
FLTFL_FILTERING_INITIATED 

Definition at line 18 of file fltmgrint.h.

19 {
22 
enum _FLT_FILTER_FLAGS FLT_FILTER_FLAGS
enum _FLT_FILTER_FLAGS * PFLT_FILTER_FLAGS

◆ _FLT_OBJECT_FLAGS

Enumerator
FLT_OBFL_DRAINING 
FLT_OBFL_ZOMBIED 
FLT_OBFL_TYPE_INSTANCE 
FLT_OBFL_TYPE_FILTER 
FLT_OBFL_TYPE_VOLUME 

Definition at line 8 of file fltmgrint.h.

9 {
11  FLT_OBFL_ZOMBIED = 2,
12  FLT_OBFL_TYPE_INSTANCE = 0x1000000,
13  FLT_OBFL_TYPE_FILTER = 0x2000000,
14  FLT_OBFL_TYPE_VOLUME = 0x4000000
15 
enum _FLT_OBJECT_FLAGS * PFLT_OBJECT_FLAGS
enum _FLT_OBJECT_FLAGS FLT_OBJECT_FLAGS

◆ _FLT_VOLUME_FLAGS

Enumerator
VOLFL_NETWORK_FILESYSTEM 
VOLFL_PENDING_MOUNT_SETUP_NOTIFIES 
VOLFL_MOUNT_SETUP_NOTIFIES_CALLED 
VOLFL_MOUNTING 
VOLFL_SENT_SHUTDOWN_IRP 
VOLFL_ENABLE_NAME_CACHING 
VOLFL_FILTER_EVER_ATTACHED 
VOLFL_STANDARD_LINK_NOT_SUPPORTED 

Definition at line 229 of file fltmgrint.h.

◆ _FLT_yINSTANCE_FLAGS

Enumerator
INSFL_CAN_BE_DETACHED 
INSFL_DELETING 
INSFL_INITING 

Definition at line 127 of file fltmgrint.h.

128 {
129  INSFL_CAN_BE_DETACHED = 0x01,
130  INSFL_DELETING = 0x02,
131  INSFL_INITING = 0x04
132 
enum _FLT_yINSTANCE_FLAGS * PFLT_INSTANCE_FLAGS
enum _FLT_yINSTANCE_FLAGS FLT_INSTANCE_FLAGS

Function Documentation

◆ FltpDeviceControlHandler()

NTSTATUS FltpDeviceControlHandler ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 37 of file Dispatch.c.

39 {
40  PIO_STACK_LOCATION StackPtr;
43 
46 
47  ControlCode = StackPtr->Parameters.DeviceIoControl.IoControlCode;
48  switch (ControlCode)
49  {
50  case IOCTL_FILTER_LOAD:
52  break;
53 
56  break;
57 
60  break;
61 
64  break;
65 
68  break;
69 
72  break;
73 
76  break;
77 
80  break;
81 
84  break;
85 
88  break;
89 
92  break;
93 
94  default:
96  break;
97  }
98 
99  return Status;
100 }
#define IOCTL_FILTER_GET_INFO
Definition: fltmgr_shared.h:13
#define IOCTL_FILTER_SEND_MESSAGE
Definition: fltmgr_shared.h:8
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define IOCTL_FILTER_ATTATCH
Definition: fltmgr_shared.h:6
#define IOCTL_FILTER_CREATE
Definition: fltmgr_shared.h:5
#define IOCTL_FILTER_UNLOAD
Definition: fltmgr_shared.h:4
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
#define IOCTL_FILTER_GET_MESSAGE
Definition: fltmgr_shared.h:9
NTSTATUS HandleLoadUnloadIoctl(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Dispatch.c:119
#define IOCTL_FILTER_DETATCH
Definition: fltmgr_shared.h:7
#define IOCTL_FILTER_REPLY_MESSAGE
Definition: fltmgr_shared.h:10
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define IOCTL_FILTER_FIND_FIRST
Definition: fltmgr_shared.h:11
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
#define IOCTL_FILTER_FIND_NEXT
Definition: fltmgr_shared.h:12
#define IOCTL_FILTER_LOAD
Definition: fltmgr_shared.h:3
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpDeviceControl().

◆ FltpDispatchHandler()

NTSTATUS FltpDispatchHandler ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 103 of file Dispatch.c.

105 {
106  PIO_STACK_LOCATION StackPtr;
107  StackPtr = IoGetCurrentIrpStackLocation(Irp);
108  UNREFERENCED_PARAMETER(StackPtr);
109 
110  // implement me
111 
112  return STATUS_SUCCESS;
113 }
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by FltpDispatch().

◆ FltpExAcquireRundownProtection()

BOOLEAN FltpExAcquireRundownProtection ( _Inout_ PEX_RUNDOWN_REF  RundownRef)

Definition at line 218 of file Object.c.

219 {
220  return ExAcquireRundownProtection(RundownRef);
221 }
#define ExAcquireRundownProtection
Definition: ex.h:130

Referenced by FltObjectReference().

◆ FltpExInitializeRundownProtection()

VOID FltpExInitializeRundownProtection ( _Out_ PEX_RUNDOWN_REF  RundownRef)

Definition at line 212 of file Object.c.

213 {
214  ExInitializeRundownProtection(RundownRef);
215 }
NTKERNELAPI VOID FASTCALL ExInitializeRundownProtection(_Out_ PEX_RUNDOWN_REF RunRef)

◆ FltpExReleaseRundownProtection()

BOOLEAN FltpExReleaseRundownProtection ( _Inout_ PEX_RUNDOWN_REF  RundownRef)

Definition at line 224 of file Object.c.

225 {
226  ExReleaseRundownProtection(RundownRef);
227  return TRUE;
228 }
#define TRUE
Definition: types.h:120
NTKERNELAPI VOID FASTCALL ExReleaseRundownProtection(_Inout_ PEX_RUNDOWN_REF RunRef)

Referenced by FltObjectDereference().

◆ FltpExRundownCompleted()

BOOLEAN FltpExRundownCompleted ( _Inout_ PEX_RUNDOWN_REF  RundownRef)

Definition at line 231 of file Object.c.

232 {
233  return _InterlockedExchange((PLONG)RundownRef, 1);
234 }
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
signed int * PLONG
Definition: retypes.h:5

◆ FltpFreeUnicodeString()

VOID FltpFreeUnicodeString ( _In_ PUNICODE_STRING  String)

Definition at line 24 of file Lib.c.

25 {
26  /* Free up any existing buffer */
27  if (String->Buffer)
28  {
30  }
31 
32  /* Empty the string */
33  String->Buffer = NULL;
34  String->Length = 0;
35  String->MaximumLength = 0;
36 }
static WCHAR String[]
Definition: stringtable.c:55
#define FM_TAG_UNICODE_STRING
Definition: fltmgr.h:18
smooth NULL
Definition: ftsmooth.c:416
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ FltpGetBaseDeviceObjectName()

NTSTATUS FltpGetBaseDeviceObjectName ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PUNICODE_STRING  ObjectName 
)

Definition at line 245 of file Object.c.

247 {
248  PDEVICE_OBJECT BaseDeviceObject;
250 
251  /*
252  * Get the lowest device object on the stack, which may be the
253  * object we were passed, and lookup the name for that object
254  */
255  BaseDeviceObject = IoGetDeviceAttachmentBaseRef(DeviceObject);
256  Status = FltpGetObjectName(BaseDeviceObject, ObjectName);
257  ObDereferenceObject(BaseDeviceObject);
258 
259  return Status;
260 }
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:62
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1419
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS FltpGetObjectName(_In_ PVOID Object, _Inout_ PUNICODE_STRING ObjectName)
Definition: Object.c:263

◆ FltpGetObjectName()

NTSTATUS FltpGetObjectName ( _In_ PVOID  Object,
_Inout_ PUNICODE_STRING  ObjectName 
)

Definition at line 263 of file Object.c.

265 {
266  POBJECT_NAME_INFORMATION ObjectNameInfo = NULL;
267  OBJECT_NAME_INFORMATION LocalNameInfo;
270 
271  if (ObjectName == NULL)
273 
274  /* Get the size of the buffer required to hold the nameinfo */
276  &LocalNameInfo,
277  sizeof(LocalNameInfo),
278  &ReturnLength);
280  {
281  ObjectNameInfo = ExAllocatePoolWithTag(PagedPool,
282  ReturnLength,
284  if (ObjectNameInfo == NULL) return STATUS_INSUFFICIENT_RESOURCES;
285 
286  /* Get the actual name info now we have the buffer to hold it */
288  ObjectNameInfo,
289  ReturnLength,
290  &ReturnLength);
291  }
292 
293 
294  if (NT_SUCCESS(Status))
295  {
296  /* Make sure the buffer we were passed is large enough to hold the string */
297  if (ObjectName->MaximumLength < ObjectNameInfo->Name.Length)
298  {
299  /* It wasn't, let's enlarge the buffer */
301  ObjectNameInfo->Name.Length,
302  FALSE);
303 
304  }
305 
306  if (NT_SUCCESS(Status))
307  {
308  /* Copy the object name into the callers buffer */
309  RtlCopyUnicodeString(ObjectName, &ObjectNameInfo->Name);
310  }
311  }
312 
313  if (ObjectNameInfo)
314  {
315  ExFreePoolWithTag(ObjectNameInfo, FM_TAG_UNICODE_STRING);
316  }
317 
318  return Status;
319 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ObQueryNameString(IN PVOID Object, OUT POBJECT_NAME_INFORMATION ObjectNameInfo, IN ULONG Length, OUT PULONG ReturnLength)
Definition: obname.c:1209
UNICODE_STRING Name
Definition: nt_native.h:1270
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:62
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FM_TAG_UNICODE_STRING
Definition: fltmgr.h:18
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS FltpReallocateUnicodeString(_In_ PUNICODE_STRING String, _In_ SIZE_T NewLength, _In_ BOOLEAN CopyExisting)
Definition: Lib.c:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static IUnknown Object
Definition: main.c:512
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by FltpGetBaseDeviceObjectName().

◆ FltpMsgCreate()

NTSTATUS FltpMsgCreate ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 223 of file Messaging.c.

225 {
226  PIO_STACK_LOCATION StackPtr;
228 
229  /* Get the stack location */
230  StackPtr = IoGetCurrentIrpStackLocation(Irp);
231 
232  FLT_ASSERT(StackPtr->MajorFunction == IRP_MJ_CREATE);
233 
234  /* Check if this is a caller wanting to connect */
235  if (StackPtr->MajorFunction == IRP_MJ_CREATE)
236  {
237  /* Create the client port for this connection and exit */
238  Status = CreateClientPort(StackPtr->FileObject, Irp);
239  }
240  else
241  {
243  }
244 
245  if (Status != STATUS_PENDING)
246  {
247  Irp->IoStatus.Status = Status;
248  Irp->IoStatus.Information = 0;
250  }
251 
252  return Status;
253 }
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
static NTSTATUS CreateClientPort(_In_ PFILE_OBJECT FileObject, _Inout_ PIRP Irp)
Definition: Messaging.c:617
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpCreate().

◆ FltpMsgDispatch()

NTSTATUS FltpMsgDispatch ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 256 of file Messaging.c.

258 {
259  PIO_STACK_LOCATION StackPtr;
261 
262  /* Get the stack location */
263  StackPtr = IoGetCurrentIrpStackLocation(Irp);
264 
265  /* Check if this is a caller wanting to connect */
266  if (StackPtr->MajorFunction == IRP_MJ_CLOSE)
267  {
268  /* Create the client port for this connection and exit */
269  Status = CloseClientPort(StackPtr->FileObject, Irp);
270  }
271  else
272  {
273  // We don't support anything else yet
275  }
276 
277  if (Status != STATUS_PENDING)
278  {
279  Irp->IoStatus.Status = Status;
280  Irp->IoStatus.Information = 0;
282  }
283 
284  return Status;
285 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
static NTSTATUS CloseClientPort(_In_ PFILE_OBJECT FileObject, _Inout_ PIRP Irp)
Definition: Messaging.c:764

Referenced by FltpDispatch().

◆ FltpObjectPointerDereference()

VOID FltpObjectPointerDereference ( _In_ PFLT_OBJECT  Object)

Definition at line 335 of file Object.c.

336 {
337  if (InterlockedDecrementSizeT(&Object->PointerCount) == 0)
338  {
339  // Cleanup
340  FLT_ASSERT(FALSE);
341  }
342 }
static IUnknown Object
Definition: main.c:512
#define InterlockedDecrementSizeT(a)
Definition: interlocked.h:153
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpServerPortDelete().

◆ FltpObjectPointerReference()

ULONG FltpObjectPointerReference ( _In_ PFLT_OBJECT  Object)

Definition at line 322 of file Object.c.

323 {
324  PULONG Result;
325 
326  /* Store the old count and increment */
327  Result = &Object->PointerCount;
328  InterlockedIncrementSizeT(&Object->PointerCount);
329 
330  /* Return the initial value */
331  return *Result;
332 }
#define InterlockedIncrementSizeT(a)
Definition: interlocked.h:220
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
static IUnknown Object
Definition: main.c:512
unsigned int * PULONG
Definition: retypes.h:1

Referenced by _IRQL_requires_max_().

◆ FltpObjectRundownWait()

NTSTATUS NTAPI FltpObjectRundownWait ( _Inout_ PEX_RUNDOWN_REF  RundownRef)

Definition at line 238 of file Object.c.

239 {
240  //return FltpExWaitForRundownProtectionRelease(RundownRef);
241  return 0;
242 }

◆ FltpReallocateUnicodeString()

NTSTATUS FltpReallocateUnicodeString ( _In_ PUNICODE_STRING  String,
_In_ SIZE_T  NewLength,
_In_ BOOLEAN  CopyExisting 
)

Definition at line 39 of file Lib.c.

42 {
43  PWCH NewBuffer;
44 
45  /* Don't bother reallocating if the buffer is smaller */
46  if (NewLength <= String->MaximumLength)
47  {
48  String->Length = 0;
49  return STATUS_SUCCESS;
50  }
51 
52  /* Allocate a new buffer at the size requested */
54  if (NewBuffer == NULL) return STATUS_INSUFFICIENT_RESOURCES;
55 
56  if (CopyExisting)
57  {
58  /* Copy the old data across */
59  RtlCopyMemory(NewBuffer, String->Buffer, String->Length);
60  }
61  else
62  {
63  /* Reset the length */
64  String->Length = 0;
65  }
66 
67  /* Free any old buffer */
68  if (String->Buffer)
70 
71  /* Update the lengths */
72  String->Buffer = NewBuffer;
73  String->MaximumLength = NewLength;
74 
75  return STATUS_SUCCESS;
76 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static WCHAR String[]
Definition: stringtable.c:55
static USHORT USHORT * NewLength
#define FM_TAG_UNICODE_STRING
Definition: fltmgr.h:18
smooth NULL
Definition: ftsmooth.c:416
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
WCHAR * PWCH
Definition: ntbasedef.h:417
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ FltpSetupCommunicationObjects()

NTSTATUS FltpSetupCommunicationObjects ( _In_ PDRIVER_OBJECT  DriverObject)

Definition at line 377 of file Messaging.c.

378 {
379  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
380  UNICODE_STRING SymLinkName;
383 
385  {
390  };
391 
392  /* Create the server comms object type */
393  RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER));
394  RtlInitUnicodeString(&Name, L"FilterConnectionPort");
395  ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER);
396  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
397  ObjectTypeInitializer.GenericMapping = Mapping;
398  ObjectTypeInitializer.PoolType = NonPagedPool;
399  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_SERVER_PORT_OBJECT);
400  ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL;
401  ObjectTypeInitializer.CloseProcedure = FltpServerPortClose;
402  ObjectTypeInitializer.DeleteProcedure = FltpServerPortDelete;
403  Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ServerPortObjectType);
404  if (!NT_SUCCESS(Status)) return Status;
405 
406  /* Create the client comms object type */
407  RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER));
408  RtlInitUnicodeString(&Name, L"FilterCommunicationPort");
409  ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER);
410  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
411  ObjectTypeInitializer.GenericMapping = Mapping;
412  ObjectTypeInitializer.PoolType = NonPagedPool;
413  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_PORT_OBJECT);
414  ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL;
415  ObjectTypeInitializer.CloseProcedure = FltpClientPortClose;
416  ObjectTypeInitializer.DeleteProcedure = FltpClientPortDelete;
417  Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ClientPortObjectType);
418  if (!NT_SUCCESS(Status))
419  {
420  goto Quit;
421  }
422 
423  /* Create the device object */
425  0,
428  0,
429  0,
431  if (NT_SUCCESS(Status))
432  {
433  /* Setup a symbolic link for the device */
434  RtlInitUnicodeString(&SymLinkName, L"\\DosDevices\\FltMgrMsg");
435  Status = IoCreateSymbolicLink(&SymLinkName, &CommsDeviceName);
436  }
437 
438 Quit:
439  if (!NT_SUCCESS(Status))
440  {
441  /* Something went wrong, undo */
442  if (CommsDeviceObject)
443  {
446  }
448  {
452  }
453 
455  {
459  }
460  }
461 
462  return Status;
463 }
#define FLT_PORT_ALL_ACCESS
Definition: fltkernel.h:836
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
#define GENERIC_ALL
Definition: nt_native.h:92
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
VOID NTAPI FltpClientPortDelete(PVOID Object)
Definition: Messaging.c:369
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
struct _FLT_PORT_OBJECT FLT_PORT_OBJECT
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI FltpServerPortDelete(PVOID Object)
Definition: Messaging.c:317
PDEVICE_OBJECT CommsDeviceObject
Definition: Messaging.c:22
#define OBJ_OPENLINK
Definition: winternl.h:230
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
struct _OBJECT_TYPE_INITIALIZER OBJECT_TYPE_INITIALIZER
UNICODE_STRING CommsDeviceName
Definition: Messaging.c:21
POBJECT_TYPE ClientPortObjectType
Definition: Messaging.c:25
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
VOID NTAPI FltpServerPortClose(_In_opt_ PEPROCESS Process, _In_ PVOID Object, _In_ ACCESS_MASK GrantedAccess, _In_ ULONG ProcessHandleCount, _In_ ULONG SystemHandleCount)
Definition: Messaging.c:289
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
VOID NTAPI FltpClientPortClose(_In_opt_ PEPROCESS Process, _In_ PVOID Object, _In_ ACCESS_MASK GrantedAccess, _In_ ULONG ProcessHandleCount, _In_ ULONG SystemHandleCount)
Definition: Messaging.c:327
POBJECT_TYPE ServerPortObjectType
Definition: Messaging.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
#define FILE_DEVICE_WPD
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
struct _FLT_SERVER_PORT_OBJECT FLT_SERVER_PORT_OBJECT
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
VOID NTAPI ObMakeTemporaryObject(IN PVOID ObjectBody)
Definition: oblife.c:1361

Referenced by DriverEntry().