Redirect IRP_MJ_CREATE to another file

Hi,

I am new to driver development so please excuse some of my learning questions.

In our minifilter, we have a scenario where we have an existing file but want to create a new file and have the original file a symlink reparse point so that the users can get seamlessly redirected after the new file is created and populated.
Ideally I would want to have the content of the original file unchanged and only add a reparse point to it so later if we remove the reparse point this could be used again. However this is not a hard requirement.

Since trying to add the reparse point to the original file is returning STATUS_ACCESS_DENIED i understand that the original file cannot have the reparse point since it already has data in the default stream. To work around this in IRP_MJ_CREATE (post create) I created another file when I detect this scenario and added the symlink to the target file.

The problem that I am now facing is that I am not sure how to open the target file from the IRP_MJ_CREATE? Currently since I have created the new symlink file in post create I tried to assign the FILE_OBJECT of the newly created symlink file to the one in Data->Iopb->TargetFile and return STATUS_REPARSE but this is not working as I expected. It is still opening the original file.

What is the correct way to be able to make the new symlink opened instead of the original file?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.