FW: How to simulate virtual folder?

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
Reply To: xxxxx@lists.osr.com
Sent: Monday, November 25, 2002 11:50 PM
To: michal.vodicka@st.com
Subject: Re: How to simulate virtual folder?

Sorry, your message was not sent out to ‘ntfsd’
because the first line of the message is identical
to a message you sent to ntdev recently.

Nice feature but I really wanted to send it to both lists :wink:


Hi all,

we have a virtual disk driver which stores encrypted data in files and
works
with no problem. Drives are accesses standard way using driver letters.
Now
we’d like to make something easier for users who would be confused with a
new drive letter. The idea is to create a virtual folder as “My
Documents\My
Encrypted” or “My Encrypted Documents” which would be accessible standard
way from explorer and other apps and all requests would be redirected to
our
virtual drive. Driver letter would be invisible (not quite necessary).

The question is how to accomplish it. Currently we use explorer namespace
extension which is insufficient for some reasons. Mount points can’t be
used
because it should work at both FAT and NTFS. We’re thinking about a simple
filesystem filter, hooking some APIs or some object manager trick. I’d
like
to know what is possible and how complicated the solution is. Filesystem
filter seems and the correct solution but I’m not sure if it can be simple
even if it only needs to redirect requests.

Any suggestion or comment welcome.

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]

I believe the FileSystem Filter Driver approach is the way to go. I do
something very similar. It’s not trivial, but certainly possible. The
trickiest bit will be injecting “My Encrypted Documents” into the
enumeration of the parent directory into which you want it to appear.

You will need to filter IRP_MJ_CREATE to replace the paths to be opened with
the real paths. For your faked directory path and its parent, you will need
to filter IRP_MJ_CREATE, IRP_MJ_CLEANUP, IRP_MJ_CLOSE,
IRP_MJ_QUERY_INFORMATION, IRP_MJ_DIRECTORY_CONTROL+IRP_MN_QUERY_DIRECTORY,
IRP_MJ_FILE_SYSTEM_CONTROL and most of the FastIo routines (if only to
reject them).

But (if at all possible) restrict your injection of faked objects to being
directories. Injecting a non-existent file object (i.e. one with read/write
content) can give you all sorts of grief in interaction with the cache
manager.

Good luck

Brian

From: “Vodicka, Michal” <michal.vodicka>
To:
Subject: FW: How to simulate virtual folder?
Date: 25 November 2002 22:56

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> Reply To: xxxxx@lists.osr.com
> Sent: Monday, November 25, 2002 11:50 PM
> To: michal.vodicka@st.com
> Subject: Re: How to simulate virtual folder?
>
> Sorry, your message was not sent out to ‘ntfsd’
> because the first line of the message is identical
> to a message you sent to ntdev recently.
>
Nice feature but I really wanted to send it to both lists :wink:

----------

> Hi all,
>
> we have a virtual disk driver which stores encrypted data in files and
> works
> with no problem. Drives are accesses standard way using driver letters.
> Now
> we’d like to make something easier for users who would be confused with a
> new drive letter. The idea is to create a virtual folder as “My
> Documents\My
> Encrypted” or “My Encrypted Documents” which would be accessible standard
> way from explorer and other apps and all requests would be redirected to
> our
> virtual drive. Driver letter would be invisible (not quite necessary).
>
> The question is how to accomplish it. Currently we use explorer namespace
> extension which is insufficient for some reasons. Mount points can’t be
> used
> because it should work at both FAT and NTFS. We’re thinking about a simple
> filesystem filter, hooking some APIs or some object manager trick. I’d
> like
> to know what is possible and how complicated the solution is. Filesystem
> filter seems and the correct solution but I’m not sure if it can be simple
> even if it only needs to redirect requests.
>
> Any suggestion or comment welcome.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
>
></michal.vodicka>

As long as the faked directory and its contents actually exist on
another volume (which is the case in his software), he doesn’t ever need
to modify the directory queries. He can simply create empty folder with
the appropriate name and start filtering. When a create comes down for
that folder name, he redirects the request with STATUS_REPARSE and the
query will operate on the redirected folder.

