internal static extern bool SetCommState(SafeFileHandle hFile, ref DCB lpDCB);
private DCB GetParams() { DCB serialParams = new DCB(); serialParams.DCBLength = (uint)Marshal.SizeOf(serialParams); if (serialHandle != null) { if (!NativeMethods.GetCommState(serialHandle, ref serialParams)) throw new IOException("GetCommState error!"); } return serialParams; }