2

我正在为 PCI 设备更新功能正常的 KMDF 驱动程序,使用 WinDDK 7600.16385.1 和 OSR 的 ddkbuild.cmd,针对 WLH,在 Win7 x86 和 x64 上进行测试。

我正在尝试检索 DEVPKEY_Device_LocationPaths 属性。

设备管理器设备属性详细信息选项卡在“位置路径”中显示预期值...

PCIROOT(0)#PCI(1C00)#PCI(0000)#PCI(0200)#PCI(0000)#PCI(0900)#PCI(0000)#PCI(0400)

...但是从 EvtDriverDeviceAdd 处理程序调用 IoGetDevicePropertyData() ...

    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 );

... 总是返回 STATUS_OBJECT_NAME_NOT_FOUND。

我努力了 ...

  • 为其他 DEVPKEY_Device_* 值调用 IoGetDevicePropertyData()。结果是一样的。

  • 在 EvtDevicePrepareHardware 处理程序中调用 IoGetDevicePropertyData()。结果是一样的。

  • 调用 WdfDeviceWdmGetPhysicalDevice() 来检索 PDO。结果是一样的

  • WdfDeviceAllocAndQueryProperty()。它工作正常,但不提供我需要的信息。

  • WdfFdoQueryForInterface(GUID_PNP_LOCATION_INTERFACE)。它工作正常但只提供当前节点(即“PCI(0400)”)

  • 搜索调用 IoGetDevicePropertyData 的示例代码。我找到了 Windows CDROM 存储类驱动程序示例,但它似乎没有做任何我还没有尝试过的事情。

所以......我错过了什么?

4

1 回答 1

0

我在 WinHEC 2006 powerpoint 中找到了一个 MS PnP 支持电子邮件地址,并收到了 Microsoft 的回复...

On Vista and Windows 7, IoGetDevicePropertyData cannot retrieve all the DEVPKEY
properties that user-mode can. There is no way for you to directly retrieve that
full path as created by the operating system from kernel mode.

For further questions, the Windows Hardware WDK and Driver Development forum 
(http://social.msdn.microsoft.com/Forums/en-US/wdk/threads ) is a good place to
ask driver development questions.

......我回应了......

Thank you very much to your quick response!

It would be very helpful if the IoGetDevicePropertyData online docs could be updated
to include a list of the DEVPKEY properties that are supported and restrictions on
their availability (i.e. only after Start IRP completes as noted in the WinHEC 
powerpoint)

And thanks for the link to the forum, I'll start there next time.
于 2013-03-15T19:51:34.653 回答