Search code examples
winapidriverminifilter

Is there a way to cancel a create or write operation while returning succes to the calling application?


I am trying to create a driver which fakes file writes, logging the attempts. However I do want the calling application to think it succeeded. Anybody some advice on how to do this?

I am new to driver programming (Windows); though I do have experience with C, C++ and operating system (creation).

I have looked at some samples but could not find anything like it nor was there any NTSTATUS that looks like it resembles what I am trying to do.

Edit 1: As for the fact that i need an intermediate driver, I already knew that. Now the minispy example does the logging but doesn't do the main functionality which is faking that the operation succeeded. As for the Dokan aproach I wan't to do this myself because I find it interesting and because I want to do the same for registry keys.


Solution

  • From the PreWrite simply complete the operation with STATUS_SUCCESS and return FLT_PREOP_COMPLETE. The write would have done nothing, as it does not get to the Filesystem and the caller of WriteFile get a success status.