PcGetDeviceProperty function

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

Syntax


NTSTATUS PcGetDeviceProperty(
  _In_  PVOID                    DeviceObject,
  _In_  DEVICE_REGISTRY_PROPERTY DeviceProperty,
  _In_  ULONG                    BufferLength,
  _Out_ PVOID                    PropertyBuffer,
  _Out_ PULONG                   ResultLength
);

Parameters

DeviceObject [in]

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

DeviceProperty [in]

Specifies the Plug and Play device property that is requested. For a list of property specifier values, see the following Remarks section.

BufferLength [in]

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

PropertyBuffer [out]

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.

ResultLength [out]

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

Set the DeviceProperty parameter to one of the following DEVICE_REGISTRY_PROPERTY enumeration values from header file wdm.h:

DevicePropertyAddress

DevicePropertyBootConfiguration

DevicePropertyBootConfigurationTranslated

DevicePropertyBusNumber

DevicePropertyBusTypeGuid

DevicePropertyClassGuid

DevicePropertyClassName

DevicePropertyCompatibleIDs

DevicePropertyDetachability

DevicePropertyDeviceDescription

DevicePropertyDriverKeyName

DevicePropertyEnumeratorName

DevicePropertyFriendlyName

DevicePropertyHardwareID

DevicePropertyInstallState

DevicePropertyLegacyBusType

DevicePropertyLocationInformation

DevicePropertyManufacturer

DevicePropertyPhysicalDeviceObjectName

DevicePropertyUINumber

For a description of the preceding DevicePropertyXxx values, see IoGetDeviceProperty.

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

Target platform

Universal

Version

The PortCls system driver implements the PcGetDeviceProperty function in Microsoft Windows 98/Me and in Windows 2000 and later operating systems.

Header

Portcls.h (include Portcls.h)

Library

Portcls.lib

IRQL

PASSIVE_LEVEL

See also

DEVICE_OBJECT
IoGetDeviceProperty

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft