Short DOS filenames

Is there a simple way within a filter driver to get the associated long name
for a filename that has been presented to the filter in 8.3 format (such as
NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format name to the
partner application space program and let it deal with it?

Brad


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

It looks like an IRP_MJ_QUERY_INFORMATION with a FileInformationClass of
FileNameInformation directed at the FileObject should do it (in case
anyone -other- than me didn’t know that…).

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Brad Sahr
Sent: Wednesday, February 21, 2001 10:05 AM
To: File Systems Developers
Subject: [ntfsd] Short DOS filenames

Is there a simple way within a filter driver to get the
associated long name
for a filename that has been presented to the filter in 8.3
format (such as
NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format
name to the
partner application space program and let it deal with it?

Brad


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hmmm… IIRC, querying for a file name against a file object opened
with a short file name will return a short file name in most file systems.
I’d double check, though, I could be wrong. I don’t think you’ll find an
easy way to do this. Why do you need to know the long file name in the
filter driver? Maybe we can come up with another approach.

-----Original Message-----
From: Brad Sahr [mailto:xxxxx@macromedia.com]
Sent: Wednesday, February 21, 2001 4:26 PM
To: File Systems Developers
Subject: [ntfsd] RE: Short DOS filenames

It looks like an IRP_MJ_QUERY_INFORMATION with a FileInformationClass of
FileNameInformation directed at the FileObject should do it (in case
anyone -other- than me didn’t know that…).

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Brad Sahr
Sent: Wednesday, February 21, 2001 10:05 AM
To: File Systems Developers
Subject: [ntfsd] Short DOS filenames

Is there a simple way within a filter driver to get the
associated long name
for a filename that has been presented to the filter in 8.3
format (such as
NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format
name to the
partner application space program and let it deal with it?

Brad


You are currently subscribed to ntfsd as: xxxxx@ntpsoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

If I am not mistaken, this will give the same name that was passed to the
filter driver.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Brad Sahr
Sent: Wednesday, February 21, 2001 4:26 PM
To: File Systems Developers
Subject: [ntfsd] RE: Short DOS filenames

It looks like an IRP_MJ_QUERY_INFORMATION with a FileInformationClass of
FileNameInformation directed at the FileObject should do it (in case
anyone -other- than me didn’t know that…).

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Brad Sahr
Sent: Wednesday, February 21, 2001 10:05 AM
To: File Systems Developers
Subject: [ntfsd] Short DOS filenames

Is there a simple way within a filter driver to get the
associated long name
for a filename that has been presented to the filter in 8.3
format (such as
NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format
name to the
partner application space program and let it deal with it?

Brad


You are currently subscribed to ntfsd as: xxxxx@legato.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

RE: [ntfsd] RE: Short DOS filenamesYou are absolutely correct (as was Ken
G.), the retuned filename is the short 8.3 format filename.
I actually don’t need to know the long filename in the filter, but the
partner application needs the long filename and I figured it should be easy
enough to get within the filter driver.
Any ideas about how I could get the long filename? The situation is the
deletion of a file and the file may be gone by the time the partner
application is able to call GetLongPathName() or FindFirstFile(). Although I
don’t know the requests specifically, I bet there is a way to query the
containing directory. Would this be the way to get it?

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Smith, Joel
Sent: Wednesday, February 21, 2001 4:11 PM
To: File Systems Developers
Subject: [ntfsd] RE: Short DOS filenames

Hmmm… IIRC, querying for a file name against a file object
opened with a short file name will return a short file name in most file
systems. I’d double check, though, I could be wrong. I don’t think you’ll
find an easy way to do this. Why do you need to know the long file name in
the filter driver? Maybe we can come up with another approach.

-----Original Message-----
From: Brad Sahr [mailto:xxxxx@macromedia.com]
Sent: Wednesday, February 21, 2001 4:26 PM
To: File Systems Developers
Subject: [ntfsd] RE: Short DOS filenames

It looks like an IRP_MJ_QUERY_INFORMATION with a FileInformationClass of
FileNameInformation directed at the FileObject should do it (in case
anyone -other- than me didn’t know that…).

Brad

-----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Brad Sahr
> Sent: Wednesday, February 21, 2001 10:05 AM
> To: File Systems Developers
> Subject: [ntfsd] Short DOS filenames
>
>
> Is there a simple way within a filter driver to get the
> associated long name
> for a filename that has been presented to the filter in 8.3
> format (such as
> NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format
> name to the
> partner application space program and let it deal with it?
>
> Brad


You are currently subscribed to ntfsd as: xxxxx@ntpsoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I had this same issue, and the only solution I know of is to query the
parent directory for the file name (i.e. issue a ZwQueryDirectoryFile with
FILE_BOTH_DIR_INFORMATION). To speed things up, you can use the DOS name as
a search parameter so the query will ideally return only one entry. I go
through the trouble of comparing the results just to be sure, and I also
have a looping construct set up just in case there is more than one result
and the first doesn’t match.

Also note that you should create an event object to pass to
ZwQueryDirectoryFile and wait on it if your result is STATUS_PENDING. Make
sure you have some mechanism in place to handle driver re-entrancy issues,
as these calls will be caught in IRP_MJ_CREATE etc.

Lastly, note that if you require an exact file case match, you should always
query the parent directory. For example, let’s say the real path name of a
file is “D:\DirA\DirB\FileX.exe”. There is nothing stopping an application
from asking for the file “D:\dIra\DIRb\fILEx.EXE”. As a result of the whole
path being screwed up, I had to query all of the directories from the root
on downwards (very expensive). The lesson I’ve learned is that in the
future I will push for case insensitive requirements which will vastly
reduce this gross overhead. If anyone has a better solution to this problem
I would love to hear it.

----- Original Message -----
From: “Brad Sahr”
To: “File Systems Developers”
Sent: Wednesday, February 21, 2001 10:32 PM
Subject: [ntfsd] RE: Short DOS filenames

> You are absolutely correct (as was Ken G.), the retuned filename is the
> short 8.3 format filename.
> I actually don’t need to know the long filename in the filter, but the
> partner application needs the long filename and I figured it should be
> easy enough to get within the filter driver.
> Any ideas about how I could get the long filename? The situation is the
> deletion of a file and the file may be gone by the time the partner
> application is able to call GetLongPathName() or FindFirstFile().
> Although I don’t know the requests specifically, I bet there is a way to
> query the containing directory. Would this be the way to get it?
>
> Brad
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Smith, Joel
> Sent: Wednesday, February 21, 2001 4:11 PM
> To: File Systems Developers
> Subject: [ntfsd] RE: Short DOS filenames
>
>
>
> Hmmm… IIRC, querying for a file name against a file object
> opened with a short file name will return a short file name in most file
> systems. I’d double check, though, I could be wrong. I don’t think
> you’ll find an easy way to do this. Why do you need to know the long
> file name in the filter driver? Maybe we can come up with another
> approach.
>
> -----Original Message-----
> From: Brad Sahr [mailto:xxxxx@macromedia.com
> mailto:xxxxx]
> Sent: Wednesday, February 21, 2001 4:26 PM
> To: File Systems Developers
> Subject: [ntfsd] RE: Short DOS filenames
>
>
> It looks like an IRP_MJ_QUERY_INFORMATION with a FileInformationClass of
>
> FileNameInformation directed at the FileObject should do it (in case
> anyone -other- than me didn’t know that…).
>
> Brad
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com
> mailto:xxxxx]On Behalf Of Brad Sahr
> > Sent: Wednesday, February 21, 2001 10:05 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Short DOS filenames
> >
> >
> > Is there a simple way within a filter driver to get the
> > associated long name
> > for a filename that has been presented to the filter in 8.3
> > format (such as
> > NEWTEX~1.TXT)? Or is it more appropriate to pass the 8.3 format
> > name to the
> > partner application space program and let it deal with it?
> >
> > Brad
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@ntpsoftware.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntfsd as: xxxxx@texar.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com</mailto:xxxxx></mailto:xxxxx>