ComDBReleasePort function (msports.h)

ComDBReleasePort releases a COM port number in the COM port database.

Syntax

LONG ComDBReleasePort(
  [in] HCOMDB HComDB,
  [in] DWORD  ComNumber
);

Parameters

[in] HComDB

Handle to the COM port database that was returned by ComDBOpen.

[in] ComNumber

Specifies the COM port number to release. A port number is an integer that ranges from one to COMDB_MAX_PORTS_ARBITRATED.

Return value

ComDBReleasePort returns one of the following status values.

Return code Description
ERROR_SUCCESS
The COM port number was released.
ERROR_CANTWRITE
The routine could not write to the database.
ERROR_INVALID_PARAMETER
One of the following is true: The specified handle to the COM port database is not valid. The specified port number is not in the COM port database.
ERROR_NOT_CONNECTED
The routine could not access the database. To get extended error information, call GetLastError.

Remarks

Releasing a COM port number means to log the port number as "not in use".

ComDBReleasePort runs in user mode.

For more information, see Obtaining and Releasing a COM Port Number.

Requirements

Requirement Value
Target Platform Desktop
Header msports.h (include Msports.h)
Library Msports.lib
DLL Msports.dll

See also

ComDBClaimNextFreePort

ComDBClaimPort