Tech Support > Microsoft Windows > Drivers > Know the name file assigned to Object
Know the name file assigned to Object
Posted by on December 25th, 2003


How to know the name file (example: \\.\mondrivernumeroX)
associate the object or the IRP, in the runtime
dispatching ?

NTSTATUS MonDriverDispatch(IN PDEVICE_OBJECT
DeviceObject,IN PIRP Irp)

Posted by Don Burn on December 25th, 2003


Well if it is your driver, record the name you created in the device object
extension.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

<sivaller.bewod@laposte.net> wrote in message
news:004801c3cb14$a0e0b010$a401280a@phx.gbl...


Posted by Walter Oney on December 25th, 2003


sivaller.bewod@laposte.net wrote:
Can you give us a better idea of what you're trying to accomplish? Part
of our difficulty in answering is that IRPs don't have names. And which
of the many "the object" things do you think you need the name of?

--
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com

Posted by Maxim S. Shatskih on December 26th, 2003


Usually, the fact that the IRP is arrived to your device allows you to
auto-deduce the device name - it is yours :-)

If your device has several functionalities separately openable from user
mode by different names - then you will have the "filename tail" in the CREATE
IRP, and will create the appropriate file object context for it.
Other IRPs will just check the
(PYOUROBJECT)(CurrentLoc->FileObject->FsContext2) and behave dependent on this.
PYOUROBJECT can be a C++ object with a VMT, for instance.
Do not forget to destroy this object in MJ_CLOSE path, which is, in fact, a
destructor for a file object.

Note the ReferenceString parameter to IoRegisterDeviceInterface. This is
what I'm talking about:
- at design stage, define what sub-functions your device will have, and a
PnP devinterface GUID for each.
- invent a reference string for each sub-function.
- in MN_START_DEVICE path, call IoRegisterDeviceInterface several times,
each times with necessary GUID and reference string.
- in MJ_CREATE path, check FileObject->FileName, it must be one of the
reference strings (prefixed by a backslash). From this you decide - what
sub-function the user wants to open, and will attach the appropriate context to
FileObject->FsContext2.
- other IRPs behave based on FileObject->FsContext2
- MJ_CLOSE destroyes FileObject->FsContext2

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


<sivaller.bewod@laposte.net> wrote in message
news:004801c3cb14$a0e0b010$a401280a@phx.gbl...



Similar Posts