Change notification is an issue, however… If a change notify is set on
a parent directory with the SL_WATCH_TREE flag, the notify won’t be
fired for changes under the redirected folder. There was a recent thread
on how to handle this and it seems to be possible but ugly.

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Brian Collins
Sent: Tuesday, November 26, 2002 5:24 AM
To: File Systems Developers
Subject: [ntfsd] Re: How to simulate virtual folder?

I believe the FileSystem Filter Driver approach is the way to
go. I do something very similar. It’s not trivial, but
certainly possible. The trickiest bit will be injecting “My
Encrypted Documents” into the enumeration of the parent
directory into which you want it to appear.

You will need to filter IRP_MJ_CREATE to replace the paths to
be opened with the real paths. For your faked directory path
and its parent, you will need to filter IRP_MJ_CREATE,
IRP_MJ_CLEANUP, IRP_MJ_CLOSE, IRP_MJ_QUERY_INFORMATION,
IRP_MJ_DIRECTORY_CONTROL+IRP_MN_QUERY_DIRECTORY,
IRP_MJ_FILE_SYSTEM_CONTROL and most of the FastIo routines
(if only to reject them).

But (if at all possible) restrict your injection of faked
objects to being directories. Injecting a non-existent file
object (i.e. one with read/write
content) can give you all sorts of grief in interaction with
the cache manager.

Good luck

Brian

