PcGetDeviceProperty function (portcls.h)

The PcGetDeviceProperty function returns the requested device property from the registry.

Syntax

PORTCLASSAPI NTSTATUS PcGetDeviceProperty(
  [in]  PVOID                    DeviceObject,
  [in]  DEVICE_REGISTRY_PROPERTY DeviceProperty,
  [in]  ULONG                    BufferLength,
  [out] PVOID                    PropertyBuffer,
  [out] PULONG                   ResultLength
);

Parameters

[in] DeviceObject

Pointer to the device object for the device. This parameter points to a DEVICE_OBJECT system structure but is cast to type PVOID.

[in] DeviceProperty

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

[in] BufferLength

Specifies the length in bytes of the buffer that is to receive the requested property data.

[out] PropertyBuffer

Pointer to a caller-allocated buffer into which the method is to write the requested property data. The buffer must be large enough to contain the number of bytes specified in BufferLength.

[out] ResultLength

Pointer to a caller-allocated variable into which the method outputs a count specifying the number of bytes actually written to the buffer. If the buffer size specified in BufferLength is too small to hold the property data, the method instead outputs the number of bytes required for the property data and returns STATUS_BUFFER_TOO_SMALL.

Return value

PcGetDeviceProperty returns STATUS_SUCCESS if the call was successful. Otherwise, it returns an appropriate error code. The routine returns STATUS_BUFFER_TOO_SMALL if the buffer size specified in BufferLength was not large enough to contain the requested property data.

Remarks

Two calls to PcGetDeviceProperty might be necessary to determine the required BufferLength. In the first call, BufferLength can either be zero or a best-guess estimate of the required buffer size. If the return status is STATUS_BUFFER_TOO_SMALL, this means that the caller should allocate a buffer of the size that was output through ResultLength and call PcGetDeviceProperty again.

Requirements

Requirement Value
Minimum supported client The PortCls system driver implements the PcGetDeviceProperty function in Microsoft Windows 98/Me and in Windows 2000 and later operating systems.
Target Platform Universal
Header portcls.h (include Portcls.h)
Library Portcls.lib
IRQL PASSIVE_LEVEL

See also

DEVICE_OBJECT

IoGetDeviceProperty