Wrong file being opened

Hey guys,

Was wondering if you guys could help me with something. I’m writing a
File System Driver (network redirector) that has Create / Close, Query
Directory / Information / Volume Information and Read partially
implemented. I’m running into an issue where when either Explorer or
Cmd.exe tries to open some files, it instead decides to open another.

There are two specific scenarios that I have noticed this issue (normal
directory traversal in explorer works fine):

  1. From the command prompt I go to the Mapped Driver letter and then
    try to change to directory /home … it instead opens directory
    /containers (which is the First directory in the list and which is
    returned in query directory).

  2. From explorer I try to open a text file for reading … it instead
    tries to read the file for the first directory in the folder (a file
    named /containers).

I also note the following sequence in both calls:

Does a Create for /home
Does a Query Information for Basic Info on /home
Does a Create and Query Directory back on the root

Here’s the interesting part …
Suddenly jumps to a Create for /containers

I’m thinking this might have to do something with FileIndex ( I always
return 0 for them) since the documentation states: “Byte offset of the
file within the parent directory. This member is undefined for file
systems, such as NTFS, in which the position of a file within the parent
directory is not fixed and can be changed at any time to maintain sort
order” which makes it seem like it’s optional.

Does anyone have any ideas or have encountered this before?

Sincerely,
Chris Sosa

Yes, implementing QueryDirectory is a hard thing, too easy to slip a bug.
Look at how FASTFAT does this.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Chris Sosa” wrote in message news:xxxxx@ntfsd…
> Hey guys,
>
> Was wondering if you guys could help me with something. I’m writing a
> File System Driver (network redirector) that has Create / Close, Query
> Directory / Information / Volume Information and Read partially
> implemented. I’m running into an issue where when either Explorer or
> Cmd.exe tries to open some files, it instead decides to open another.
>
> There are two specific scenarios that I have noticed this issue (normal
> directory traversal in explorer works fine):
>
> 1) From the command prompt I go to the Mapped Driver letter and then
> try to change to directory /home … it instead opens directory
> /containers (which is the First directory in the list and which is
> returned in query directory).
>
> 2) From explorer I try to open a text file for reading … it instead
> tries to read the file for the first directory in the folder (a file
> named /containers).
>
> I also note the following sequence in both calls:
>
> Does a Create for /home
> Does a Query Information for Basic Info on /home
> Does a Create and Query Directory back on the root
>
> Here’s the interesting part …
> Suddenly jumps to a Create for /containers
>
> I’m thinking this might have to do something with FileIndex ( I always
> return 0 for them) since the documentation states: “Byte offset of the
> file within the parent directory. This member is undefined for file
> systems, such as NTFS, in which the position of a file within the parent
> directory is not fixed and can be changed at any time to maintain sort
> order” which makes it seem like it’s optional.
>
> Does anyone have any ideas or have encountered this before?
>
> Sincerely,
> Chris Sosa
>

I used an existing FSD and look at the operations that follows a request from user mode. Then started to provide hard coded data from the major function dispatcher and then go deep and look if it works similar to working FSD. In my case I used a hardcoded tree srtucture. Because I am very new in drivers and the approach helped.