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]
- 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.
A pointer to a caller-allocated buffer that receives the requested device property information. This pointer can be NULL if BufferLength is zero.
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:
The buffer that the PropertyBuffer parameter pointed to was too small to receive the requested information.
The value that the DeviceProperty parameter specified was invalid.
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.|
|Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)|