RE: preventing recursive loop in create dispatch hand------ ler


Tony Mason wrote:

Another potential solution I’ve been considering is that for each device
object you create that filters an existing FSD volume, you create a SECOND
device object that does NOT filter anything. Then, when you need to issue a
ZwCreateFile, you issue it against your second device object
(“\Device\MyFilterAlternativeDevice0063A” or whatever unique name you decide
to use.) Then, when you receive the IRP against the second device object,
you send it down to the original FSD. That bypasses the requirement to
build an IRP_MJ_CREATE, detects the recursion (since nobody else is calling
your device object) and avoids the difficulty of having other filter drivers
involved (since it is unlikely that any other filter driver would attatch to
your random named device object.)


Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.

I’ve been using this technique (“shadow device object” I call it :wink: for
2 years
now with some success, but you must be careful in choosing your target
DO, some
filters products use high and low filter drivers around the Fs at the
same time.
(Getbasefilesystem() doesn’t always return the original Fs If I recall
correctly, if some filters patch the vpb).

Jerome Christatos.