阅读:2423回复:2
用静态枚举创建设定了名字,为何WdfFdoInitQueryProperty查询的pdo名字是空呢?用静态枚举设定了名字,为何WdfFdoInitQueryProperty查询的名字是空呢?其中返回 resultLength = 0 //代码如下 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //总线驱动中 静态枚举创建pdo pDeviceInit = WdfPdoInitAllocate(Device); if (pDeviceInit == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; goto Cleanup; } RtlUnicodeStringPrintf(&deviceName, L"%ws%ws%d", L"\\Device\\", L"ABCDEFG", num); KdPrint(("AddPdoDevice: %ws", deviceName.Buffer)); //设定设备类型名称 status = WdfDeviceInitAssignName(pDeviceInit, &deviceName); if(!NT_SUCCESS(status)) { KdPrint(("Can not set deviceName")); } WdfDeviceInitSetDeviceType(pDeviceInit, FILE_DEVICE_BUS_EXTENDER); WdfDeviceInitSetExclusive(pDeviceInit, TRUE); WdfDeviceInitSetCharacteristics(pDeviceInit, FILE_DEVICE_SECURE_OPEN, TRUE ); ..................... ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //功能驱动中 DECLARE_UNICODE_STRING_SIZE( deviceName, DEVICE_OBJECT_NAME_LENGTH ); bufferLength = 256; UNREFERENCED_PARAMETER(Driver); PAGED_CODE(); //查询物理设备名 pdo 的名字 status = WdfFdoInitQueryProperty(pDeviceInit, DevicePropertyPhysicalDeviceObjectName, bufferLength, deviceName.Buffer, &resultLength ); if (!NT_SUCCESS(status)) { return status; } . .................... 请各位高手给解释一下。那个地方错了。thanks。 还有其它的好的方法吗? |
|
|
沙发#
发布于:2009-11-13 10:51
在FDO中用此方法也不行:
IoGetDeviceProperty( WdfFdoInitWdmGetPhysicalDevice( pDeviceInit ) DevicePropertyPhysicalDeviceObjectName, bufferLength, deviceName.Buffer, &resultLength ); 可是我在总线驱动中命名设置了pdo的名字:WdfDeviceInitAssignName(............) 我需要在功能驱动中获取PDO设备的名字。可是就是得不到。 请高手指点。 |
|
|
板凳#
发布于:2009-11-24 13:07
你是想获取了PDO的名字后,在unnamed FDO的基础上建立symbolic link吧。
如果是这样的话,就不要用这个方法了。WdfDeviceCreateSymbolicLink()的第一个参数,是你建立的device。PDO是不行的。 |
|