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
Specifies the Plug and Play device property that is requested. For a list of property specifier values, see the following Remarks section.
[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
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
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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for