private void SetCommStateNative(ref SerialPortFixer.Dcb lpDcb) { var lpErrors = 0; var lpStat = new SerialPortFixer.Comstat(); for (var index = 0; index < 10; ++index) { if (!SerialPortFixer.ClearCommError(m_Handle, ref lpErrors, ref lpStat)) { SerialPortFixer.WinIoError(); } if (SerialPortFixer.SetCommState(m_Handle, ref lpDcb)) { break; } if (index == 9) { SerialPortFixer.WinIoError(); } } }
private static extern bool ClearCommError(SafeFileHandle hFile, ref int lpErrors, ref SerialPortFixer.Comstat lpStat);