ReactOS  0.4.15-dev-3173-g40ee59d
Interface.c File Reference
#include "fltmgr.h"
#include "fltmgrint.h"
#include <debug.h>
Include dependency graph for Interface.c:

Go to the source code of this file.

Classes

struct  _DETACH_DEVICE_WORK_ITEM
 

Macros

#define VALID_FAST_IO_DISPATCH_HANDLER(_FastIoDispatchPtr, _FieldName)
 
#define IS_MY_DEVICE_OBJECT(_devObj)
 

Typedefs

typedef struct _DETACH_DEVICE_WORK_ITEM DETACH_DEVICE_WORK_ITEM
 
typedef struct _DETACH_DEVICE_WORK_ITEMPDETACH_DEVICE_WORK_ITEM
 

Functions

static VOID FltpCleanupDeviceObject (_In_ PDEVICE_OBJECT DeviceObject)
 
static NTSTATUS FltpAttachDeviceObject (_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice, _Out_ PDEVICE_OBJECT *AttachedToDeviceObject)
 
static BOOLEAN FltpIsAttachedToDevice (_In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PDEVICE_OBJECT *AttachedDeviceObject)
 
static NTSTATUS FltpEnumerateFileSystemVolumes (_In_ PDEVICE_OBJECT DeviceObject)
 
static NTSTATUS FltpAttachToFileSystemDevice (_In_ PDEVICE_OBJECT DeviceObject, _In_ PUNICODE_STRING DeviceName)
 
static LONG_PTR FltpDetachFromFileSystemDevice (_In_ PDEVICE_OBJECT DeviceObject)
 
NTSTATUS NTAPI FltpPreFsFilterOperation (_In_ PFS_FILTER_CALLBACK_DATA Data, _Out_ PVOID *CompletionContext)
 
VOID NTAPI FltpPostFsFilterOperation (_In_ PFS_FILTER_CALLBACK_DATA Data, _In_ NTSTATUS OperationStatus, _In_ PVOID CompletionContext)
 
