Determining file existence in create dispatch handler

I have a file filter driver that intercepts MJ_CREATEs to perform locking.  I want to be able to verify the file exists prior to user-mode communications in the dispatch routine (which ultimately decides whether to fail the request), and ignore files that don’t exist.  Since the file object isn’t fully valid until after create completion, I’m not able to use ZwQueryInformationFile or roll my own IRP to do the same.  And as far as I know I’m not able to deny the create request in the completion routine.  I had been using ZwOpenFile until I did some more testing and discovered some cases where this routine will deadlock the driver in the creating app’s context.  Is there a way I can have the driver verify the existence of the opening/creating file in the create dispatch handler?

 

-Mike

>And as far as I know I’m not able to deny the create request in the completion routine

IoCancelFileOpen()

I had been using ZwOpenFile

use IoCreateFileSpecifyDeviceObjectHint


Slava Imameyev, xxxxx@hotmail.com

“Mike Wick” wrote in message news:xxxxx@ntfsd…
I have a file filter driver that intercepts MJ_CREATEs to perform locking. I want to be able to verify the file exists prior to user-mode communications in the dispatch routine (which ultimately decides whether to fail the request), and ignore files that don’t exist. Since the file object isn’t fully valid until after create completion, I’m not able to use ZwQueryInformationFile or roll my own IRP to do the same. And as far as I know I’m not able to deny the create request in the completion routine. I had been using ZwOpenFile until I did some more testing and discovered some cases where this routine will deadlock the driver in the creating app’s context. Is there a way I can have the driver verify the existence of the opening/creating file in the create dispatch handler?

-Mike