Closing a file object that is opened using IoCreateFileSpecifyDeviceObjectHint.

Hi,

I am opening a file in my FSFD using IoCreateFileSpecifyDeviceObjectHint and
getting file object using ObReferenceObjectByHandle. When closing the file
do I need to call ZwClose on handle and ObDereferenceObject on object or is
it sufficient to call only one of them?

Thanks,
VC

Yes you need to restore the reference count yourself, that is call
ObDereferenceObject for everytime you call ObReferenceObject otherwise the
file object will not get deleted and stay alive.

//Daniel

“VC” wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I am opening a file in my FSFD using IoCreateFileSpecifyDeviceObjectHint
> and getting file object using ObReferenceObjectByHandle. When closing the
> file do I need to call ZwClose on handle and ObDereferenceObject on object
> or is it sufficient to call only one of them?
>
> Thanks,
> VC
>
>