In my minifilter project,I must reparse a create in postcreate.
I know the standard is return STATUS_REPARSE in precreate,but I do want return reparse in postcreate.
I do some tests for it:
1.return STATUS_REPARSE in precreate:
{
//modify targetfileobject->FileName
PFILE_OBJECT orifo= Data->Iopb->TargetFileObject;
//free target filename->Buffer,and reallocate it for source filename.nonpaged.
MyCopyUnicodeString(&orifo->FileName,filename,NonPagedPool);
orifo->RelatedFileObject =NULL;
//repase
Data->IoStatus.Status = STATUS_REPARSE;
Data->IoStatus.Information = IO_REPARSE;
return FLT_PREOP_COMPLETE ;
}
2.return STATUS_REPARSE in postcreate
{
//I have called FltCancelFileOpen for the fo,and cancelled all effects.
…
//modify targetfileobject->FileName
PFILE_OBJECT orifo= Data->Iopb->TargetFileObject;
//free target filename->Buffer,and reallocate it for source filename.nonpaged.
MyCopyUnicodeString(&orifo->FileName,filename,NonPagedPool);
orifo->RelatedFileObject =NULL;
//repase
Data->IoStatus.Status = STATUS_REPARSE;
Data->IoStatus.Information = IO_REPARSE;
return FLT_POSTOP_FINISHED_PROCESSING;
}
In test 1,it works well.
If I CreateFIle( C:\test\1.txt ),it will reparse,and all thinks is OK.
But in test2,it works strangely:
If I CreateFile ( C:\test\1.txt),it will reparse.My minifilter PreCreateRoutine will be called for the reparsed file,But the arguments is strangely.For example,the desiredaccess is 0!
Anybody can explain it?
And why I can’t return reparse in postcreate in details?
thanks.
If it is impossible,I must think a new idea in my project…