Can not open file in the callback of IRP_MJ_SET_INFORMATION post operation

Hello. As the title implied, I have a problem in opening file in the callback of IRP_MJ_SET_INFORMATION post operation.
My project is inherited from Microsoft “scanner” minifilter project in github.
I want to open file after the file is renamed. So I registered callbacks to IRP_MJ_SET_INFORMATION event.
Originally I tried to open a file in pre operation callback. But file handler is not fully released, so failed in opening file.
So I tried to open file in post operation of IRP_MJ_SET_INFORMATION event. But still can not open file.
What should I do if I want to open file in that callback?
Thanks in advance.

  • What is the status that you get. That is usually a good hint
  • Odd things happen after rename of a file on RDR, is this your situation?
  • What does “ But file handler is not fully released, so failed in opening file” mean. No I am not going to the sample code
1 Like

Thanks for your reply.

@rod_widdowson said:

  • What is the status that you get. That is usually a good hint
    Driver mode send file path to user mode. Then, user mode tries to open that file using “fopen”. GetLastError returns 32. It means:ERROR_SHARING_VIOLATION The process cannot access the file because it is being used by another process.

BTW, Is there any way to giveup file access privilege so other process can access that file in minifilter?