From: “Vodicka, Michal” <michal.vodicka>
> To:
> Subject: FW: How to simulate virtual folder?
> Date: 25 November 2002 22:56
>
>
> > ----------
> > From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Monday, November 25, 2002 11:50 PM
> > To: michal.vodicka@st.com
> > Subject: Re: How to simulate virtual folder?
> >
> > Sorry, your message was not sent out to ‘ntfsd’
> > because the first line of the message is identical
> > to a message you sent to ntdev recently.
> >
> Nice feature but I really wanted to send it to both lists :wink:
>
> ----------
>
> > Hi all,
> >
> > we have a virtual disk driver which stores encrypted data
> in files and
> > works with no problem. Drives are accesses standard way
> using driver
> > letters. Now
> > we’d like to make something easier for users who would be
> confused with a
> > new drive letter. The idea is to create a virtual folder as “My
> > Documents\My
> > Encrypted” or “My Encrypted Documents” which would be
> accessible standard
> > way from explorer and other apps and all requests would be
> redirected to
> > our
> > virtual drive. Driver letter would be invisible (not quite
> necessary).
> >
> > The question is how to accomplish it. Currently we use explorer
> > namespace extension which is insufficient for some reasons. Mount
> > points can’t be used because it should work at both FAT and NTFS.
> > We’re thinking about a simple filesystem filter, hooking
> some APIs or
> > some object manager trick. I’d like
> > to know what is possible and how complicated the solution
> is. Filesystem
> > filter seems and the correct solution but I’m not sure if
> it can be simple
> > even if it only needs to redirect requests.
> >
> > Any suggestion or comment welcome.
> >
> > Best regards,
> >
> > Michal Vodicka
> > STMicroelectronics Design and Application s.r.o.
> > [michal.vodicka@st.com, http:://www.st.com]
> >
> >
> >
>
>
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@nryan.com
> To unsubscribe send a blank email to %%email.unsub%%
></michal.vodicka>

I just started to write reply to Brian’s mail and ask what you just
answered, thanks. Is change notification real issue i.e. can it influence
some software a bad way? If so, how it is solved for NTFS mount points?

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From: xxxxx@nryan.com[SMTP:xxxxx@nryan.com]
Reply To: xxxxx@lists.osr.com
Sent: Tuesday, November 26, 2002 7:53 PM
To: xxxxx@lists.osr.com
Subject: [ntfsd] Re: How to simulate virtual folder?

As long as the faked directory and its contents actually exist on
another volume (which is the case in his software), he doesn’t ever need
to modify the directory queries. He can simply create empty folder with
the appropriate name and start filtering. When a create comes down for
that folder name, he redirects the request with STATUS_REPARSE and the
query will operate on the redirected folder.

Change notification is an issue, however… If a change notify is set on
a parent directory with the SL_WATCH_TREE flag, the notify won’t be
fired for changes under the redirected folder. There was a recent thread
on how to handle this and it seems to be possible but ugly.

  • Nicholas Ryan

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Brian Collins
> Sent: Tuesday, November 26, 2002 5:24 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: How to simulate virtual folder?
>
>
> I believe the FileSystem Filter Driver approach is the way to
> go. I do something very similar. It’s not trivial, but
> certainly possible. The trickiest bit will be injecting “My
> Encrypted Documents” into the enumeration of the parent
> directory into which you want it to appear.
>
> You will need to filter IRP_MJ_CREATE to replace the paths to
> be opened with the real paths. For your faked directory path
> and its parent, you will need to filter IRP_MJ_CREATE,
> IRP_MJ_CLEANUP, IRP_MJ_CLOSE, IRP_MJ_QUERY_INFORMATION,
> IRP_MJ_DIRECTORY_CONTROL+IRP_MN_QUERY_DIRECTORY,
> IRP_MJ_FILE_SYSTEM_CONTROL and most of the FastIo routines
> (if only to reject them).
>
> But (if at all possible) restrict your injection of faked
> objects to being directories. Injecting a non-existent file
> object (i.e. one with read/write
> content) can give you all sorts of grief in interaction with
> the cache manager.
>
> Good luck
>
> Brian
>
> From: “Vodicka, Michal” <michal.vodicka>
> > To:
> > Subject: FW: How to simulate virtual folder?
> > Date: 25 November 2002 22:56
> >
> >
> > > ----------
> > > From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> > > Reply To: xxxxx@lists.osr.com
> > > Sent: Monday, November 25, 2002 11:50 PM
> > > To: michal.vodicka@st.com
> > > Subject: Re: How to simulate virtual folder?
> > >
> > > Sorry, your message was not sent out to ‘ntfsd’
> > > because the first line of the message is identical
> > > to a message you sent to ntdev recently.
> > >
> > Nice feature but I really wanted to send it to both lists :wink:
> >
> > ----------
> >
> > > Hi all,
> > >
> > > we have a virtual disk driver which stores encrypted data
> > in files and
> > > works with no problem. Drives are accesses standard way
> > using driver
> > > letters. Now
> > > we’d like to make something easier for users who would be
> > confused with a
> > > new drive letter. The idea is to create a virtual folder as “My
> > > Documents\My
> > > Encrypted” or “My Encrypted Documents” which would be
> > accessible standard
> > > way from explorer and other apps and all requests would be
> > redirected to
> > > our
> > > virtual drive. Driver letter would be invisible (not quite
> > necessary).
> > >
> > > The question is how to accomplish it. Currently we use explorer
> > > namespace extension which is insufficient for some reasons. Mount
> > > points can’t be used because it should work at both FAT and NTFS.
> > > We’re thinking about a simple filesystem filter, hooking
> > some APIs or
> > > some object manager trick. I’d like
> > > to know what is possible and how complicated the solution
> > is. Filesystem
> > > filter seems and the correct solution but I’m not sure if
> > it can be simple
> > > even if it only needs to redirect requests.
> > >
> > > Any suggestion or comment welcome.
> > >
> > > Best regards,
> > >
> > > Michal Vodicka
> > > STMicroelectronics Design and Application s.r.o.
> > > [michal.vodicka@st.com, http:://www.st.com]
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: michal.vodicka@st.com
> To unsubscribe send a blank email to %%email.unsub%%
></michal.vodicka>

Nicholas,

Yes, what you propose is a much neater solution of his specific
requirements, as long as the platform is W2K or later. I was attempting to
solve a broader problem. To paraphrase an old saying: “When you’ve got a
hammer, lots of things start looking like nails!”

Brian

“Nicholas Ryan” wrote in message news:xxxxx@ntfsd…
>
> As long as the faked directory and its contents actually exist on
> another volume (which is the case in his software), he doesn’t ever need
> to modify the directory queries. He can simply create empty folder with
> the appropriate name and start filtering. When a create comes down for
> that folder name, he redirects the request with STATUS_REPARSE and the
> query will operate on the redirected folder.
>
> Change notification is an issue, however… If a change notify is set on
> a parent directory with the SL_WATCH_TREE flag, the notify won’t be
> fired for changes under the redirected folder. There was a recent thread
> on how to handle this and it seems to be possible but ugly.
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Brian Collins
> > Sent: Tuesday, November 26, 2002 5:24 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: How to simulate virtual folder?
> >
> >
> > I believe the FileSystem Filter Driver approach is the way to
> > go. I do something very similar. It’s not trivial, but
> > certainly possible. The trickiest bit will be injecting “My
> > Encrypted Documents” into the enumeration of the parent
> > directory into which you want it to appear.
> >
> > You will need to filter IRP_MJ_CREATE to replace the paths to
> > be opened with the real paths. For your faked directory path
> > and its parent, you will need to filter IRP_MJ_CREATE,
> > IRP_MJ_CLEANUP, IRP_MJ_CLOSE, IRP_MJ_QUERY_INFORMATION,
> > IRP_MJ_DIRECTORY_CONTROL+IRP_MN_QUERY_DIRECTORY,
> > IRP_MJ_FILE_SYSTEM_CONTROL and most of the FastIo routines
> > (if only to reject them).
> >
> > But (if at all possible) restrict your injection of faked
> > objects to being directories. Injecting a non-existent file
> > object (i.e. one with read/write
> > content) can give you all sorts of grief in interaction with
> > the cache manager.
> >
> > Good luck
> >
> > Brian
> >
> > From: “Vodicka, Michal” <michal.vodicka>
> > To:
> > Subject: FW: How to simulate virtual folder?
> > Date: 25 November 2002 22:56
> >
> >
> > > ----------
> > > From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com]
> > > Reply To: xxxxx@lists.osr.com
> > > Sent: Monday, November 25, 2002 11:50 PM
> > > To: michal.vodicka@st.com
> > > Subject: Re: How to simulate virtual folder?
> > >
> > > Sorry, your message was not sent out to ‘ntfsd’
> > > because the first line of the message is identical
> > > to a message you sent to ntdev recently.
> > >
> > Nice feature but I really wanted to send it to both lists :wink:
> >
> > ----------
> >
> > > Hi all,
> > >
> > > we have a virtual disk driver which stores encrypted data
> > in files and
> > > works with no problem. Drives are accesses standard way
> > using driver
> > > letters. Now
> > > we’d like to make something easier for users who would be
> > confused with a
> > > new drive letter. The idea is to create a virtual folder as “My
> > > Documents\My
> > > Encrypted” or “My Encrypted Documents” which would be
> > accessible standard
> > > way from explorer and other apps and all requests would be
> > redirected to
> > > our
> > > virtual drive. Driver letter would be invisible (not quite
> > necessary).
> > >
> > > The question is how to accomplish it. Currently we use explorer
> > > namespace extension which is insufficient for some reasons. Mount
> > > points can’t be used because it should work at both FAT and NTFS.
> > > We’re thinking about a simple filesystem filter, hooking
> > some APIs or
> > > some object manager trick. I’d like
> > > to know what is possible and how complicated the solution
> > is. Filesystem
> > > filter seems and the correct solution but I’m not sure if
> > it can be simple
> > > even if it only needs to redirect requests.
> > >
> > > Any suggestion or comment welcome.
> > >
> > > Best regards,
> > >
> > > Michal Vodicka
> > > STMicroelectronics Design and Application s.r.o.
> > > [michal.vodicka@st.com, http:://www.st.com]
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
></michal.vodicka>