WdfDeviceAllocAndQueryPropertyEx function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceAllocAndQueryPropertyEx method allocates a buffer and retrieves a specified device property.


NTSTATUS WdfDeviceAllocAndQueryPropertyEx(
  [in]           WDFDEVICE                 Device,
  [in]           PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
  [in]           POOL_TYPE                 PoolType,
  [in, optional] PWDF_OBJECT_ATTRIBUTES    PropertyMemoryAttributes,
  [out]          WDFMEMORY                 *PropertyMemory,
  [out]          PDEVPROPTYPE              Type


[in] Device

A handle to a framework device object.

[in] DeviceProperty

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

[in] PoolType

A POOL_TYPE-typed enumerator that specifies the type of memory to be allocated.

[in, optional] PropertyMemoryAttributes

A pointer to a caller-allocated WDF_OBJECT_ATTRIBUTES structure that describes object attributes for the memory object that the function will allocate. This parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.

[out] PropertyMemory

A pointer to a WDFMEMORY-typed location that receives a handle to a framework memory object.

[out] Type

A pointer to a DEVPROPTYPE variable. If the method is successful, upon return this parameter contains the property type value of the property data stored in PropertyMemory.

Return value

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

Return code Description
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.


You can use WdfDeviceAllocAndQueryPropertyEx to retrieve any property that is exposed through the unified property model, whereas the WdfDeviceAllocAndQueryProperty method only allows querying a subset of the unified property model.

The WdfDeviceAllocAndQueryPropertyEx method determines the amount of memory that is necessary to hold the requested device interface property. It allocates enough memory to hold the data, and returns a handle to a framework memory object that describes the allocated memory. To access the data, your driver can call WdfMemoryGetBuffer.

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


Target Platform Universal
Minimum KMDF version 1.13
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)

See also