I've just started working on a file system filter driver that monitors for I/O writes to any file (listening for IRP_MJ_WRITE
requests), and defragments the file transparently if it becomes fragmented.
Currently, I have code like this:
NTSTATUS FsFilterDispatchWrite(__in PDEVICE_OBJECT DeviceObject, __in PIRP Irp)
{
PFILE_OBJECT pFileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject;
NTSTATUS result = FsFilterDispatchPassThrough(DeviceObject, Irp);
//FltFsControlFile(???);
return result;
}
in which I would need to issue the FSCTL_GET_RETRIEVAL_POINTERS
I/O control code.
However, I'm rather new to the area of driver development... is FltFsControlFile
the correct function for me to use here? If so, what does the Instance
parameter represent? And if not, then how should I go about doing this?