NLGetFullPathName rule exception for RelatedFileObject case?

Recently I hit the following case in our native FSFD attached to NTFS on
Windows 2003-SP1 system.

During pre-create I need to get full file name path for the file/directory
that will go down the device stack. I’m aware of issues related to “get file
name” during create (file ID, Object ID, RelatedFileObject,
RelatedFileObject for ADS open, when ->FileName buffer is valid).
My information base is IFS kit documentation, samples from IFS Kit
(3790.1830) and several threads discussed about RelatedFileObject in this
mailing list.

The case where I hit problem is for “// CASE 3: We are opening a file that
has a RelatedFileObject.”:
If file is not open with File ID or Object ID, then for RelatedFileObject !=
NULL case in pre-IRP_MJ_CREATE do:

  1. Query FS for RelatedFileObject file name.
  2. Concatenate name from 1. with what *user* has set in
    pFileObject->FileName.

This is basically the same approach as in IFS Kit sample NLGetFullPathName
function.

An example of file names I get for this problematic case is:
I query FS for RelatedFileObject name and I get L"\A\B". In
pFileObject->FileName the name that *user* has put there is
L"\A\B\C\SomeFile.dat".
If I concatenate both strings I get L"\A\B\A\B\C\SomeFile.dat" which does
not exist, but (!) the post-IRP_MJ_CREATE is completed with STATUS_SUCCESS!
File that really exists on my FS is L"\A\B\C\SomeFile.dat". Looks like FS
knows that RelatedFileObject should be ignored for this case.
Now, how can I know this in pre-create too?

I noticed that there is leading L’' in pFileObject->FileName (and it is
relative open?) and that the IRP_MJ_CREATE came in from SRV (LAN share).

Can someone bring more light on this case?

WBR Primoz
p.s. I have full memory dump too.

In the description: “The RelatedFileObject field is used to indicate that
the given file has been opened relative to an already open file.” So if the
pFileObject->FileName is absolute, you can safely ignore RelatedFileObject.

Ken


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Primoz Beltram
Sent: Tuesday, September 13, 2005 6:02 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] NLGetFullPathName rule exception for RelatedFileObject
case?

Recently I hit the following case in our native FSFD attached to NTFS on
Windows 2003-SP1 system.

During pre-create I need to get full file name path for the file/directory
that will go down the device stack. I’m aware of issues related to “get file
name” during create (file ID, Object ID, RelatedFileObject,
RelatedFileObject for ADS open, when ->FileName buffer is valid).

My information base is IFS kit documentation, samples from IFS Kit
(3790.1830) and several threads discussed about RelatedFileObject in this
mailing list.

The case where I hit problem is for “// CASE 3: We are opening a file that
has a RelatedFileObject.”:

If file is not open with File ID or Object ID, then for RelatedFileObject !=
NULL case in pre-IRP_MJ_CREATE do:

  1. Query FS for RelatedFileObject file name.
  2. Concatenate name from 1. with what *user* has set in
    pFileObject->FileName.

This is basically the same approach as in IFS Kit sample NLGetFullPathName
function.

An example of file names I get for this problematic case is:

I query FS for RelatedFileObject name and I get L"\A\B". In
pFileObject->FileName the name that *user* has put there is
L"\A\B\C\SomeFile.dat".

If I concatenate both strings I get L"\A\B\A\B\C\SomeFile.dat" which does
not exist, but (!) the post-IRP_MJ_CREATE is completed with STATUS_SUCCESS!

File that really exists on my FS is L"\A\B\C\SomeFile.dat". Looks like FS
knows that RelatedFileObject should be ignored for this case.

Now, how can I know this in pre-create too?

I noticed that there is leading L’' in pFileObject->FileName (and it is
relative open?) and that the IRP_MJ_CREATE came in from SRV (LAN share).

Can someone bring more light on this case?

WBR Primoz

p.s. I have full memory dump too.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

> In the description: "The RelatedFileObject field is used to indicate that

the given file has been opened relative to an already open file." So if
the
pFileObject->FileName is absolute, you can safely ignore
RelatedFileObject.

Well, but how to know that the Fileobject->FileName
is absolute path in this case ?

L.