信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfIoTargetQueryTargetProperty 方法

The WdfIoTargetQueryTargetProperty method retrieves a specified device property for a specified I/O target.

语法

NTSTATUS WdfIoTargetQueryTargetProperty(
  [in]  WDFIOTARGET IoTarget,
  [in]  DEVICE_REGISTRY_PROPERTY DeviceProperty,
  [in]  ULONG BufferLength,
        PVOID PropertyBuffer,
        __deref_out_range ResultLength
);

参数

IoTarget [in]

A handle to a local or remote I/O target object that was obtained from a previous call to WdfDeviceGetIoTarget or WdfIoTargetCreate, or from a method that a specialized I/O target supplies.

DeviceProperty [in]

A DEVICE_REGISTRY_PROPERTY-typed value that identifies the device property to be retrieved.

BufferLength [in]

The size, in bytes, of the buffer that PropertyBuffer points to.

PropertyBuffer

A pointer to a caller-allocated buffer that receives the requested device property information. This pointer can be NULL if BufferLength is zero.

ResultLength

A pointer to a location that, on return, contains the size, in bytes, of the information that WdfIoTargetQueryTargetProperty stored in the buffer that PropertyBuffer points to. If WdfIoTargetQueryTargetProperty returns STATUS_BUFFER_TOO_SMALL, this location receives the required buffer size.

返回值

WdfIoTargetQueryTargetProperty returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

返回代码说明
STATUS_BUFFER_TOO_SMALL

The buffer that the PropertyBuffer parameter pointed to was too small to receive the requested information.

STATUS_INVALID_PARAMETER_2

The value that the DeviceProperty parameter specified was invalid.

STATUS_INVALID_DEVICE_REQUEST

The device's drivers have not yet reported the device's properties.

 

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

评论

Before drivers receive device property data, they typically call the WdfIoTargetQueryTargetProperty method to obtain the required buffer size. For some properties, the data size can change between when the required size is returned and when the driver calls WdfIoTargetQueryTargetProperty again. Therefore, drivers should call WdfIoTargetQueryTargetProperty inside a loop that executes until the return status is not STATUS_BUFFER_TOO_SMALL.

Instead of calling WdfIoTargetQueryTargetProperty, your driver can call WdfIoTargetAllocAndQueryTargetProperty, which allocates a buffer and places the property information in the buffer.

For more information about WdfIoTargetQueryTargetProperty, see Obtaining Information About a General I/O Target.

For more information about I/O targets, see Using I/O Targets.

示例

The following code example obtains a device's DevicePropertyUINumber property. The example calls WdfIoTargetQueryTargetProperty instead of WdfIoTargetAllocAndQueryTargetProperty because the length of a UI number is known.

ULONG targetUINumber, resultLength;
NTSTATUS status;

status = WdfIoTargetQueryTargetProperty(
                                        target,
                                        DevicePropertyUINumber,
                                        sizeof(targetNumber),
                                        &targetUINumber,
                                        &resultLength
                                        );

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfiotarget.h (包括Wdf.h)

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

PASSIVE_LEVEL

另请参见

DEVICE_REGISTRY_PROPERTY
WdfDeviceGetIoTarget
WdfDeviceQueryProperty
WdfIoTargetAllocAndQueryTargetProperty
WdfIoTargetCreate

 

 

社区附加资源

显示:
© 2014 Microsoft