How to get a long filename?

Hello, All!

I have a FileObject with short filename in create dispatch. I want to get a
long filename for this file.

Any information would be helpful.

Thanx in advance,
Eugene.

The only way (unfortunately) to obtain LFN is to query LFN (via DirControl
or
Create/QueryFileInfo) for each element in the path.

Regards,

Vladimir

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Thursday, May 30, 2002 3:40 AM
To: File Systems Developers
Subject: [ntfsd] How to get a long filename?

Hello, All!

I have a FileObject with short filename in create dispatch. I want to get a
long filename for this file.

Any information would be helpful.

Thanx in advance,
Eugene.


You are currently subscribed to ntfsd as: xxxxx@Starbase.com
To unsubscribe send a blank email to %%email.unsub%%

ZwQueryInformationFile with FILE_NAME_INFORMATION
Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the appropriate
parameters.

Regards
Kurt

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Thursday, May 30, 2002 3:40 AM
To: File Systems Developers
Subject: [ntfsd] How to get a long filename?

Hello, All!

I have a FileObject with short filename in create dispatch. I want to get a
long filename for this file.

Any information would be helpful.

Thanx in advance,
Eugene.


You are currently subscribed to ntfsd as: xxxxx@1vision.com
To unsubscribe send a blank email to %%email.unsub%%

Greetings mortal, Kurt!
You wrote on Thu, 30 May 2002 15:01:53 -0600:

KG> ZwQueryInformationFile with FILE_NAME_INFORMATION
KG> Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the
KG> appropriate parameters.

This doesn’t work. Return name is the same. Try to open a file from the DOS
application…

Eugene.

I believe this issue was resolved in XP, but in earlier versions Eugene is
right - it doesn’t work.

Try looking it up in the containing directory. That will work - that’s how
CopyFileW does it, for instance.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Friday, May 31, 2002 6:03 AM
To: File Systems Developers
Subject: [ntfsd] Re: How to get a long filename?

Greetings mortal, Kurt!
You wrote on Thu, 30 May 2002 15:01:53 -0600:

KG> ZwQueryInformationFile with FILE_NAME_INFORMATION
KG> Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the
KG> appropriate parameters.

This doesn’t work. Return name is the same. Try to open a file from the DOS
application…

Eugene.


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%

Sorry that did not work… It’s been too long since I ran anything from DOS
:wink:

Just a guess, but you could try getting the system file number, and opening
the file by number (I seem to remember you can do this), and then try
quering the name???

Do you need the FQLN or just the long name of the file itself?

Regards,
Kurt

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Friday, May 31, 2002 3:03 AM
To: File Systems Developers
Subject: [ntfsd] Re: How to get a long filename?

Greetings mortal, Kurt!
You wrote on Thu, 30 May 2002 15:01:53 -0600:

KG> ZwQueryInformationFile with FILE_NAME_INFORMATION
KG> Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the
KG> appropriate parameters.

This doesn’t work. Return name is the same. Try to open a file from the DOS
application…

Eugene.


You are currently subscribed to ntfsd as: xxxxx@1vision.com
To unsubscribe send a blank email to %%email.unsub%%

The behavior that changed in Windows XP with regards to file names was
to make FAT’s behavior match NTFS’s – when you query for
FILE_NAME_INFORMATION the file system returns the name that the user
used to open the file for the final component in the path. Therefore,
if the user opened the file via its short name, that’s what you get; if
the user opened the file via its long name, that’s what it returned.
You are given no guarantee on whether all the other components in the
path are long or short. Of course if the file has been renamed between
the open and the query, you get the new filename.

To get a fully qualified path for a file that is composed of all the
long names, you need to open the parent directory of each path component
and query for the long file name for the file of interested using
ZwQueryDiectoryFile asking for FileNamesInformation. You can be a
little smarter as you walk through each component in the path and not
bothering to query for the long file name when it’s clear you already
have it (i.e., the component has more than 13 characters in it).

Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: Tony Mason [mailto:xxxxx@osr.com]
Sent: Friday, May 31, 2002 6:28 AM
To: File Systems Developers
Subject: [ntfsd] Re: How to get a long filename?

