Migrated to CsWin32 #1

Merged
nefarius merged 14 commits from nefarius/bugfix/refactoring into master 2024-07-13 15:32:14 +02:00
3 changed files with 10 additions and 11 deletions
Showing only changes of commit 086633b8a2 - Show all commits

View File

@ -20,4 +20,10 @@ WriteFile
CreateFile CreateFile
ESCAPE_COMM_FUNCTION ESCAPE_COMM_FUNCTION
EscapeCommFunction EscapeCommFunction
CLEAR_COMM_ERROR_FLAGS CLEAR_COMM_ERROR_FLAGS
CE_TXFULL
CE_PTO
CE_IOE
CE_DNS
CE_OOP
CE_MODE

View File

@ -501,7 +501,7 @@ public partial class SerialPort : IDisposable
s = s.Append("Framing,"); s = s.Append("Framing,");
} }
if (((uint)errs & Win32Com.CE_IOE) != 0) if (((uint)errs & PInvoke.CE_IOE) != 0)
{ {
s = s.Append("IO,"); s = s.Append("IO,");
} }
@ -521,7 +521,7 @@ public partial class SerialPort : IDisposable
s = s.Append("Parity,"); s = s.Append("Parity,");
} }
if (((uint)errs & Win32Com.CE_TXFULL) != 0) if (((uint)errs & PInvoke.CE_TXFULL) != 0)
{ {
s = s.Append("Transmit Overflow,"); s = s.Append("Transmit Overflow,");
} }

View File

@ -3,16 +3,9 @@ using System.Runtime.InteropServices;
namespace Nefarius.Peripherals.SerialPort.Win32PInvoke; namespace Nefarius.Peripherals.SerialPort.Win32PInvoke;
[Obsolete("use CsWin32 instead.")]
internal class Win32Com internal class Win32Com
{ {
//Constants for lpErrors:
internal const UInt32 CE_TXFULL = 0x0100;
internal const UInt32 CE_PTO = 0x0200;
internal const UInt32 CE_IOE = 0x0400;
internal const UInt32 CE_DNS = 0x0800;
internal const UInt32 CE_OOP = 0x1000;
internal const UInt32 CE_MODE = 0x8000;
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
internal static extern Boolean GetHandleInformation(IntPtr hObject, out UInt32 lpdwFlags); internal static extern Boolean GetHandleInformation(IntPtr hObject, out UInt32 lpdwFlags);