MiniFilter, IO_REPARSE and Rename

Hi,

I’m trying to implement a “filename redirection” using IO_REPRASE . everything seems to work just fine , until it comes to file-renaming (IRP_MJ_SET_INFORMATION) .

if my target-application (e.g cmd.exe) tries to rename

C:> ren source.txt target.txt

I’ve noticed 3 I/O requests:

  1. IRP_MJ_CREATE (“\source.txt”)
  2. IRP_MJ_CREATE (“\target.txt”) , with SL_OPEN_TARGET_DIRECTORY
  3. IRP_MJ_SET_INFORMATION from “\source.txt” to “??\C:\target.txt”

(I’ve noticed that the “??\C:\target.txt” comes from the FILE_RENAME_INFORMATION* structure , from Data->Iopb->Parameters.SetFileInformation.InfoBuffer )

I’m trying to redirect to target filename to another location (let’s say target.new) , but when i tried to return IO_REPEASE from the second operation , it doesn’t work and no file is created or renamed.

my “Pre-Operation” function ends with this:

Data->IoStatus.Status = STATUS_REPARSE;
Data->IoStatus.Information = IO_REPARSE;
Data->Iopb->TargetFileObject->RelatedFileObject=NULL;
FltSetCallbackDataDirty(Data);
return FLT_PREOP_COMPLETE;

In addition, i’ve noticed that when i’m trying to get the “full filename” of the second operation using FltGetFileNameInformation() , i get only the volumename+directory-name ,without the filename itself . (i guess it’s just because the target object is the folder and not the file …??? )

My question is how can i redirect the rename so the source-file will be taken from it’s original (real) location, and the target filename will be redirected to another filename/location ? Do i need to modify the “??\C:\target.txt” as well by re-allocating the FILE_RENAME_INFORMATION structure as well in the third operation ???

thank you in advanced,
zvika