ClearCommError function kernel32

Win32Result<bool> ClearCommError(
  1. HANDLE hFile,
  2. Pointer<Uint32>? lpErrors,
  3. Pointer<COMSTAT>? lpStat
)

Retrieves information about a communications error and reports the current status of a communications device.

To learn more, see learn.microsoft.com/windows/win32/api/winbase/nf-winbase-clearcommerror.

Implementation

Win32Result<bool> ClearCommError(
  HANDLE hFile,
  Pointer<Uint32>? lpErrors,
  Pointer<COMSTAT>? lpStat,
) {
  resolveGetLastError();
  final result_ = _ClearCommError(
    hFile,
    lpErrors ?? nullptr,
    lpStat ?? nullptr,
  );
  return .new(value: result_ != FALSE, error: GetLastError());
}