I'm updating a functioning KMDF driver for a PCI device, using WinDDK 7600.16385.1 and OSR's ddkbuild.cmd, targeting WLH, testing on Win7 x86 and x64.
I'm attempting to retrieve the DEVPKEY_Device_LocationPaths property.
The Device Manager Device Properties Details tab displays the expected value in "Location Paths" ...
PCIROOT(0)#PCI(1C00)#PCI(0000)#PCI(0200)#PCI(0000)#PCI(0900)#PCI(0000)#PCI(0400)
... but calling IoGetDevicePropertyData() from the EvtDriverDeviceAdd handler ...
PDEVICE_OBJECT pWdmPDO = WdfFdoInitWdmGetPhysicalDevice( pDeviceInit );
[... WdfDeviceCreate succeeds ...]
WCHAR wszLocationStrings[128] = { 0 }; // Temporary, just to confirm DDI works
ULONG ulRequiredSize = 0;
DEVPROPTYPE devPropType = 0;
status = IoGetDevicePropertyData( pWdmPDO,
&DEVPKEY_Device_LocationPaths,
LOCALE_NEUTRAL,
/*ulFlags*/ 0,
sizeof(wszLocationStrings),
wszLocationStrings,
&ulRequiredSize,
&devPropType );
... always returns STATUS_OBJECT_NAME_NOT_FOUND.
I have tried ...
calling IoGetDevicePropertyData() for other DEVPKEY_Device_* values. The result is the same.
calling IoGetDevicePropertyData() in the EvtDevicePrepareHardware handler. The result is the same.
calling WdfDeviceWdmGetPhysicalDevice() to retrieve the PDO. The result is the same
WdfDeviceAllocAndQueryProperty(). It works correctly but does not provide the info I require.
WdfFdoQueryForInterface( GUID_PNP_LOCATION_INTERFACE ). It works correctly but only provides the current node (i.e. "PCI(0400)")
Searching for sample code that calls IoGetDevicePropertyData. I found the Windows CDROM Storage Class Driver sample but it doesn't appear to do anything I haven't tried already.
So ... what am I missing?