Re: Access denied when trying to move directory in use



Corinna Vinschen wrote:
Jeffrey Tan[MSFT] wrote:
It seems that you are using undocumented Windows API ZwSetInformationFile
with FileRenameInformation parameter to move the files/directories. It

Sigh. I didn't even realize that this is an undocumented API until
you just told me. [...]

Btw., it's irritating that ZwSetInformationFile (FileRenameInformation)
is "undocumented". FltSetInformationFile (FileRenameInformation) as
well as the FILE_RENAME_OPERATION structure *are* documented and both
refer to ZwSetInformationFile in terms of the FileRenameInformation
class, see http://msdn2.microsoft.com/en-us/library/aa488684.aspx and
http://msdn2.microsoft.com/en-us/library/ms791548.aspx(*).

I don't quite understand why such a simple and basic operation should be
treated as undocumented. It doesn't do anything hidden, dangerous, or
mysterious.


Corinna


(*) The FILE_RENAME_OPERATION documentation isn't quite correct. It claims

"A file cannot be renamed if it has any open handles, unless it is
only open because of a [...] (oplock) [...]."

A file or directory can be renamed regardless if it has an open handle
or not, as long as the open handle is opened for sharing.

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
.