GetCommPorts function (winbase.h)
Gets an array that contains the well-formed COM ports.
This function obtains the COM port numbers from the HKLM\Hardware\DeviceMap\SERIALCOMM registry key and then writes them to a caller-supplied array. If the array is too small, the function gets the necessary size.
Note If new entries are added to the registry key, the necessary size can change between API calls.
Syntax
ULONG GetCommPorts(
[out] PULONG lpPortNumbers,
[in] ULONG uPortNumbersCount,
[out] PULONG puPortNumbersFound
);
Parameters
[out] lpPortNumbers
An array for the port numbers.
[in] uPortNumbersCount
The length of the array in the lpPortNumbers parameter.
[out] puPortNumbersFound
The number of port numbers written to the lpPortNumbers or the length of the array required for the port numbers.
Return value
Return code | Description |
---|---|
|
The call succeeded. The lpPortNumbers array was large enough for the result. |
|
The lpPortNumbers array was too small to contain all available port numbers. |
|
There are no comm ports available. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10, version 1803 [desktop apps | UWP apps] |
Minimum supported server | Windows Server, version 1709 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winbase.h (include Windows.h) |
Library | OneCore.lib |
DLL | KernelBase.dll |