SetCommState function kernel32

Win32Result<bool> SetCommState(
  1. HANDLE hFile,
  2. Pointer<DCB> lpDCB
)

Configures a communications device according to the specifications in a device-control block (a DCB structure).

The function reinitializes all hardware and control settings, but it does not empty output or input queues.

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

Implementation

Win32Result<bool> SetCommState(HANDLE hFile, Pointer<DCB> lpDCB) {
  resolveGetLastError();
  final result_ = _SetCommState(hFile, lpDCB);
  return .new(value: result_ != FALSE, error: GetLastError());
}