- KMDF PDO devices
- Posted by Maxim on October 19th, 2007
Another message related to my ongoing disk driver work. Feel like I am
almost there.
I am adding support for partitioning in my KMDF disk driver and pretty much
following the reference WDM class disk driver. I.e., when a disk is
partitioned, I attempt to create a PDO for each partition and add them as
statically-enumerated children to the parent FDO. I run into several
problems while doing this.
1. I create PDOs with names that mimic what class driver does. I.e. name
is \device\harddiskX\nameY, which is then symbolically linked to
\device\harddiskX\partitionY. Calls to create the PDO and to create symbolic
link succeed. However, when I go and look with WINOBJ, the actual device
name is missing from the directory.
2. After PDOs have been created, the device will not get fully disabled
when asked to. All the shutdown callbacks execute correctly, I explicitly
disable each PDO with WdfPdoMarkMissing, yet an attempt to re-enable device
fails with code 38 (device still in memory).
3. For each PDO, I register MOUNTDEV_MOUNTED_DEVICE_GUID. The call to
register the interface succeeds, however the subsequent
WdfDeviceRetrieveDeviceInterfaceString call fails.
In general, is this a right approach to creating what are effectively
virtual devices (since all partitions reside on the same actual disk)? I am
effectively not using any PNP functionality for the PDOs... Should I be
perhaps creating control devices rather than PDOs?
Thanks
- Posted by Maxim on October 19th, 2007
Btw, re #3 above, WdfDeviceRetrieveDeviceInterfaceString fails with
STATUS_INVALID_DEVICE_STATE
- Posted by Doron Holan [MSFT] on October 22nd, 2007
1 in what context are you creating the symbolic links? if it is not in the
context of a system process, the links may be session specific
2 marking a pdo as missing is not disabling the device, it is telling the
OS that it has been suprise removed and will disappear from the device tree.
you can only disable a device in UM
3 this is a little complicated. when you create the PDO, it is not yet a
pnp device. it becomes a pnp device later when the device object is
reported to the pnp manager in QDR/BusRelations. you can only register the
device interface once it is a pnp PDO, so KMDF handles this for you and
delays the registration until the right time. this means you cannot create
a PDO and then subsequently query for the device itnerface string registered
against it. Instead, query for the string in EvtDeviceSelfManagedIoInit
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Maxim" <Maxim@discussions.microsoft.com> wrote in message
news:914C0A6B-52CE-42CA-91D3-9C8C84215ACA@microsoft.com...
- Posted by Maxim on November 2nd, 2007
thanks, doron, this answers these questions