I believe this issue was resolved in XP, but in earlier versions Eugene
is
right - it doesn’t work.

Try looking it up in the containing directory. That will work - that’s
how
CopyFileW does it, for instance.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Friday, May 31, 2002 6:03 AM
To: File Systems Developers
Subject: [ntfsd] Re: How to get a long filename?

Greetings mortal, Kurt!
You wrote on Thu, 30 May 2002 15:01:53 -0600:

KG> ZwQueryInformationFile with FILE_NAME_INFORMATION
KG> Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the
KG> appropriate parameters.

This doesn’t work. Return name is the same. Try to open a file from the
DOS
application…

Eugene.


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%

> Just a guess, but you could try getting the system file number, and
opening

the file by number (I seem to remember you can do this), and then
try
quering the name???

I have doubts this will work on NTFS with hardlinks.

Max

It’s not going to work. What will be returned is the path to the file with
which (path)
file’s FCB has been created (i.e. path with which file has been opened at
the very
first time). So, if file has been opened “first time” with short (or
partially short)
path then you will get back from QueryInformation the same short path.

Regards,

Vladimir

-----Original Message-----
From: Kurt Godwin [mailto:xxxxx@1vision.com]
Sent: Thursday, May 30, 2002 2:02 PM
To: File Systems Developers
Subject: [ntfsd] RE: How to get a long filename?

ZwQueryInformationFile with FILE_NAME_INFORMATION
Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the appropriate
parameters.

Regards
Kurt

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru]
Sent: Thursday, May 30, 2002 3:40 AM
To: File Systems Developers
Subject: [ntfsd] How to get a long filename?

Hello, All!

I have a FileObject with short filename in create dispatch. I want to get a
long filename for this file.

Any information would be helpful.

Thanx in advance,
Eugene.


You are currently subscribed to ntfsd as: xxxxx@1vision.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntfsd as: xxxxx@Starbase.com
To unsubscribe send a blank email to %%email.unsub%%

Wow! It took just 26 hours to go through! Looks like global warming has
badly affected the speed of light!

PS Sorry for OT

-----Original Message-----
From: Chtchetkine, Vladimir [mailto:xxxxx@starbase.com]
Sent: Thursday, May 30, 2002 2:30 PM
To: File Systems Developers
Subject: [ntfsd] RE: How to get a long filename?

It’s not going to work. What will be returned is the path to the file with
which (path)
file’s FCB has been created (i.e. path with which file has been opened at
the very
first time). So, if file has been opened “first time” with short (or
partially short)
path then you will get back from QueryInformation the same short path.

Regards,

Vladimir

-----Original Message-----
From: Kurt Godwin [mailto:xxxxx@1vision.com mailto:xxxxx]
Sent: Thursday, May 30, 2002 2:02 PM
To: File Systems Developers
Subject: [ntfsd] RE: How to get a long filename?

ZwQueryInformationFile with FILE_NAME_INFORMATION
Or you could build an IRP with IRP_MJ_QUERY_INFORMATION and the appropriate
parameters.

Regards
Kurt

-----Original Message-----
From: Eugene Lomovsky [mailto:xxxxx@mail.ru mailto:xxxxx]
Sent: Thursday, May 30, 2002 3:40 AM
To: File Systems Developers
Subject: [ntfsd] How to get a long filename?

Hello, All!

I have a FileObject with short filename in create dispatch. I want to get a
long filename for this file.

Any information would be helpful.

Thanx in advance,
Eugene.


You are currently subscribed to ntfsd as: xxxxx@1vision.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntfsd as: xxxxx@Starbase.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntfsd as: xxxxx@Starbase.com
To unsubscribe send a blank email to %%email.unsub%%</mailto:xxxxx></mailto:xxxxx>