Yes, I would expect IoFastQueryNetworkAttributes to be a PASSIVE_LEVEL
routine since there could be a create IRP rolled for this call (if fast
i/o for some reason returns false). And yes, ObjectAttributes should be
initialized in the usual way (whatever that means). And this routine as
well may result in reentering your driver (since you are concerned about
that).
-----Original Message-----
From: Lorenzo [mailto:xxxxx@email.it]
Sent: Tuesday, November 18, 2003 12:28 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Re: Retrieving a FILE_OBJECT from a string
Using functions like IoCreateFile or ZwClose wouldn’t cause reentrancy
problems in my filter driver? I need to get the file name from a
dispatch routine (and sometimes I may need to get it from a
CompletionRoutine), while in a dispatch routine I’m running at IRQL =
PASSIVE_LEVEL, in a CompletionRoutine I could be running at IRQL =
DISPATCH_LEVEL, and I can’t use those functions at that IRQL, so should
I build a worker thread when I’m in the CompletionRoutine?
Regarding the IoFastQueryNetworkAttributes:
I can’t find the documentation for this function in the ddk, but I found
its prototype in the ntifs.h header file, this function can only be
called at an IRQL = PASSIVE_LEVEL right? And its ObjectAttributes should
be initialized in the usual way?
Thanks.
Lorenzo
Tony Mason wrote:
Lorenzo,
You need to open the file. From the handle, extract the file object.
My personal (off the top of my head) algorithm would be:
IoCreateFile (or IoCreateFileSpecifyDeviceObjectHint from a filter on
XP or
W2K3) indicating SYNCHRONIZE access (I just want the file object, not
sharing checks, or normal security operations).
ObReferenceObjectByHandle - get a file object from the handle
IoQueryFileInformation - this uses the object (which I didn’t open
with
correct security anyway) to retrieve the requisite information
ObDereferenceObject - I’m done with it anyway
ZwClose - delete that unneeded handle (note you cant’ do this earlier
because it sends an IRP_MJ_CLEANUP at this point, which will not allow
you
to send arbitrary operations down at that point, since only paging I/O
operations are permitted between IRP_MJ_CLEANUP and IRP_MJ_CLOSE.)
Since this is off the top of my head, I may have missed some detail,
but
that’s the basic outline. No doubt whatever I might have missed will
be
picked up by someone else on the list - but in the interim you can go
off
and start writing code.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
http://www.osronline.com
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as:
xxxxx@borland.com
To unsubscribe send a blank email to xxxxx@lists.osr.com