Expand Minimize

WdfFdoInitQueryPropertyEx method

[Applies to KMDF and UMDF]

The WdfFdoInitQueryPropertyEx method retrieves a specified device property.

Syntax


NTSTATUS WdfFdoInitQueryPropertyEx(
  [in]   PWDFDEVICE_INIT DeviceInit,
  [in]   PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
  [in]   ULONG BufferLength,
  [out]  PVOID PropertyBuffer,
  [out]  PULONG ResultLength,
  [out]  PDEVPROPTYPE Type
);

Parameters

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure that the driver obtained from its EvtDriverDeviceAdd callback function.

DeviceProperty [in]

A pointer to a WDF_DEVICE_PROPERTY_DATA structure that identifies the device property to be retrieved.

BufferLength [in]

The size, in bytes, of the buffer that is pointed to by PropertyBuffer.

PropertyBuffer [out]

A caller-supplied pointer to a caller-allocated buffer that receives the requested information. The pointer can be NULL if the BufferLength parameter is zero.

ResultLength [out]

A caller-supplied location that, on return, contains the size, in bytes, of the information that the method stored in PropertyBuffer. If the function's return value is STATUS_BUFFER_TOO_SMALL, this location receives the required buffer size.

Type [out]

A pointer to a DEVPROPTYPE variable that, on return, contains the property type value of the property data stored in PropertyBuffer.

Return value

If the operation succeeds, WdfFdoInitQueryPropertyEx returns STATUS_SUCCESS. Additional return values include:

Return codeDescription
STATUS_BUFFER_TOO_SMALL

The supplied buffer is too small to receive the information.

STATUS_INVALID_PARAMETER

The specified DeviceProperty value is invalid.

 

The method might return other NTSTATUS values.

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

Remarks

Before receiving device property data, drivers typically call the WdfFdoInitQueryPropertyEx method just 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 WdfFdoInitQueryPropertyEx again. Therefore, drivers should call WdfFdoInitQueryPropertyEx inside a loop that executes until the return status is not STATUS_BUFFER_TOO_SMALL.

It is best to use WdfFdoInitQueryPropertyEx only if the required buffer size is known and unchanging, because in that case the driver has to call WdfFdoInitQueryPropertyEx only once. If the required buffer size is unknown or varies, the driver should call WdfFdoInitAllocAndQueryPropertyEx.

The driver can call WdfFdoInitQueryPropertyEx only before calling WdfDeviceCreate. For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

After calling WdfDeviceCreate, a driver can obtain device property information by calling WdfDeviceQueryPropertyEx.

For information about related methods, see Accessing the Unified Device Property Model.

Requirements

Minimum KMDF version

1.13

Minimum UMDF version

2.0

Header

Wdffdo.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

PASSIVE_LEVEL

See also

WdfFdoInitQueryProperty

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.