Purge file cache (force IRP_MJ_CLOSE)

Hello everyone:

A documented :slight_smile: way to flush and purge file cache after cleanup
(unreferencing FileObject and forcing IRP_MJ_CLOSE) is to
open file in question with FILE_NO_INTERMEDIATE_BUFFERING option flag set.
I’ve checked this, verified - it works, except…
If file has been deleted (on cleanup, but no close yet) then ZwCreate
returns STATUS_OBJECT_NAME_NOT_FOUND (of course!)
and FileObject is still referenced. Can anybody suggest how I can handle
that case?

TIA,

Vladimir