Re: rename fails on handle obtained by IoCreateFileSpecifyDeviceObject

Tech-Archive recommends: Fix windows errors by optimizing your registry



This is the wrong newsgroup. This newsgroup is about the win32 subsystem's
kernel portion such as win32k.sys. Try ntfsd for file systems questions at
OSR Online.

"xddev" <xddev@xxxxxxxxxxxxxxxx> wrote in message
news:64AE20D7-9092-4463-9D2D-3505D4AB4B86@xxxxxxxxxxxxxxxx
The problem concerns File System Filter - Vista w/o SP1.

We call ZwSetInformationFile(FileRenameInformation) on handle obtained by
IoCreateFileSpecifyDeviceObjectHint() with DeviceObject != NULL. Device
object is not highest-level device but next device in the file system
device
stack. It is relative rename, so RootDirectory contains handle to parent
directory of destination of file and Filename contains only filename - no
path. Handle to RootDirectory is opened also by
IoCreateFileSpecifyDeviceObjectHint() with the same DeviceObject. The
ZwSetInformationFile() fails with STATUS_INVALID_DEVICE_OBJECT_PARAMETER.

After some debugging I more and more believe that it is a Vista specific
bug
(no SP1 applied).

I tried to step through NtSetInformationFile(). It calls
IopOpenLinkOrRenameTarget(), which tries to open again target directory by
IoCreateFileEx() which fails. After some observation of parameters passed
to
IoCreateFileEx() it seems that field DeviceObjectHint in
DRIVER_CREATE_CONTEXT structure contains pointer to pointer to device
instead
of pointer to device object. I verified that it should contain direct
pointer
to device by stepping through IoCreateFileSpecifyDeviceObjectHint(), which
also calls IoCreateFileEx().

Furthermore it works fine on XP. Note that XP calls
IoCreateFileSpecifyDeviceObjectHint() from IopOpenLinkOrRenameTarget(), so
changing of API probably introduced bug in vista code.

Thanks in advance
--xddev


.