> when you speak about forward / hijack, do you mean, that the IFS example
is actually does NOT reopen the file using FltCreateFile, but reads the
file dirrectly using the FileObject obtained for the arbitrary 3rd party
user mode process?
Bingo!
so, this would mean, that I could detect in my open/read requests the
cases, when the requestor is my scanner process, then handle those
requests without forwarding down the request toward the FSD, but handling
it directly by reading the original file using the file object obtained
for the 3rd party process?
Almost…I would not do my usermode-scanner-requests through my
mini-filter-callbacks. Just implement a device-object with various dispatch
routines, that act like a filesystem. Then feed your usermode-scanner
(CreateFile) with the name of that device. Implementation of such a device
could go like this:
NTSTATUS MyProxyDispatchRead(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PCFLT_RELATED_OBJECTS pForwardedFltObjects =
(PCFLT_RELATED_OBJECTS)IoGetCurrentIrpStackLocation(Irp)->FileObject->FsContext;
…
// avoid to update the hijacked file-object’s file pos pointer
status = FltReadFile(pForwardedFltObjects ->Instance,
pForwardedFltObjects ->FileObject,
&offset,
dwTotalSize,
pBuffer,
FLTFL_IO_OPERATION_DO_NOT_UPDATE_BYTE_OFFSET,
&bytesRead,
NULL,
NULL );
…
}
schrieb im Newsbeitrag news:xxxxx@ntfsd…
> >I would try to implement a sort “proxy-device” that forwards every IRP to
> >your file-object “handle”.
>>In this case all you do have to change is the filename that your user-mode
>>scanner uses to open
>>that file…replace it with the name of your proxy device. Even consider
>>to go one step further: do
>>not forward the handle you got from your FltCreateFile, but forward
>>(hijack) the handle you get in
>>PostCreate from that thread trying to open that file. The scanner-sample
>>in IFS-Kit does the same.
>>
> when you speak about forward / hijack, do you mean, that the IFS example
> is actually does NOT reopen the file using FltCreateFile, but reads the
> file dirrectly using the FileObject obtained for the arbitrary 3rd party
> user mode process?
>
> so, this would mean, that I could detect in my open/read requests the
> cases, when the requestor is my scanner process, then handle those
> requests without forwarding down the request toward the FSD, but handling
> it directly by reading the original file using the file object obtained
> for the 3rd party process?
>
> thank you very much,
>
> Alex
>
>>
>>Frank
>
>
>