Thank you all for your help and tips in the matter - they were all very helpful. The code snippet provided by Cheng-mean Liu was especially helpful. Cheng-mean Liu, I have one more question related to the example you brought here:
// gPrivateInterfaceRefStringCmp is your prviate interface // string that you register through IoRegisterDeviceInterface() // in the AddDevice() routine
In a "low level" WDM driver, I would of course use IoRegisterDeviceInterface() to register the device interface. Thanks to the book that I have, I also know that it should be done *after creating* the device, but *before attaching* it to the device stack. Which brings a question similar to the one asked by Tom: Does IoRegisterDeviceInterface() really fit into the PortCls scheme? That is, in PortCls we issue a single call to PcAddAdapterDevice() which already takes care of attaching the device object to the device stack. Thus, even if it is OK to call IoRegisterDeviceInterface() in AddDevice(), it is certainly illegal to call it *after* PcAddAdapterDevice(). Did I get this right? If not, what am I missing? Does PcAddAdapterDevice() also takes care of registering a device interface? I know that it registers *subdevices* (via StartDevice's PcRegisterSubdevice) but does this come in place of the overall device interface or in addition to it? As you can see here, I am pretty confused. And lastly, provided that I can register as many device interfaces as I want (*before* calling PcAddAdapterDevice()), *must* I register a new interface in order to handle custom IRP_MJ_DEVICE_CONTROL IOCTLs? Or can I "reuse" one of the existing interfaces for that purpose? Thanks, Don ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/