Hi there.

For a legacy application that expects all its customization (.dlls,
mostly) in its working directory and because I need to constantly
switch projects (which involves "copy the working directory, replace
it with another one and restart") I searched for a kind of unionfs[1]
for windows, which would allow me to create a logical view on the
application directory which includes external directories as
neccessary.

Sample:

C:\MyApp\Bin\
C:\MyApp\Projects\Foo\

I'd like to map all file requests that would fail for the Bin to check
another directory again.

Being new to this stuff (and doing it out of lazyness, since the
process described above sucks) I'd love to hear that this barely
involves dispatching IRP_MJ_CREATE?

My current idea would be to deploy a minifilter which does the
following steps in the PreCreate event:

- Check if this request wants a file inside of my Bin directory., else
ignore the request
- Check if the request is readonly (no create file, no append), else
ignore the request
- Check if the requested file exists (ZwFileOpen?) and
- ignore the request if the file exists
- redirect the request to the overlay directory otherwise (setting
the filenameinfo and marking the request as dirty)

Since I'm bloody new here: Can anyone comment on obvious mistakes? Is
this too hard for a beginner's (talking about drivers here) task?

Thanks in advance,
Ben

RE: Filesystem overlay (poor mans unionfs) by pavel_a

pavel_a
Mon Feb 05 15:14:02 CST 2007

Have you considered AppPaths registry variable for your app?

--PA

"benjamin.podszun@gmail.com" wrote:
> Hi there.
>
> For a legacy application that expects all its customization (.dlls,
> mostly) in its working directory and because I need to constantly
> switch projects (which involves "copy the working directory, replace
> it with another one and restart") I searched for a kind of unionfs[1]
> for windows, which would allow me to create a logical view on the
> application directory which includes external directories as
> neccessary.
>
> Sample:
>
> C:\MyApp\Bin\
> C:\MyApp\Projects\Foo\
>
> I'd like to map all file requests that would fail for the Bin to check
> another directory again.
>
> Being new to this stuff (and doing it out of lazyness, since the
> process described above sucks) I'd love to hear that this barely
> involves dispatching IRP_MJ_CREATE?
>
> My current idea would be to deploy a minifilter which does the
> following steps in the PreCreate event:
>
> - Check if this request wants a file inside of my Bin directory., else
> ignore the request
> - Check if the request is readonly (no create file, no append), else
> ignore the request
> - Check if the requested file exists (ZwFileOpen?) and
> - ignore the request if the file exists
> - redirect the request to the overlay directory otherwise (setting
> the filenameinfo and marking the request as dirty)
>
> Since I'm bloody new here: Can anyone comment on obvious mistakes? Is
> this too hard for a beginner's (talking about drivers here) task?
>
> Thanks in advance,
> Ben
>
>

Re: Filesystem overlay (poor mans unionfs) by benjamin

benjamin
Mon Feb 05 16:05:49 CST 2007

On 5 Feb., 22:14, Pavel A. <pave...@NOwritemeNO.com> wrote:
> Have you considered AppPaths registry variable for your app?

No idea what you mean.
The application loads both native dlls and managed code and expects
everything to reside in the bin directory. I see no way to change that
behaviour or to work around this requirement.


Re: Filesystem overlay (poor mans unionfs) by pavel_a

pavel_a
Mon Feb 05 19:07:00 CST 2007

"benjamin.podszun@gmail.com" wrote:
> On 5 Feb., 22:14, Pavel A. <pave...@NOwritemeNO.com> wrote:
> > Have you considered AppPaths registry variable for your app?
>
> No idea what you mean.
> The application loads both native dlls and managed code and expects
> everything to reside in the bin directory. I see no way to change that
> behaviour or to work around this requirement.

Add paths of your DLLs to
HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\<yourappname> ?




Re: Filesystem overlay (poor mans unionfs) by benjamin

benjamin
Tue Feb 06 03:35:31 CST 2007

On 6 Feb., 02:07, Pavel A. <pave...@NOwritemeNO.com> wrote:
> "benjamin.pods...@gmail.com" wrote:
> > On 5 Feb., 22:14, Pavel A. <pave...@NOwritemeNO.com> wrote:
> > > Have you considered AppPaths registry variable for your app?
>
> > No idea what you mean.
> > The application loads both native dlls and managed code and expects
> > everything to reside in the bin directory. I see no way to change that
> > behaviour or to work around this requirement.
>
> Add paths of your DLLs to
> HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\<yourappname> ?

Ah, okay. Nice idea, but

a) does this work for both managed and unmanaged code or do I have to
do something different for managed stuff (probing?)

b) the app consists of about 30-40 executables. I'm going to give it a
try and see if it works out

Thank you for the advice/hint.