Folder Rename Mini Filter + Vista RC1

Hi All,

I am having problem in handling rename/move operation for folders in Windows Vista RC1.

What i wanted to achieve is when I get rename/move irp for a Folder,
I want my minifilter to complete the request by creating destination folder and move the files from the source folder to destination folder in its pre-callback routine itself.

What I have observed in XP is that for folder move/rename operation when I set STATUS_ACCESS_DENIED in IoStatus.Status and complete the rename/move operation in pre_op itself
Windows XP or should I say “Windows Explorer” generates IRP_MJ_CREATE for the target folder and then individually calls Rename operation(IRP_MJ_SET_INFORMATION) on each file(s) of the source folder.

In case of Vista this has changed, failing a rename operation on folder fails the rename call.

Surprisingly there is no ZwQueryDirectoryFile equivalent function in FltMgr lib, and using ZwQueryDirectoryFile requires fileHandle, but I have only FileObject in my Mini Filter and If I try to open the source folder (FltCreateFile), the call simply fails.

Any ideas on how to handle folder rename operation in Windows Vista.

regards
Mohan

Well, there is a function for querying a directory via filter manager (FltQueryDirectoryFile) that is available on Vista, but that’s not really germane to your question.

Return STATUS_NOT_SAME_DEVICE to obtain the behavior you described. That it worked with STATUS_ACCESS_DENIED before is fortuitous (it should not have).

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Well thank you Tony,

yes I did tried setting STATUS_NOT_SAME_DEVICE in the Data->IoStatus.Status, but then explorer shows “Destination Folder Access denied” message, and the message description says “you need permissions to perform this action” which is kind of weird. i verified in FieSpy and return status for IRP_MJ_SET_INFORMATION shows STATUS_NOT_SAME_DEVICE.

For FltQueryDirectoryFile I did not find any reference of it in WDK Documentation for “WDK build 5600”, is it an undocumented function or guys at Microsoft missed to document in the help file… :slight_smile:

regards
Mohan Bisht

Search the archives of this list for a very good implementation of
FltQueryDirectoryFile.

  • Dan.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@rsystems.com
Sent: Thursday, October 12, 2006 11:34 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Folder Rename Mini Filter + Vista RC1

Well thank you Tony,

yes I did tried setting STATUS_NOT_SAME_DEVICE in the Data->IoStatus.Status,
but then explorer shows “Destination Folder Access denied” message, and the
message description says “you need permissions to perform this action” which
is kind of weird. i verified in FieSpy and return status for
IRP_MJ_SET_INFORMATION shows STATUS_NOT_SAME_DEVICE.

For FltQueryDirectoryFile I did not find any reference of it in WDK
Documentation for “WDK build 5600”, is it an undocumented function or guys
at Microsoft missed to document in the help file… :slight_smile:

regards
Mohan Bisht


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

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

Documentation tends to lag implementation - that’s the reality of OS level work. Neal told us the function would be there, it is in fltkernel.h and as Dan points out there’s a downlevel version as well.

I’ve used the STATUS_NOT_SAME_DEVICE trick for years and always had it work. Thus, I do not believe it is the technique that is flawed but rather your implementation of it. Note that FAT returns STATUS_INVALID_PARAMETER in this case.

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Yes, the shell handled the two the wrong way around :frowning: I was able to handle this with reparse points for my purpose, but that is not generally possible.

xxxxx@rsystems.com wrote:

Well thank you Tony,

yes I did tried setting STATUS_NOT_SAME_DEVICE in the Data->IoStatus.Status, but then explorer shows “Destination Folder Access denied” message, and the message description says “you need permissions to perform this action” which is kind of weird. i verified in FieSpy and return status for IRP_MJ_SET_INFORMATION shows STATUS_NOT_SAME_DEVICE.


King regards, Dejan
http://www.alfasp.com
File system audit, security and encryption kits.

STATUS_NOT_SAME_DEVICE definitely does not work for folder rename/move on XP, but rather returns an error.

xxxxx@osr.com wrote:

Documentation tends to lag implementation - that’s the reality of OS level work. Neal told us the function would be there, it is in fltkernel.h and as Dan points out there’s a downlevel version as well.

I’ve used the STATUS_NOT_SAME_DEVICE trick for years and always had it work. Thus, I do not believe it is the technique that is flawed but rather your implementation of it. Note that FAT returns STATUS_INVALID_PARAMETER in this case.

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com


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

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


King regards, Dejan
http://www.alfasp.com
File system audit, security and encryption kits.

> I’ve used the STATUS_NOT_SAME_DEVICE trick for years and always had it

IIRC STATUS_NOT_SAME_DEVICE is returned by IO manager itself (before ever
sending the IRP to FSDs) for cross-volume renames.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com