rename question

Hi all,
Have a quick question about the “hideous truth” of renames. In the
case of fully qualified and relative renames, does
Parameters.SetFile.FileObject ALWAYS contain a pointer to a FILE_OBJECT for
the directory into which the file is being renamed? Is this what is meant
by the term “target” when the docs say “this parameter is a file object
pointer for the target of a fully qualified rename operation.”? Secondly,
the RootDirectory parameter of AssociatedIrp.SystemBuffer contains a handle
to a directory in the fully qualified and relative cases. Is it true that
this handle may refer to a directory into which the file is being renamed,
or any directory on the path of the file’s new pathname? I’m basically
wondering about the relationship between the RootDirectory handle and the
Parameters.SetFile.FileObject file object.

TIA,
Matt

When a rename happens, before sending down the IRP_MJ_SET_INFORMATION
Irp, the IO Manager opens the parent directory for the new name. The
resulting file object is stored in Parameters.SetFile.FileObject.

The name used for this open is exactly the name specified in the
FILE_RENAME_INFORMATION structure. In the OBJECT_ATTRIBUTES structure
setup for this open, the RootDirectory rename parameter is used for the
RootDirectory OBJECT_ATTRIBUTES’ field and the FileName rename parameter
is used for the OBJECT_ATTRIBUTES’ ObjectName field. Although the full
new name is specified, the IO Manager uses the IO_OPEN_TARGET_DIRECTORY
flag for the Options parameter to IoCreateFile() to tell the file system
to really open the parent directory of the name provided.

This opening of the parent directory is needed to ensure that the user
issuing the rename has sufficient permission to add a child to the
directory specified by the new pathname.

For renames which are relative to the file object itself (FileName
specified is relative and RootDirectory is NULL), this step isn’t
required, so you will not see the additional open of the parent
directory and the Parameters.SetFile.FileObject will be NULL.

The documentation for Parameters.SetFile.FileObject is *incorrect*. We
realized this a couple weeks ago and Diane is already working on fixing
it.

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 Matthew N. White
Sent: Friday, January 09, 2004 12:47 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] rename question

Hi all,
Have a quick question about the “hideous truth” of renames. In
the case of fully qualified and relative renames, does
Parameters.SetFile.FileObject ALWAYS contain a pointer to a FILE_OBJECT
for the directory into which the file is being renamed? Is this what is
meant by the term “target” when the docs say “this parameter is a file
object pointer for the target of a fully qualified rename operation.”?
Secondly, the RootDirectory parameter of AssociatedIrp.SystemBuffer
contains a handle to a directory in the fully qualified and relative
cases. Is it true that this handle may refer to a directory into which
the file is being renamed, or any directory on the path of the file’s
new pathname? I’m basically wondering about the relationship between
the RootDirectory handle and the Parameters.SetFile.FileObject file
object.

TIA,
Matt


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