NTSTATUS NTAPI FltpDispatch (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS NTAPI FltpCreate (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS NTAPI FltpFsControl (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
NTSTATUS NTAPI FltpDeviceControl (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
BOOLEAN NTAPI FltpFastIoCheckIfPossible (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _In_ BOOLEAN CheckForReadOperation, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoRead (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _Out_ PVOID Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoWrite (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _In_ PVOID Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoQueryBasicInfo (_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_BASIC_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoQueryStandardInfo (_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_STANDARD_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoLock (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PLARGE_INTEGER Length, _In_ PEPROCESS ProcessId, _In_ ULONG Key, _In_ BOOLEAN FailImmediately, _In_ BOOLEAN ExclusiveLock, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoUnlockSingle (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PLARGE_INTEGER Length, _In_ PEPROCESS ProcessId, _In_ ULONG Key, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoUnlockAll (_In_ PFILE_OBJECT FileObject, _In_ PEPROCESS ProcessId, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoUnlockAllByKey (_In_ PFILE_OBJECT FileObject, _In_ PVOID ProcessId, _In_ ULONG Key, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoDeviceControl (_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _In_opt_ PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_opt_ PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _In_ ULONG IoControlCode, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
VOID NTAPI FltpFastIoDetachDeviceWorker (_In_ PVOID Parameter)
 
VOID NTAPI FltpFastIoDetachDevice (_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice)
 
BOOLEAN NTAPI FltpFastIoQueryNetworkOpenInfo (_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoMdlRead (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoMdlReadComplete (_In_ PFILE_OBJECT FileObject, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoPrepareMdlWrite (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoMdlWriteComplete (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoReadCompressed (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PVOID Buffer, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _Out_ PCOMPRESSED_DATA_INFO CompressedDataInfo, _In_ ULONG CompressedDataInfoLength, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoWriteCompressed (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _In_ PVOID Buffer, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PCOMPRESSED_DATA_INFO CompressedDataInfo, _In_ ULONG CompressedDataInfoLength, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoMdlReadCompleteCompressed (_In_ PFILE_OBJECT FileObject, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoMdlWriteCompleteCompressed (_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FltpFastIoQueryOpen (_Inout_ PIRP Irp, _Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, _In_ PDEVICE_OBJECT DeviceObject)
 
VOID NTAPI FltpFsNotification (_In_ PDEVICE_OBJECT DeviceObject, _In_ BOOLEAN FsActive)
 
static NTSTATUS SetupDispatchAndCallbacksTables (_In_ PDRIVER_OBJECT DriverObject)
 
 CODE_SEG ("INIT")
 

Variables

PDEVICE_OBJECT CommsDeviceObject
 
LIST_ENTRY FilterList
 
ERESOURCE FilterListLock
 
DRIVER_DATA DriverData
 
DRIVER_FS_NOTIFICATION FltpFsNotification
 

Macro Definition Documentation

◆ IS_MY_DEVICE_OBJECT

#define IS_MY_DEVICE_OBJECT (   _devObj)
Value:
(((_devObj) != NULL) && \
((_devObj)->DeviceExtension != NULL))
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define NULL
Definition: types.h:112

Definition at line 26 of file Interface.c.

◆ VALID_FAST_IO_DISPATCH_HANDLER

#define VALID_FAST_IO_DISPATCH_HANDLER (   _FastIoDispatchPtr,
  _FieldName 
)
Value:
(((_FastIoDispatchPtr) != NULL) && \
(((_FastIoDispatchPtr)->SizeOfFastIoDispatch) >= \
(FIELD_OFFSET(FAST_IO_DISPATCH, _FieldName) + sizeof(void *))) && \
((_FastIoDispatchPtr)->_FieldName != NULL))
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112

Definition at line 20 of file Interface.c.

Typedef Documentation

◆ DETACH_DEVICE_WORK_ITEM

◆ PDETACH_DEVICE_WORK_ITEM

Function Documentation

◆ CODE_SEG()

CODE_SEG ( "INIT"  )

Definition at line 1810 of file Interface.c.

1817 {
1818  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\"DRIVER_NAME);
1819  PDEVICE_OBJECT RawDeviceObject;
1821  PFILE_OBJECT RawFileObject;
1823  UNICODE_STRING SymLink;
1824 
1825  NTSTATUS Status;
1826 
1829 
1830  /* Save the registry key for this driver */
1834  RegistryPath->MaximumLength,
1838 
1839  /* Do some initialization */
1841 
1842  /* Create the main filter manager device object */
1844  0,
1845  &DeviceName,
1848  FALSE,
1849  &DeviceObject);
1850  if (!NT_SUCCESS(Status))
1851  {
1852  DPRINT1("fltmgr IoCreateDevice failed. Status = %X\n", Status);
1853  goto Cleanup;
1854  }
1855 
1856  /* Store a global reference so we can access from callbacks */
1858 
1859  /* Generate the symbolic link name */
1860  RtlInitUnicodeString(&SymLink, L"\\??\\"DRIVER_NAME);
1861  Status = IoCreateSymbolicLink(&SymLink, &DeviceName);
1862  if (!NT_SUCCESS(Status)) goto Cleanup;
1863 
1864  /* Create the callbacks for the dispatch table, FastIo and FS callbacks */
1866  if (!NT_SUCCESS(Status)) goto Cleanup;
1867 
1868  /* Initialize the comms objects */
1870  if (!NT_SUCCESS(Status)) goto Cleanup;
1871 
1872  /* Register for notifications when a new file system is loaded. This also enumerates any existing file systems */
1874  FLT_ASSERT(Status != STATUS_DEVICE_ALREADY_ATTACHED); // Windows checks for this, I'm not sure how it can happen. Needs investigation??
1875  if (!NT_SUCCESS(Status)) goto Cleanup;
1876 
1879 
1880  /* IoRegisterFsRegistrationChange isn't notified about the raw file systems, so we attach to them manually */
1881  RtlInitUnicodeString(&ObjectName, L"\\Device\\RawDisk");
1884  &RawFileObject,
1885  &RawDeviceObject);
1886  if (NT_SUCCESS(Status))
1887  {
1888  FltpFsNotification(RawDeviceObject, TRUE);
1889  ObDereferenceObject(RawFileObject);
1890  }
1891 
1892  RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
1895  &RawFileObject,
1896  &RawDeviceObject);
1897  if (NT_SUCCESS(Status))
1898  {
1899  FltpFsNotification(RawDeviceObject, TRUE);
1900  ObDereferenceObject(RawFileObject);
1901  }
1902 
1903  /* We're done, clear the initializing flag */
1906 
1907 Cleanup:
1908 
1909  if (!NT_SUCCESS(Status))
1910  {
1912  {
1913  DriverObject->FastIoDispatch = NULL;
1915  }
1916 
1917  IoDeleteSymbolicLink(&SymLink);
1918 
1919  if (DeviceObject)
1921 
1924  }
1925 
1926  return Status;
1927 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LIST_ENTRY FilterList
Definition: Filter.c:24
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
ERESOURCE FilterListLock
Definition: Filter.c:25
uint16_t * PWCHAR
Definition: typedefs.h:56
_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)
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
DRIVER_DATA DriverData
Definition: Interface.c:35
#define FM_TAG_REGISTRY_DATA
Definition: fltmgr.h:18
#define FALSE
Definition: types.h:117
DRIVER_FS_NOTIFICATION FltpFsNotification
Definition: Interface.c:1699
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define ObDereferenceObject
Definition: obfuncs.h:203
* PFILE_OBJECT
Definition: iotypes.h:1998
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_NAME
Definition: ext2fs.h:136
static const WCHAR Cleanup[]
Definition: register.c:80
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
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:262
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define STATUS_SUCCESS
Definition: shellext.h:65
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
UNICODE_STRING ServiceKey
Definition: fltmgr.h:33
NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine)
Definition: volume.c:1089
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
static NTSTATUS SetupDispatchAndCallbacksTables(_In_ PDRIVER_OBJECT DriverObject)
Definition: Interface.c:1739
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ FltpAttachDeviceObject()

static NTSTATUS FltpAttachDeviceObject ( _In_ PDEVICE_OBJECT  SourceDevice,
_In_ PDEVICE_OBJECT  TargetDevice,
_Out_ PDEVICE_OBJECT AttachedToDeviceObject 
)
static

Definition at line 63 of file Interface.c.

66 {
68 
69  PAGED_CODE();
70 
71  /* Before attaching, copy the flags from the device we're going to attach to */
73  {
75  }
77  {
79  }
81  {
82  SetFlag(TargetDevice->Characteristics, FILE_DEVICE_SECURE_OPEN);
83  }
84 
85  /* Attach this device to the top of the driver stack */
88  AttachedToDeviceObject);
89 
90  return Status;
91 }
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:690
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT SourceDevice
Definition: iofuncs.h:690
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define DO_SYSTEM_BOOT_PARTITION
Definition: env_spec_w32.h:400
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define PAGED_CODE()

Referenced by FltpAttachToFileSystemDevice(), and FltpEnumerateFileSystemVolumes().

◆ FltpAttachToFileSystemDevice()

static NTSTATUS FltpAttachToFileSystemDevice ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PUNICODE_STRING  DeviceName 
)
static

Definition at line 324 of file Interface.c.

326 {
328  PDEVICE_OBJECT NewDeviceObject;
330  UNICODE_STRING FileSystemDeviceName;
331  UNICODE_STRING FsRecDeviceName;
333 
334  PAGED_CODE();
335 
336  /* Only handle device types we're interested in */
337  if (DeviceObject->DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM &&
340  {
341  return STATUS_SUCCESS;
342  }
343 
344  /* Setup the buffer to hold the device name */
345  RtlInitEmptyUnicodeString(&FileSystemDeviceName,
346  Buffer,
347  MAX_DEVNAME_LENGTH * sizeof(WCHAR));
348 
349  /* Get the the name of the file system device */
350  Status = FltpGetObjectName(DeviceObject->DriverObject, &FileSystemDeviceName);
351  if (!NT_SUCCESS(Status)) return Status;
352 
353  DPRINT("Found device %wZ, checking if we need to attach...\n", &FileSystemDeviceName);
354 
355  /* Build up the name of the file system recognizer device */
356  RtlInitUnicodeString(&FsRecDeviceName, L"\\FileSystem\\Fs_Rec");
357 
358  /* We don't attach to recognizer devices, so bail if this is one */
359  if (RtlCompareUnicodeString(&FileSystemDeviceName, &FsRecDeviceName, TRUE) == 0)
360  {
361  return STATUS_SUCCESS;
362  }
363 
364  /* Create a device object which we can attach to this file system */
366  sizeof(FLTMGR_DEVICE_EXTENSION),
367  NULL,
368  DeviceObject->DeviceType,
369  0,
370  FALSE,
371  &NewDeviceObject);
372  if (!NT_SUCCESS(Status))
373  {
374  DPRINT1("Failed to create a DO for attaching to a FS : 0x%X\n", Status);
375  return Status;
376  }
377 
378  /* Cast the device extension to something we understand */
379  DeviceExtension = NewDeviceObject->DeviceExtension;
380 
381  /* Attach this device to the top of the driver stack and store the DO we attached to in the DE */
382  Status = FltpAttachDeviceObject(NewDeviceObject,
383  DeviceObject,
384  &DeviceExtension->AttachedToDeviceObject);
385  if (NT_SUCCESS(Status))
386  {
387  DPRINT("Attached to %wZ\n", &FileSystemDeviceName);
388  }
389  else
390  {
391  DPRINT1("Failed to attach to the driver stack : 0x%X\n", Status);
392  goto Cleanup;
393  }
394 
395  /* Setup the unicode string buffer and copy the device name to the device extension */
396  RtlInitEmptyUnicodeString(&DeviceExtension->DeviceName,
397  DeviceExtension->DeviceNameBuffer,
398  MAX_DEVNAME_LENGTH * sizeof(WCHAR));
400 
401  /* We're done, remove the initializing flag */
402  ClearFlag(NewDeviceObject->Flags, DO_DEVICE_INITIALIZING);
403 
404  /* Look for existing mounted devices for this file system */
406  if (!NT_SUCCESS(Status))
407  {
408  DPRINT1("Failed to enumerate file system volumes for this file system : 0x%X\n", Status);
409  IoDetachDevice(DeviceExtension->AttachedToDeviceObject);
410  }
411 
412 Cleanup:
413 
414  if (!NT_SUCCESS(Status))
415  {
416  IoDeleteDevice(NewDeviceObject);
417  }
418 
419  return Status;
420 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
static NTSTATUS FltpAttachDeviceObject(_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice, _Out_ PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: Interface.c:63
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
static NTSTATUS FltpEnumerateFileSystemVolumes(_In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:146
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
DRIVER_DATA DriverData
Definition: Interface.c:35
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_DEVNAME_LENGTH
Definition: fltmgr.h:26
static const WCHAR L[]
Definition: oid.c:1250
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
static const WCHAR Cleanup[]
Definition: register.c:80
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define FILE_DEVICE_NETWORK_FILE_SYSTEM
Definition: winioctl.h:126
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:109
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 STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
NTSTATUS FltpGetObjectName(_In_ PVOID Object, _Inout_ PUNICODE_STRING ObjectName)
Definition: Object.c:263
#define PAGED_CODE()

Referenced by FltpFsNotification().

◆ FltpCleanupDeviceObject()

static VOID FltpCleanupDeviceObject ( _In_ PDEVICE_OBJECT  DeviceObject)
static

Definition at line 49 of file Interface.c.

50 {
52 
53  DeviceExtension = DeviceObject->DeviceExtension;
54  if (DeviceExtension)
55  {
56  // cleanup device extension
57  }
58 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
PVOID DeviceExtension
Definition: env_spec_w32.h:418

Referenced by FltpEnumerateFileSystemVolumes(), FltpFastIoDetachDevice(), and FltpFastIoDetachDeviceWorker().

◆ FltpCreate()

NTSTATUS NTAPI FltpCreate ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 551 of file Interface.c.

553 {
555 
556  PAGED_CODE();
557 
558  DeviceExtension = DeviceObject->DeviceExtension;
559 
560  /* Check if this is a request for us */
562  {
565 
566  /* Someone wants a handle to the fltmgr, allow it */
567  Irp->IoStatus.Status = STATUS_SUCCESS;
568  Irp->IoStatus.Information = 0;
570  return STATUS_SUCCESS;
571  }
572 
573  /* Check if this is a request for a the new comms connection */
575  {
576  /* Hand off to our internal routine */
577  return FltpMsgCreate(DeviceObject, Irp);
578  }
579 
581  DeviceExtension->AttachedToDeviceObject);
582 
583  DPRINT1("Received create from %wZ (%lu)\n", &DeviceExtension->DeviceName, PsGetCurrentProcessId());
584 
585  /* Just pass the IRP down the stack */
587  return IoCallDriver(DeviceExtension->AttachedToDeviceObject, Irp);
588 }
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
PDEVICE_OBJECT CommsDeviceObject
Definition: Messaging.c:22
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
VOID FASTCALL IofCompleteRequest(IN PIRP Irp, IN CCHAR PriorityBoost)
Definition: irp.c:1308
NTSTATUS FltpMsgCreate(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Messaging.c:223
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
#define STATUS_SUCCESS
Definition: shellext.h:65
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpDetachFromFileSystemDevice()

static LONG_PTR FltpDetachFromFileSystemDevice ( _In_ PDEVICE_OBJECT  DeviceObject)
static

Definition at line 425 of file Interface.c.

426 {
427  PDEVICE_OBJECT AttachedDevice, NextDevice;
429  LONG_PTR Count;
430 
431  PAGED_CODE();
432 
433  /* Get the top device in the chain and increment the ref count on it */
434  AttachedDevice = IoGetAttachedDeviceReference(DeviceObject);
435 
436  /* Loop all attached devices looking for our file system driver */
437  while (AttachedDevice->DriverObject != DriverData.DriverObject)
438  {
439  FLT_ASSERT(AttachedDevice != NULL);
440 
441  /* Get the next lower device object. This adds a ref on NextDevice */
442  NextDevice = IoGetLowerDeviceObject(AttachedDevice);
443 
444  /* Remove the reference we added */
445  Count = ObDereferenceObject(AttachedDevice);
446 
447  /* Bail if this is the last one */
448  if (NextDevice == NULL) return Count;
449 
450  /* Try the next one */
451  AttachedDevice = NextDevice;
452  }
453 
454 
455  DeviceExtension = AttachedDevice->DeviceExtension;
456  if (DeviceExtension)
457  {
458  //
459  // FIXME: Put any device extension cleanup code here
460  //
461  }
462 
463  /* Detach the device from the chain and delete the object */
465  IoDeleteDevice(AttachedDevice);
466 
467  /* Remove the reference we added so the delete can complete */
468  return ObDereferenceObject(AttachedDevice);
469 }
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1507
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
int Count
Definition: noreturn.cpp:7
#define ObDereferenceObject
Definition: obfuncs.h:203
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpFsNotification().

◆ FltpDeviceControl()

NTSTATUS NTAPI FltpDeviceControl ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 622 of file Interface.c.

624 {
627 
628  /* Check if the request was meant for us */
630  {
632  if (Status != STATUS_REPARSE)
633  {
634  Irp->IoStatus.Status = Status;
635  Irp->IoStatus.Information = 0;
637  }
638 
639  return Status;
640  }
641 
642  DeviceExtension = DeviceObject->DeviceExtension;
643 
645  DeviceExtension->AttachedToDeviceObject);
646 
647  /* Just pass the IRP down the stack */
649  return IoCallDriver(DeviceExtension->AttachedToDeviceObject, Irp);
650 }
LONG NTSTATUS
Definition: precomp.h:26
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
NTSTATUS FltpDeviceControlHandler(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Dispatch.c:37
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
#define STATUS_REPARSE
Definition: ntstatus.h:83
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpDispatch()

NTSTATUS NTAPI FltpDispatch ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 499 of file Interface.c.

501 {
503  PIO_STACK_LOCATION StackPtr;
505 
506  DeviceExtension = DeviceObject->DeviceExtension;
507 
508  /* Check if this is a request for us */
510  {
513 
514  /* Hand it off to our internal handler */
516  if (Status != STATUS_REPARSE)
517  {
518  Irp->IoStatus.Status = Status;
519  Irp->IoStatus.Information = 0;
521  }
522  return Status;
523  }
524 
525  /* Check if this is a request for a the messaging device */
527  {
528  /* Hand off to our internal routine */
530  }
531 
533  DeviceExtension->AttachedToDeviceObject);
534 
535  StackPtr = IoGetCurrentIrpStackLocation(Irp);
536  if (StackPtr->MajorFunction == IRP_MJ_SHUTDOWN)
537  {
538  // handle shutdown request
539  }
540 
541  DPRINT1("Received %X from %wZ\n", StackPtr->MajorFunction, &DeviceExtension->DeviceName);
542 
543  /* Just pass the IRP down the stack */
545  return IoCallDriver(DeviceExtension->AttachedToDeviceObject, Irp);
546 }
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
#define IRP_MJ_SHUTDOWN
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT CommsDeviceObject
Definition: Messaging.c:22
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define STATUS_REPARSE
Definition: ntstatus.h:83
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
NTSTATUS FltpDispatchHandler(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Dispatch.c:103
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
NTSTATUS FltpMsgDispatch(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Messaging.c:256
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpEnumerateFileSystemVolumes()

static NTSTATUS FltpEnumerateFileSystemVolumes ( _In_ PDEVICE_OBJECT  DeviceObject)
static

Definition at line 146 of file Interface.c.

147 {
148  PFLTMGR_DEVICE_EXTENSION NewDeviceExtension;
149  PDEVICE_OBJECT BaseDeviceObject;
150  PDEVICE_OBJECT NewDeviceObject;
152  PDEVICE_OBJECT StorageStackDeviceObject;
154  ULONG NumDevices;
155  ULONG i;
157 
158  PAGED_CODE();
159 
160  /* Get the base device */
161  BaseDeviceObject = IoGetDeviceAttachmentBaseRef(DeviceObject);
162 
163  /* get the number of device object linked to the base file system */
164  Status = IoEnumerateDeviceObjectList(BaseDeviceObject->DriverObject,
165  NULL,
166  0,
167  &NumDevices);
168  if (Status != STATUS_BUFFER_TOO_SMALL) return Status;
169 
170  /* Add a few more slots in case the size changed between calls and allocate some memory to hold the pointers */
171  NumDevices += 4;
173  (NumDevices * sizeof(PDEVICE_OBJECT)),
176 
177  /* Now get all the device objects that this base driver has created */
178  Status = IoEnumerateDeviceObjectList(BaseDeviceObject->DriverObject,
179  DeviceList,
180  (NumDevices * sizeof(PDEVICE_OBJECT)),
181  &NumDevices);
182  if (!NT_SUCCESS(Status))
183  {
185  return Status;
186  }
187 
188  /* Loop through all the devices looking for ones to attach to */
189  for (i = 0; i < NumDevices; i++)
190  {
192  StorageStackDeviceObject = NULL;
193  NewDeviceObject = NULL;
194 
195  /* Ignore the device we passed in, and devices of the wrong type */
196  if ((DeviceList[i] == BaseDeviceObject) ||
197  (DeviceList[i]->DeviceType != BaseDeviceObject->DeviceType))
198  {
199  goto CleanupAndNext;
200  }
201 
202  /* Ignore this device if we're already attached to it */
204  {
205  goto CleanupAndNext;
206  }
207 
208 
209  /*
210  * If the device has a name, it must be a control device.
211  * This handles drivers with more then one control device (like FastFat)
212  */
214  if (NT_SUCCESS(Status) && DeviceName.Length > 0)
215  {
216  goto CleanupAndNext;
217  }
218 
219  /*
220  * Try to get the storage stack (disk) device object associated with
221  * this file system device object. Ignore the device if we don't have one
222  */
224  &StorageStackDeviceObject);
225  if (!NT_SUCCESS(Status))
226  {
227  goto CleanupAndNext;
228  }
229 
230 
231  /*
232  * TODO: Don't attach to shadow copy volumes,
233  * ros doesn't have any so it's not an issues yet
234  */
235 
236  /*
237  * We're far enough to be ready to attach, create a device
238  * object which we'll use to do so
239  */
241  sizeof(FLTMGR_DEVICE_EXTENSION),
242  NULL,
244  0,
245  FALSE,
246  &NewDeviceObject);
247  if (!NT_SUCCESS(Status))
248  {
249  goto CleanupAndNext;
250  }
251 
252  /* Get the device extension for this new object and store our disk object there */
253  NewDeviceExtension = NewDeviceObject->DeviceExtension;
254  NewDeviceExtension->StorageStackDeviceObject = StorageStackDeviceObject;
255 
256  /* Lookup and store the device name for the storage stack */
257  RtlInitEmptyUnicodeString(&NewDeviceExtension->DeviceName,
258  NewDeviceExtension->DeviceNameBuffer,
259  sizeof(NewDeviceExtension->DeviceNameBuffer));
260  FltpGetObjectName(StorageStackDeviceObject,
261  &NewDeviceExtension->DeviceName);
262 
263 
264  /* Grab the attach lock before we attempt to attach */
266 
267  /* Check again that we aren't already attached. It may have changed since our last check */
269  {
270  FLT_ASSERT(NewDeviceObject->DriverObject == DriverData.DriverObject);
271 
272  /* Finally, attach to the volume */
274  NewDeviceObject,
275  &NewDeviceExtension->AttachedToDeviceObject);
276  if (NT_SUCCESS(Status))
277  {
278  /* Clean the initializing flag so other filters can attach to our device object */
279  ClearFlag(NewDeviceObject->Flags, DO_DEVICE_INITIALIZING);
280  }
281  }
282  else
283  {
284  /* We're already attached. Just cleanup */
286  }
287 
289 
290 CleanupAndNext:
291 
292  if (!NT_SUCCESS(Status))
293  {
294  if (NewDeviceObject)
295  {
296  FltpCleanupDeviceObject(NewDeviceObject);
297  IoDeleteDevice(NewDeviceObject);
298  }
299  }
300 
301  if (StorageStackDeviceObject)
302  {
303  /* A ref was added for us when we attached, so we can deref ours now */
304  ObDereferenceObject(StorageStackDeviceObject);
305  }
306 
307  /* Remove the ref which was added by IoEnumerateDeviceObjectList */
309 
310  /* Free the buffer that FltpGetBaseDeviceObjectName added */
312 
313  }
314 
315  /* Free the memory we allocated for the list */
317 
318  return STATUS_SUCCESS;
319 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
static NTSTATUS FltpAttachDeviceObject(_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice, _Out_ PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: Interface.c:63
#define FM_TAG_DEV_OBJ_PTRS
Definition: fltmgr.h:19
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
VOID FltpFreeUnicodeString(_In_ PUNICODE_STRING String)
Definition: Lib.c:24
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_LIST DeviceList
Definition: utils.c:27
PDEVICE_OBJECT StorageStackDeviceObject
Definition: fltmgr.h:49
NTSTATUS NTAPI IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT *DeviceObjectList, IN ULONG DeviceObjectListSize, OUT PULONG ActualNumberDeviceObjects)
Definition: device.c:1322
UNICODE_STRING DeviceName
Definition: fltmgr.h:53
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1419
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
DRIVER_DATA DriverData
Definition: Interface.c:35
#define FALSE
Definition: types.h:117
NTSTATUS FltpGetBaseDeviceObjectName(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PUNICODE_STRING ObjectName)
Definition: Object.c:245
PVOID DeviceExtension
Definition: env_spec_w32.h:418
DeviceType
Definition: mmdrv.h:41
static VOID FltpCleanupDeviceObject(_In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:49
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS NTAPI IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject, OUT PDEVICE_OBJECT *DiskDeviceObject)
Definition: device.c:1453
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
DWORD DeviceType
Definition: utils.c:20
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
#define NULL
Definition: types.h:112
PDEVICE_OBJECT AttachedToDeviceObject
Definition: fltmgr.h:46
unsigned int ULONG
Definition: retypes.h:1
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 STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
NTSTATUS FltpGetObjectName(_In_ PVOID Object, _Inout_ PUNICODE_STRING ObjectName)
Definition: Object.c:263
WCHAR DeviceNameBuffer[MAX_DEVNAME_LENGTH]
Definition: fltmgr.h:54
static BOOLEAN FltpIsAttachedToDevice(_In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PDEVICE_OBJECT *AttachedDeviceObject)
Definition: Interface.c:96
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpAttachToFileSystemDevice().

◆ FltpFastIoCheckIfPossible()

BOOLEAN NTAPI FltpFastIoCheckIfPossible ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ BOOLEAN  Wait,
_In_ ULONG  LockKey,
_In_ BOOLEAN  CheckForReadOperation,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 659 of file Interface.c.

668 {
672 
673  PAGED_CODE();
674 
675  /* If it doesn't have a device extension, then it's not our device object */
676  if (DeviceObject->DeviceExtension == NULL)
677  {
678  /* Fail the call */
680  IoStatus->Information = 0;
681  return TRUE;
682  }
683 
684  DeviceExtension = DeviceObject->DeviceExtension;
685  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
686 
687  /* Get the device that we attached to */
688  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
689  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
690 
691  /* Make sure our FastIo table is valid */
693  {
694  /* Forward the call onto the device we attached to */
696  FileOffset,
697  Length,
698  Wait,
699  LockKey,
701  IoStatus,
703  }
704 
705  /* We failed to handle the request, send it down the slow path */
706  FLT_ASSERT(FALSE);
707  return FALSE;
708 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
Definition: fatprocs.h:2662
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1734
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoDetachDevice()

VOID NTAPI FltpFastIoDetachDevice ( _In_ PDEVICE_OBJECT  SourceDevice,
_In_ PDEVICE_OBJECT  TargetDevice 
)

Definition at line 1184 of file Interface.c.

1186 {
1187  PDETACH_DEVICE_WORK_ITEM DetachDeviceWorkItem;
1188 
1189  PAGED_CODE();
1190 
1191  /*
1192  * Detaching and deleting devices is a lot of work and takes too long
1193  * to be a worthwhile FastIo candidate, so we defer this call to speed
1194  * it up. There's no return value so we're okay to do this.
1195  */
1196 
1197  /* Allocate the work item and it's corresponding data */
1198  DetachDeviceWorkItem = ExAllocatePoolWithTag(NonPagedPool,
1199  sizeof(DETACH_DEVICE_WORK_ITEM),
1200  0x1234);
1201  if (DetachDeviceWorkItem)
1202  {
1203  /* Initialize the work item */
1204  ExInitializeWorkItem(&DetachDeviceWorkItem->WorkItem,
1206  DetachDeviceWorkItem);
1207 
1208  /* Queue the work item and return the call */
1209  ExQueueWorkItem(&DetachDeviceWorkItem->WorkItem,
1211  }
1212  else
1213  {
1214  /* We failed to defer, just cleanup here */
1218  }
1219 
1220 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:690
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT SourceDevice
Definition: iofuncs.h:690
static VOID FltpCleanupDeviceObject(_In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:49
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI FltpFastIoDetachDeviceWorker(_In_ PVOID Parameter)
Definition: Interface.c:1164
#define PAGED_CODE()
WORK_QUEUE_ITEM WorkItem
Definition: Interface.c:39

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoDetachDeviceWorker()

VOID NTAPI FltpFastIoDetachDeviceWorker ( _In_ PVOID  Parameter)

Definition at line 1164 of file Interface.c.

1165 {
1166  PDETACH_DEVICE_WORK_ITEM DetachDeviceWorkItem = Parameter;
1167 
1168  /* Run any cleanup routines */
1169  FltpCleanupDeviceObject(DetachDeviceWorkItem->SourceDevice);
1170 
1171  /* Detach from the target device */
1172  IoDetachDevice(DetachDeviceWorkItem->TargetDevice);
1173 
1174  /* Delete the source */
1175  IoDeleteDevice(DetachDeviceWorkItem->SourceDevice);
1176 
1177  /* Free the pool we allocated in FltpFastIoDetachDevice */
1178  ExFreePoolWithTag(DetachDeviceWorkItem, 0x1234);
1179 }
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
_In_ PVOID Parameter
Definition: ldrtypes.h:241
static VOID FltpCleanupDeviceObject(_In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:49
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDEVICE_OBJECT SourceDevice
Definition: Interface.c:40
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PDEVICE_OBJECT TargetDevice
Definition: Interface.c:41

Referenced by FltpFastIoDetachDevice().

◆ FltpFastIoDeviceControl()

BOOLEAN NTAPI FltpFastIoDeviceControl ( _In_ PFILE_OBJECT  FileObject,
_In_ BOOLEAN  Wait,
_In_opt_ PVOID  InputBuffer,
_In_ ULONG  InputBufferLength,
_Out_opt_ PVOID  OutputBuffer,
_In_ ULONG  OutputBufferLength,
_In_ ULONG  IoControlCode,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1112 of file Interface.c.

1121 {
1125 
1126  PAGED_CODE();
1127 
1128  /* If it doesn't have a device extension, then it's not our device object */
1129  if (DeviceObject->DeviceExtension == NULL)
1130  {
1131  /* Fail the request, send it down the slow path */
1132  return FALSE;
1133  }
1134 
1135  DeviceExtension = DeviceObject->DeviceExtension;
1136  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1137 
1138  /* Get the device that we attached to */
1139  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1140  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1141 
1142  /* Make sure our FastIo table is valid */
1144  {
1145  /* Forward the call onto the device we attached to */
1147  Wait,
1148  InputBuffer,
1150  OutputBuffer,
1152  IoControlCode,
1153  IoStatus,
1155  }
1156 
1157  /* We failed to handle the request, send it down the slow path */
1158  FLT_ASSERT(FALSE);
1159  return FALSE;
1160 }
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:318
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:318
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl
Definition: iotypes.h:1743
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:318
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoLock()

BOOLEAN NTAPI FltpFastIoLock ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ PLARGE_INTEGER  Length,
_In_ PEPROCESS  ProcessId,
_In_ ULONG  Key,
_In_ BOOLEAN  FailImmediately,
_In_ BOOLEAN  ExclusiveLock,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 913 of file Interface.c.

922 {
926 
927  PAGED_CODE();
928 
929  /* If it doesn't have a device extension, then it's not our device object */
930  if (DeviceObject->DeviceExtension == NULL)
931  {
932  /* Fail the call */
934  IoStatus->Information = 0;
935  return TRUE;
936  }
937 
938  DeviceExtension = DeviceObject->DeviceExtension;
939  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
940 
941  /* Get the device that we attached to */
942  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
943  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
944 
945  /* Make sure our FastIo table is valid */
947  {
948  /* Forward the call onto the device we attached to */
950  FileOffset,
951  Length,
952  ProcessId,
953  Key,
956  IoStatus,
958  }
959 
960  /* We failed to handle the request, send it down the slow path */
961  FLT_ASSERT(FALSE);
962  return FALSE;
963 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
Definition: fatprocs.h:2709
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1739
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
Definition: fatprocs.h:2709
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoMdlRead()

BOOLEAN NTAPI FltpFastIoMdlRead ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ ULONG  LockKey,
_Out_ PMDL MdlChain,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1272 of file Interface.c.

1279 {
1283 
1284  PAGED_CODE();
1285 
1286  /* If it doesn't have a device extension, then it's not our device object */
1287  if (DeviceObject->DeviceExtension == NULL)
1288  {
1289  /* Fail the call */
1291  IoStatus->Information = 0;
1292  return TRUE;
1293  }
1294 
1295  DeviceExtension = DeviceObject->DeviceExtension;
1296  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1297 
1298  /* Get the device that we attached to */
1299  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1300  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1301 
1302  /* Make sure our FastIo table is valid */
1304  {
1305  /* Forward the call onto the device we attached to */
1307  FileOffset,
1308  Length,
1309  LockKey,
1310  MdlChain,
1311  IoStatus,
1313  }
1314 
1315  /* We failed to handle the request, send it down the slow path */
1316  FLT_ASSERT(FALSE);
1317  return FALSE;
1318 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
PFAST_IO_MDL_READ MdlRead
Definition: iotypes.h:1749
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoMdlReadComplete()

BOOLEAN NTAPI FltpFastIoMdlReadComplete ( _In_ PFILE_OBJECT  FileObject,
_In_ PMDL  MdlChain,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1323 of file Interface.c.

1327 {
1331 
1332  PAGED_CODE();
1333 
1334  /* If it doesn't have a device extension, then it's not our device object */
1335  if (DeviceObject->DeviceExtension == NULL)
1336  {
1337  /* Fail the request, send it down the slow path */
1338  return FALSE;
1339  }
1340 
1341  DeviceExtension = DeviceObject->DeviceExtension;
1342  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1343 
1344  /* Get the device that we attached to */
1345  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1346  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1347 
1348  /* Make sure our FastIo table is valid */
1350  {
1351  /* Forward the call onto the device we attached to */
1353  MdlChain,
1355  }
1356 
1357  /* We failed to handle the request, send it down the slow path */
1358  FLT_ASSERT(FALSE);
1359  return FALSE;
1360 }
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1750
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoMdlReadCompleteCompressed()

BOOLEAN NTAPI FltpFastIoMdlReadCompleteCompressed ( _In_ PFILE_OBJECT  FileObject,
_In_ PMDL  MdlChain,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1569 of file Interface.c.

1572 {
1576 
1577  PAGED_CODE();
1578 
1579  /* If it doesn't have a device extension, then it's not our device object */
1580  if (DeviceObject->DeviceExtension == NULL)
1581  {
1582  return FALSE;
1583  }
1584 
1585  DeviceExtension = DeviceObject->DeviceExtension;
1586  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1587 
1588  /* Get the device that we attached to */
1589  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1590  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1591 
1592  /* Make sure our FastIo table is valid */
1594  {
1595  /* Forward the call onto the device we attached to */
1597  MdlChain,
1599  }
1600 
1601  /* We failed to handle the request, send it down the slow path */
1602  FLT_ASSERT(FALSE);
1603  return FALSE;
1604 }
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed
Definition: iotypes.h:1755
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoMdlWriteComplete()

BOOLEAN NTAPI FltpFastIoMdlWriteComplete ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ PMDL  MdlChain,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1416 of file Interface.c.

1420 {
1424 
1425  PAGED_CODE();
1426 
1427  /* If it doesn't have a device extension, then it's not our device object */
1428  if (DeviceObject->DeviceExtension == NULL)
1429  {
1430  /* Fail the request, send it down the slow path */
1431  return FALSE;
1432  }
1433 
1434  DeviceExtension = DeviceObject->DeviceExtension;
1435  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1436 
1437  /* Get the device that we attached to */
1438  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1439  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1440 
1441  /* Make sure our FastIo table is valid */
1443  {
1444  /* Forward the call onto the device we attached to */
1446  FileOffset,
1447  MdlChain,
1449  }
1450 
1451  /* We failed to handle the request, send it down the slow path */
1452  FLT_ASSERT(FALSE);
1453  return FALSE;
1454 }
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1752
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoMdlWriteCompleteCompressed()

BOOLEAN NTAPI FltpFastIoMdlWriteCompleteCompressed ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ PMDL  MdlChain,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1609 of file Interface.c.

1613 {
1617 
1618  PAGED_CODE();
1619 
1620  /* If it doesn't have a device extension, then it's not our device object */
1621  if (DeviceObject->DeviceExtension == NULL)
1622  {
1623  return FALSE;
1624  }
1625 
1626  DeviceExtension = DeviceObject->DeviceExtension;
1627  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1628 
1629  /* Get the device that we attached to */
1630  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1631  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1632 
1633  /* Make sure our FastIo table is valid */
1635  {
1636  /* Forward the call onto the device we attached to */
1638  FileOffset,
1639  MdlChain,
1641  }
1642 
1643  /* We failed to handle the request, send it down the slow path */
1644  FLT_ASSERT(FALSE);
1645  return FALSE;
1646 }
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed
Definition: iotypes.h:1756
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoPrepareMdlWrite()

BOOLEAN NTAPI FltpFastIoPrepareMdlWrite ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ ULONG  LockKey,
_Out_ PMDL MdlChain,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1365 of file Interface.c.

1372 {
1376 
1377  PAGED_CODE();
1378 
1379  /* If it doesn't have a device extension, then it's not our device object */
1380  if (DeviceObject->DeviceExtension == NULL)
1381  {
1382  /* Fail the call */
1384  IoStatus->Information = 0;
1385  return TRUE;
1386  }
1387 
1388  DeviceExtension = DeviceObject->DeviceExtension;
1389  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1390 
1391  /* Get the device that we attached to */
1392  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1393  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1394 
1395  /* Make sure our FastIo table is valid */
1397  {
1398  /* Forward the call onto the device we attached to */
1400  FileOffset,
1401  Length,
1402  LockKey,
1403  MdlChain,
1404  IoStatus,
1406  }
1407 
1408  /* We failed to handle the request, send it down the slow path */
1409  FLT_ASSERT(FALSE);
1410  return FALSE;
1411 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite
Definition: iotypes.h:1751
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoQueryBasicInfo()

BOOLEAN NTAPI FltpFastIoQueryBasicInfo ( _In_ PFILE_OBJECT  FileObject,
_In_ BOOLEAN  Wait,
_Out_ PFILE_BASIC_INFORMATION  Buffer,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 819 of file Interface.c.

824 {
828 
829  PAGED_CODE();
830 
831  /* If it doesn't have a device extension, then it's not our device object */
832  if (DeviceObject->DeviceExtension == NULL)
833  {
834  /* Fail the call */
836  IoStatus->Information = 0;
837  return TRUE;
838  }
839 
840  DeviceExtension = DeviceObject->DeviceExtension;
841  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
842 
843  /* Get the device that we attached to */
844  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
845  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
846 
847  /* Make sure our FastIo table is valid */
849  {
850  /* Forward the call onto the device we attached to */
852  Wait,
853  Buffer,
854  IoStatus,
856  }
857 
858  /* We failed to handle the request, send it down the slow path */
859  FLT_ASSERT(FALSE);
860  return FALSE;
861 }
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1737
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoQueryNetworkOpenInfo()

BOOLEAN NTAPI FltpFastIoQueryNetworkOpenInfo ( _In_ PFILE_OBJECT  FileObject,
_In_ BOOLEAN  Wait,
_Out_ PFILE_NETWORK_OPEN_INFORMATION  Buffer,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1225 of file Interface.c.

1230 {
1234 
1235  PAGED_CODE();
1236 
1237  /* If it doesn't have a device extension, then it's not our device object */
1238  if (DeviceObject->DeviceExtension == NULL)
1239  {
1240  /* Fail the call */
1242  IoStatus->Information = 0;
1243  return TRUE;
1244  }
1245 
1246  DeviceExtension = DeviceObject->DeviceExtension;
1247  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1248 
1249  /* Get the device that we attached to */
1250  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1251  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1252 
1253  /* Make sure our FastIo table is valid */
1255  {
1256  /* Forward the call onto the device we attached to */
1258  Wait,
1259  Buffer,
1260  IoStatus,
1262  }
1263 
1264  /* We failed to handle the request, send it down the slow path */
1265  FLT_ASSERT(FALSE);
1266  return FALSE;
1267 }
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1747
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoQueryOpen()

BOOLEAN NTAPI FltpFastIoQueryOpen ( _Inout_ PIRP  Irp,
_Out_ PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1651 of file Interface.c.

1654 {
1658  BOOLEAN Success;
1659 
1660  PAGED_CODE();
1661 
1662  /* If it doesn't have a device extension, then it's not our device object */
1663  if (DeviceObject->DeviceExtension == NULL)
1664  {
1665  return FALSE;
1666  }
1667 
1668  DeviceExtension = DeviceObject->DeviceExtension;
1669  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1670 
1671  /* Get the device that we attached to */
1672  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1673  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1674 
1675  /* Make sure our FastIo table is valid */
1677  {
1679 
1680  /* Update the stack to contain the correct device for the next filter */
1681  StackPtr->DeviceObject = AttachedDeviceObject;
1682 
1683  /* Now forward the call */
1687 
1688  /* Restore the DeviceObject as we found it */
1689  StackPtr->DeviceObject = DeviceObject;
1690  return Success;
1691  }
1692 
1693  /* We failed to handle the request, send it down the slow path */
1694  FLT_ASSERT(FALSE);
1695  return FALSE;
1696 }
_Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation
Definition: iotypes.h:1703
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
PFAST_IO_QUERY_OPEN FastIoQueryOpen
Definition: iotypes.h:1757
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoQueryStandardInfo()

BOOLEAN NTAPI FltpFastIoQueryStandardInfo ( _In_ PFILE_OBJECT  FileObject,
_In_ BOOLEAN  Wait,
_Out_ PFILE_STANDARD_INFORMATION  Buffer,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 866 of file Interface.c.

871 {
875 
876  PAGED_CODE();
877 
878  /* If it doesn't have a device extension, then it's not our device object */
879  if (DeviceObject->DeviceExtension == NULL)
880  {
881  /* Fail the call */
883  IoStatus->Information = 0;
884  return TRUE;
885  }
886 
887  DeviceExtension = DeviceObject->DeviceExtension;
888  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
889 
890  /* Get the device that we attached to */
891  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
892  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
893 
894  /* Make sure our FastIo table is valid */
896  {
897  /* Forward the call onto the device we attached to */
899  Wait,
900  Buffer,
901  IoStatus,
903  }
904 
905  /* We failed to handle the request, send it down the slow path */
906  FLT_ASSERT(FALSE);
907  return FALSE;
908 }
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1738
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoRead()

BOOLEAN NTAPI FltpFastIoRead ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ BOOLEAN  Wait,
_In_ ULONG  LockKey,
_Out_ PVOID  Buffer,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 713 of file Interface.c.

721 {
725 
726  PAGED_CODE();
727 
728  /* If it doesn't have a device extension, then it's not our device object */
729  if (DeviceObject->DeviceExtension == NULL)
730  {
731  /* Fail the call */
733  IoStatus->Information = 0;
734  return TRUE;
735  }
736 
737  DeviceExtension = DeviceObject->DeviceExtension;
738  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
739 
740  /* Get the device that we attached to */
741  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
742  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
743 
744  /* Make sure our FastIo table is valid */
746  {
747  /* Forward the call onto the device we attached to */
749  FileOffset,
750  Length,
751  Wait,
752  LockKey,
753  Buffer,
754  IoStatus,
756  }
757 
758  /* We failed to handle the request, send it down the slow path */
759  FLT_ASSERT(FALSE);
760  return FALSE;
761 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoReadCompressed()

BOOLEAN NTAPI FltpFastIoReadCompressed ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ ULONG  LockKey,
_Out_ PVOID  Buffer,
_Out_ PMDL MdlChain,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_Out_ PCOMPRESSED_DATA_INFO  CompressedDataInfo,
_In_ ULONG  CompressedDataInfoLength,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1459 of file Interface.c.

1469 {
1473 
1474  PAGED_CODE();
1475 
1476  /* If it doesn't have a device extension, then it's not our device object */
1477  if (DeviceObject->DeviceExtension == NULL)
1478  {
1479  /* Fail the request, send it down the slow path */
1480  return FALSE;
1481  }
1482 
1483  DeviceExtension = DeviceObject->DeviceExtension;
1484  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1485 
1486  /* Get the device that we attached to */
1487  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1488  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1489 
1490  /* Make sure our FastIo table is valid */
1492  {
1493  /* Forward the call onto the device we attached to */
1495  FileOffset,
1496  Length,
1497  LockKey,
1498  Buffer,
1499  MdlChain,
1500  IoStatus,
1504  }
1505 
1506  /* We failed to handle the request, send it down the slow path */
1507  FLT_ASSERT(FALSE);
1508  return FALSE;
1509 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
PFAST_IO_READ_COMPRESSED FastIoReadCompressed
Definition: iotypes.h:1753
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO _In_ ULONG CompressedDataInfoLength
Definition: iotypes.h:1658
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO * CompressedDataInfo
Definition: iotypes.h:1658
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoUnlockAll()

BOOLEAN NTAPI FltpFastIoUnlockAll ( _In_ PFILE_OBJECT  FileObject,
_In_ PEPROCESS  ProcessId,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1019 of file Interface.c.

1024 {
1028 
1029  PAGED_CODE();
1030 
1031  /* If it doesn't have a device extension, then it's not our device object */
1032  if (DeviceObject->DeviceExtension == NULL)
1033  {
1034  /* Fail the call */
1036  IoStatus->Information = 0;
1037  return TRUE;
1038  }
1039 
1040  DeviceExtension = DeviceObject->DeviceExtension;
1041  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1042 
1043  /* Get the device that we attached to */
1044  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1045  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1046 
1047  /* Make sure our FastIo table is valid */
1049  {
1050  /* Forward the call onto the device we attached to */
1052  ProcessId,
1053  IoStatus,
1055  }
1056 
1057  /* We failed to handle the request, send it down the slow path */
1058  FLT_ASSERT(FALSE);
1059  return FALSE;
1060 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1741
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoUnlockAllByKey()

BOOLEAN NTAPI FltpFastIoUnlockAllByKey ( _In_ PFILE_OBJECT  FileObject,
_In_ PVOID  ProcessId,
_In_ ULONG  Key,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1065 of file Interface.c.

1070 {
1074 
1075  PAGED_CODE();
1076 
1077  /* If it doesn't have a device extension, then it's not our device object */
1078  if (DeviceObject->DeviceExtension == NULL)
1079  {
1080  /* Fail the call */
1082  IoStatus->Information = 0;
1083  return TRUE;
1084  }
1085 
1086  DeviceExtension = DeviceObject->DeviceExtension;
1087  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1088 
1089  /* Get the device that we attached to */
1090  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1091  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1092 
1093  /* Make sure our FastIo table is valid */
1095  {
1096  /* Forward the call onto the device we attached to */
1098  ProcessId,
1099  Key,
1100  IoStatus,
1102  }
1103 
1104  /* We failed to handle the request, send it down the slow path */
1105  FLT_ASSERT(FALSE);
1106  return FALSE;
1107 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey
Definition: iotypes.h:1742
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoUnlockSingle()

BOOLEAN NTAPI FltpFastIoUnlockSingle ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ PLARGE_INTEGER  Length,
_In_ PEPROCESS  ProcessId,
_In_ ULONG  Key,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 968 of file Interface.c.

975 {
979 
980  PAGED_CODE();
981 
982  /* If it doesn't have a device extension, then it's not our device object */
983  if (DeviceObject->DeviceExtension == NULL)
984  {
985  /* Fail the call */
987  IoStatus->Information = 0;
988  return TRUE;
989  }
990 
991  DeviceExtension = DeviceObject->DeviceExtension;
992  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
993 
994  /* Get the device that we attached to */
995  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
996  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
997 
998  /* Make sure our FastIo table is valid */
1000  {
1001  /* Forward the call onto the device we attached to */
1003  FileOffset,
1004  Length,
1005  ProcessId,
1006  Key,
1007  IoStatus,
1009  }
1010 
1011  /* We failed to handle the request, send it down the slow path */
1012  FLT_ASSERT(FALSE);
1013  return FALSE;
1014 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1740
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoWrite()

BOOLEAN NTAPI FltpFastIoWrite ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ BOOLEAN  Wait,
_In_ ULONG  LockKey,
_In_ PVOID  Buffer,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 766 of file Interface.c.

774 {
778 
779  PAGED_CODE();
780 
781  /* If it doesn't have a device extension, then it's not our device object */
782  if (DeviceObject->DeviceExtension == NULL)
783  {
784  /* Fail the call */
786  IoStatus->Information = 0;
787  return TRUE;
788  }
789 
790  DeviceExtension = DeviceObject->DeviceExtension;
791  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
792 
793  /* Get the device that we attached to */
794  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
795  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
796 
797  /* Make sure our FastIo table is valid */
799  {
800  /* Forward the call onto the device we attached to */
802  FileOffset,
803  Length,
804  Wait,
805  LockKey,
806  Buffer,
807  IoStatus,
809  }
810 
811  /* We failed to handle the request, send it down the slow path */
812  FLT_ASSERT(FALSE);
813  return FALSE;
814 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1736
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFastIoWriteCompressed()

BOOLEAN NTAPI FltpFastIoWriteCompressed ( _In_ PFILE_OBJECT  FileObject,
_In_ PLARGE_INTEGER  FileOffset,
_In_ ULONG  Length,
_In_ ULONG  LockKey,
_In_ PVOID  Buffer,
_Out_ PMDL MdlChain,
_Out_ PIO_STATUS_BLOCK  IoStatus,
_In_ PCOMPRESSED_DATA_INFO  CompressedDataInfo,
_In_ ULONG  CompressedDataInfoLength,
_In_ PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1514 of file Interface.c.

1524 {
1528 
1529  PAGED_CODE();
1530 
1531  /* If it doesn't have a device extension, then it's not our device object */
1532  if (DeviceObject->DeviceExtension == NULL)
1533  {
1534  /* Fail the request, send it down the slow path */
1535  return FALSE;
1536  }
1537 
1538  DeviceExtension = DeviceObject->DeviceExtension;
1539  FLT_ASSERT(DeviceExtension->AttachedToDeviceObject);
1540 
1541  /* Get the device that we attached to */
1542  AttachedDeviceObject = DeviceExtension->AttachedToDeviceObject;
1543  FastIoDispatch = AttachedDeviceObject->DriverObject->FastIoDispatch;
1544 
1545  /* Make sure our FastIo table is valid */
1547  {
1548  /* Forward the call onto the device we attached to */
1550  FileOffset,
1551  Length,
1552  LockKey,
1553  Buffer,
1554  MdlChain,
1555  IoStatus,
1559  }
1560 
1561  /* We failed to handle the request, send it down the slow path */
1562  FLT_ASSERT(FALSE);
1563  return FALSE;
1564 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
Definition: bufpool.h:45
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO _In_ ULONG CompressedDataInfoLength
Definition: iotypes.h:1658
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed
Definition: iotypes.h:1754
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO * CompressedDataInfo
Definition: iotypes.h:1658
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFsControl()

NTSTATUS NTAPI FltpFsControl ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 593 of file Interface.c.

595 {
597 
598  PAGED_CODE();
599 
600  /* Check if this is a request for us */
602  {
603  /* We don't handle this request */
604  Irp->IoStatus.Information = 0;
605  Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
608  }
609 
610  DeviceExtension = DeviceObject->DeviceExtension;
611 
613  DeviceExtension->AttachedToDeviceObject);
614 
615  /* Just pass the IRP down the stack */
617  return IoCallDriver(DeviceExtension->AttachedToDeviceObject, Irp);
618 }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
VOID FASTCALL IofCompleteRequest(IN PIRP Irp, IN CCHAR PriorityBoost)
Definition: irp.c:1308
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpFsNotification()

VOID NTAPI FltpFsNotification ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ BOOLEAN  FsActive 
)

Definition at line 1704 of file Interface.c.

1706 {
1708  NTSTATUS Status;
1709 
1710  PAGED_CODE();
1711 
1712  /* Set an empty string */
1714 
1715  /* Get the name of the lowest device object on the stack */
1717  if (NT_SUCCESS(Status))
1718  {
1719  /* Check if it's attaching or detaching */
1720  if (FsActive)
1721  {
1722  /* Run the attach routine */
1724  }
1725  else
1726  {
1727  /* Run the detach routine */
1729  }
1730 
1731  /* Free the buffer which FltpGetBaseDeviceObjectName allocated */
1733  }
1734 }
VOID FltpFreeUnicodeString(_In_ PUNICODE_STRING String)
Definition: Lib.c:24
LONG NTSTATUS
Definition: precomp.h:26
static LONG_PTR FltpDetachFromFileSystemDevice(_In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:425
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
NTSTATUS FltpGetBaseDeviceObjectName(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PUNICODE_STRING ObjectName)
Definition: Object.c:245
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ BOOLEAN FsActive
Definition: iotypes.h:7360
static NTSTATUS FltpAttachToFileSystemDevice(_In_ PDEVICE_OBJECT DeviceObject, _In_ PUNICODE_STRING DeviceName)
Definition: Interface.c:324
#define NULL
Definition: types.h:112
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define PAGED_CODE()

◆ FltpIsAttachedToDevice()

static BOOLEAN FltpIsAttachedToDevice ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_opt_ PDEVICE_OBJECT AttachedDeviceObject 
)
static

Definition at line 96 of file Interface.c.

98 {
99  PDEVICE_OBJECT CurrentDeviceObject;
101 
102  PAGED_CODE();
103 
104  /* Initialize the return pointer */
106 
107  /* Start by getting the top level device in the chain */
108  CurrentDeviceObject = IoGetAttachedDeviceReference(DeviceObject);
109 
110  /* Loop while there are attached devices */
111  while (CurrentDeviceObject)
112  {
113  /* Check if this device driver matches ours */
114  if (CurrentDeviceObject->DriverObject == DriverData.DriverObject)
115  {
116  FLT_ASSERT(CurrentDeviceObject->DeviceExtension != NULL);
117 
118  /* We're attached, return the device object if the caller asked for it */
120  {
121  *AttachedDeviceObject = CurrentDeviceObject;
122  }
123  else
124  {
125  /* We aren't returning the reference, so decrement the count */
126  ObDereferenceObject(CurrentDeviceObject);
127  }
128 
129  return TRUE;
130  }
131 
132  /* Get the next device in the chain */
133  NextDeviceObject = IoGetLowerDeviceObject(CurrentDeviceObject);
134 
135  /* Decrement the count on the last device before we update the pointer */
136  ObDereferenceObject(CurrentDeviceObject);
137  CurrentDeviceObject = NextDeviceObject;
138  }
139 
140  return FALSE;
141 }
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
#define TRUE
Definition: types.h:120
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
DRIVER_DATA DriverData
Definition: Interface.c:35
#define FALSE
Definition: types.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1507
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
#define ObDereferenceObject
Definition: obfuncs.h:203
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
Definition: ndis.h:4640
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:64
#define NULL
Definition: types.h:112
#define PAGED_CODE()
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49

Referenced by FltpEnumerateFileSystemVolumes().

◆ FltpPostFsFilterOperation()

VOID NTAPI FltpPostFsFilterOperation ( _In_ PFS_FILTER_CALLBACK_DATA  Data,
_In_ NTSTATUS  OperationStatus,
_In_ PVOID  CompletionContext 
)

Definition at line 487 of file Interface.c.

490 {
494  __debugbreak();
495 }
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:893
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
_IRQL_requires_same_ _In_ PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT _Inout_ PNTSTATUS OperationStatus
Definition: ketypes.h:360

Referenced by SetupDispatchAndCallbacksTables().

◆ FltpPreFsFilterOperation()

NTSTATUS NTAPI FltpPreFsFilterOperation ( _In_ PFS_FILTER_CALLBACK_DATA  Data,
_Out_ PVOID CompletionContext 
)

Definition at line 476 of file Interface.c.

478 {
481  __debugbreak();
482  return STATUS_SUCCESS;
483 }
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:893
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by SetupDispatchAndCallbacksTables().

◆ SetupDispatchAndCallbacksTables()

static NTSTATUS SetupDispatchAndCallbacksTables ( _In_ PDRIVER_OBJECT  DriverObject)
static

Definition at line 1739 of file Interface.c.

1740 {
1743  ULONG i;
1744 
1745  /* Plug all the IRPs */
1746  for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
1747  {
1748  DriverObject->MajorFunction[i] = FltpDispatch;
1749  }
1750 
1751  /* Override the ones we're interested in */
1752  DriverObject->MajorFunction[IRP_MJ_CREATE] = FltpCreate;
1757 
1758  /* The FastIo dispatch table is stored in the pool along with a tag */
1761 
1762  /* Fill out the FastIo table */
1786 
1787  /* Store the FastIo table for internal and our access */
1788  DriverObject->FastIoDispatch = FastIoDispatch;
1790 
1791  /* Initialize the callback table */
1792  Callbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
1793  Callbacks.PreAcquireForSectionSynchronization = FltpPreFsFilterOperation;
1794  Callbacks.PostAcquireForSectionSynchronization = FltpPostFsFilterOperation;
1795  Callbacks.PreReleaseForSectionSynchronization = FltpPreFsFilterOperation;
1796  Callbacks.PostReleaseForSectionSynchronization = FltpPostFsFilterOperation;
1797  Callbacks.PreAcquireForCcFlush = FltpPreFsFilterOperation;
1798  Callbacks.PostAcquireForCcFlush = FltpPostFsFilterOperation;
1799  Callbacks.PreReleaseForCcFlush = FltpPreFsFilterOperation;
1800  Callbacks.PostReleaseForCcFlush = FltpPostFsFilterOperation;
1801  Callbacks.PreAcquireForModifiedPageWriter = FltpPreFsFilterOperation;
1802  Callbacks.PostAcquireForModifiedPageWriter = FltpPostFsFilterOperation;
1803  Callbacks.PreReleaseForModifiedPageWriter = FltpPreFsFilterOperation;
1804  Callbacks.PostReleaseForModifiedPageWriter = FltpPostFsFilterOperation;
1805 
1806  /* Register our callbacks */
1808 }
BOOLEAN NTAPI FltpFastIoMdlReadCompleteCompressed(_In_ PFILE_OBJECT FileObject, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1569
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1740
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IRP_MJ_CREATE_MAILSLOT
BOOLEAN NTAPI FltpFastIoReadCompressed(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PVOID Buffer, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _Out_ PCOMPRESSED_DATA_INFO CompressedDataInfo, _In_ ULONG CompressedDataInfoLength, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1459
#define IRP_MJ_MAXIMUM_FUNCTION
NTSTATUS NTAPI FltpCreate(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Interface.c:551
BOOLEAN NTAPI FltpFastIoMdlReadComplete(_In_ PFILE_OBJECT FileObject, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1323
PFAST_IO_MDL_READ MdlRead
Definition: iotypes.h:1749
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite
Definition: iotypes.h:1751
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1741
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1747
BOOLEAN NTAPI FltpFastIoMdlRead(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1272
PFAST_IO_READ_COMPRESSED FastIoReadCompressed
Definition: iotypes.h:1753
BOOLEAN NTAPI FltpFastIoRead(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _Out_ PVOID Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:713
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1750
PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed
Definition: iotypes.h:1755
BOOLEAN NTAPI FltpFastIoWriteCompressed(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _In_ PVOID Buffer, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PCOMPRESSED_DATA_INFO CompressedDataInfo, _In_ ULONG CompressedDataInfoLength, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1514
PFAST_IO_DETACH_DEVICE FastIoDetachDevice
Definition: iotypes.h:1746
DRIVER_DATA DriverData
Definition: Interface.c:35
NTSTATUS NTAPI FltpPreFsFilterOperation(_In_ PFS_FILTER_CALLBACK_DATA Data, _Out_ PVOID *CompletionContext)
Definition: Interface.c:476
PFAST_IO_QUERY_OPEN FastIoQueryOpen
Definition: iotypes.h:1757
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1737
struct _FAST_IO_DISPATCH FAST_IO_DISPATCH
NTSTATUS NTAPI FltpFsControl(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Interface.c:593
BOOLEAN NTAPI FltpFastIoDeviceControl(_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _In_opt_ PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_opt_ PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _In_ ULONG IoControlCode, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1112
BOOLEAN NTAPI FltpFastIoLock(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PLARGE_INTEGER Length, _In_ PEPROCESS ProcessId, _In_ ULONG Key, _In_ BOOLEAN FailImmediately, _In_ BOOLEAN ExclusiveLock, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:913
BOOLEAN NTAPI FltpFastIoQueryBasicInfo(_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_BASIC_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:819
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
BOOLEAN NTAPI FltpFastIoQueryOpen(_Inout_ PIRP Irp, _Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1651
BOOLEAN NTAPI FltpFastIoCheckIfPossible(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _In_ BOOLEAN CheckForReadOperation, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:659
BOOLEAN NTAPI FltpFastIoMdlWriteComplete(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1416
BOOLEAN NTAPI FltpFastIoUnlockAll(_In_ PFILE_OBJECT FileObject, _In_ PEPROCESS ProcessId, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1019
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
VOID NTAPI FltpPostFsFilterOperation(_In_ PFS_FILTER_CALLBACK_DATA Data, _In_ NTSTATUS OperationStatus, _In_ PVOID CompletionContext)
Definition: Interface.c:487
BOOLEAN NTAPI FltpFastIoQueryNetworkOpenInfo(_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1225
#define IRP_MJ_FILE_SYSTEM_CONTROL
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey
Definition: iotypes.h:1742
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BOOLEAN NTAPI FltpFastIoMdlWriteCompleteCompressed(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PMDL MdlChain, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1609
NTSTATUS NTAPI FsRtlRegisterFileSystemFilterCallbacks(PDRIVER_OBJECT FilterDriverObject, PFS_FILTER_CALLBACKS Callbacks)
Definition: fastio.c:2003
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1739
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl
Definition: iotypes.h:1743
BOOLEAN NTAPI FltpFastIoPrepareMdlWrite(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ ULONG LockKey, _Out_ PMDL *MdlChain, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1365
struct _FS_FILTER_CALLBACKS FS_FILTER_CALLBACKS
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1736
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed
Definition: iotypes.h:1754
NTSTATUS NTAPI FltpDeviceControl(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Interface.c:622
#define NULL
Definition: types.h:112
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1738
BOOLEAN NTAPI FltpFastIoUnlockAllByKey(_In_ PFILE_OBJECT FileObject, _In_ PVOID ProcessId, _In_ ULONG Key, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:1065
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1752
VOID NTAPI FltpFastIoDetachDevice(_In_ PDEVICE_OBJECT SourceDevice, _In_ PDEVICE_OBJECT TargetDevice)
Definition: Interface.c:1184
unsigned int ULONG
Definition: retypes.h:1
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1734
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
BOOLEAN NTAPI FltpFastIoUnlockSingle(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ PLARGE_INTEGER Length, _In_ PEPROCESS ProcessId, _In_ ULONG Key, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:968
BOOLEAN NTAPI FltpFastIoQueryStandardInfo(_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, _Out_ PFILE_STANDARD_INFORMATION Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:866
NTSTATUS NTAPI FltpDispatch(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Interface.c:499
PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed
Definition: iotypes.h:1756
BOOLEAN NTAPI FltpFastIoWrite(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _In_ PVOID Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
Definition: Interface.c:766
#define IRP_MJ_CREATE_NAMED_PIPE
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1733

Referenced by CODE_SEG().

Variable Documentation

◆ CommsDeviceObject

PDEVICE_OBJECT CommsDeviceObject

Definition at line 22 of file Messaging.c.

Referenced by FltpCreate(), FltpDispatch(), and FltpSetupCommunicationObjects().

◆ DriverData

◆ FilterList

LIST_ENTRY FilterList

Definition at line 24 of file Filter.c.

Referenced by CODE_SEG().

◆ FilterListLock

ERESOURCE FilterListLock

Definition at line 25 of file Filter.c.

Referenced by CODE_SEG().

◆ FltpFsNotification

DRIVER_FS_NOTIFICATION FltpFsNotification

Definition at line 1699 of file Interface.c.

Referenced by CODE_SEG().