name retrieval in create

Hello all,

I’ve looked into the code of SFilter in the XP IFS
kit
and some parts are very confusing.

It looks like that in the function SfGetFileName
they access the FileObject->FileName and also to
FileObject->ReleatedFileObject->FileName, this is
only in case the create fails.
In the FS FAQ it is specified that you shouldn’t
access these fields after you pass that request to
the underlying driver.
Can someone explain why in the Spy sample they access

these fields?

Another question I have, it seems that after they
pass the create request and wait on the event.
when they query the name they completely ignore the
FileObject->ReleatedFileObject and only query the
FileObject. This obviously raise the question
what if the path is relative?

Thanks

Mike


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Hi Mike,

If you are looking for sample code on how to get file names, the filespy
sample is a much better sample to refer to. SpyGetFullPathName has the
majority of this work and it shows how to get a name both before the
CREATE has been passed to the file system and once the file object has
been initialized. It also shows how to generate a
IRP_MJ_QUERY_INFORMATION irp in your driver to query for the name which
is a better method than using ObQueryNameString because it is less
likely to deadlock and you can avoid recursive IOs by directing your
query to the filter below your driver.

In the case of the failed CREATE, SfGetFileName should not be
referencing the FileObject->FileName and
FileObject->RelatedFileObject->FileName fields. This will be fixed in
the next version of the IFS Kit (that is planned to ship when Server
2003 Service Pack 1 ships).

Once a file object has been successfully initialized by the file system,
there is no need to build the name from the RelatedFileObject any
longer. If you query the file system for the name (as ObQueryNameString
will do), the name the file system returns is the full path from the
root of the volume regardless whether this was a related open or not.

Thanks,
Molly Brown
Microsoft Corporation

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mike Malgin
Sent: Saturday, August 21, 2004 10:15 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] name retrieval in create

Hello all,

I’ve looked into the code of SFilter in the XP IFS
kit
and some parts are very confusing.

It looks like that in the function SfGetFileName
they access the FileObject->FileName and also to
FileObject->ReleatedFileObject->FileName, this is
only in case the create fails.
In the FS FAQ it is specified that you shouldn’t
access these fields after you pass that request to
the underlying driver.
Can someone explain why in the Spy sample they access

these fields?

Another question I have, it seems that after they
pass the create request and wait on the event.
when they query the name they completely ignore the
FileObject->ReleatedFileObject and only query the
FileObject. This obviously raise the question
what if the path is relative?

Thanks

Mike


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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

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