ZwQueryInformationFile in IRP_MJ_CREATE Context

Hi,

I am trying to get the file unique identifier by calling ZwQueryInformationFile with FileInternalInformation. calling ZwQueryInformationFile require me to open the file using ZwCreateFile, I want to save the ZwCreateFile call and I wonder… the ZwQueryInformationFile API is being called through the context of IRP_MJ_CREATE ( for reading ) of that file, can I somehow get the handle from the creation parameters? can I use the associated FILE_OBJECT for that? should that be done from the completion routine of that IRP?

Any help would be appreciated.

Naddav.


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

Don’t use ZwQueryInformationFile in the IRP_MJ_CREATE path.
Build your own IRP and send it to the lower driver instead.

L.

If you want to do this in dispatch you can’t use the
fileobject because the FS hasn’t seen the request yet
and therefore it is not valid yet. You will need to
determine the file name (not trivial) and open it
yourself.

If you can wait until completion you can see if the
operation was successful and use the file object then.
Remember that completion sometimes happens at a high
IRQL and some operations are not safe. You may need
to post to another thread.

— Nadav wrote:

>
> Hi,
>
>
>
> I am trying to get the file unique identifier by
> calling ZwQueryInformationFile with
> FileInternalInformation. calling
> ZwQueryInformationFile require me to open the file
> using ZwCreateFile, I want to save the ZwCreateFile
> call and I wonder… the ZwQueryInformationFile API
> is being called through the context of IRP_MJ_CREATE
> ( for reading ) of that file, can I somehow get the
> handle from the creation parameters? can I use the
> associated FILE_OBJECT for that? should that be done
> from the completion routine of that IRP?
>
>
>
> Any help would be appreciated.
>
>
>
> Naddav.
>
>
>
>
>
>
>
> ---------------------------------
> Yahoo! for Good
> Click here to donate to the Hurricane Katrina
> relief effort.
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com

Oh, and don’t forget to check specifically for a
return status of STATUS_REPARSE. NT_SUCCESS(status)
will be TRUE when STATUS_REPARSE is returned, but the
file object will not be valid.

— Randy Cook wrote:

> If you want to do this in dispatch you can’t use the
> fileobject because the FS hasn’t seen the request
> yet
> and therefore it is not valid yet. You will need to
> determine the file name (not trivial) and open it
> yourself.
>
> If you can wait until completion you can see if the
> operation was successful and use the file object
> then.
> Remember that completion sometimes happens at a
> high
> IRQL and some operations are not safe. You may need
> to post to another thread.
>
> — Nadav wrote:
>
> >
> > Hi,
> >
> >
> >
> > I am trying to get the file unique identifier by
> > calling ZwQueryInformationFile with
> > FileInternalInformation. calling
> > ZwQueryInformationFile require me to open the file
> > using ZwCreateFile, I want to save the
> ZwCreateFile
> > call and I wonder… the ZwQueryInformationFile
> API
> > is being called through the context of
> IRP_MJ_CREATE
> > ( for reading ) of that file, can I somehow get
> the
> > handle from the creation parameters? can I use the
> > associated FILE_OBJECT for that? should that be
> done
> > from the completion routine of that IRP?
> >
> >
> >
> > Any help would be appreciated.
> >
> >
> >
> > Naddav.
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Yahoo! for Good
> > Click here to donate to the Hurricane Katrina
> > relief effort.
> > —
> > Questions? First check the IFS FAQ at
> > https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>