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...