Example #1
0
        public unsafe static void SetCommunicationsState(SafeFileHandle fileHandle, ref DeviceControlBlock dcb)
        {
            dcb.DCBlength = (uint)sizeof(DeviceControlBlock);

            Error.ThrowLastErrorIfFalse(
                Imports.GetCommState(fileHandle, ref dcb));
        }
Example #2
0
        public unsafe static void SetCommunicationsState(SafeFileHandle fileHandle, ref DeviceControlBlock dcb)
        {
            dcb.DCBlength = (uint)sizeof(DeviceControlBlock);

            if (!Imports.GetCommState(fileHandle, ref dcb))
            {
                throw Error.GetExceptionForLastError();
            }
        }
Example #3
0
        public unsafe static DeviceControlBlock GetCommunicationsState(SafeFileHandle fileHandle)
        {
            DeviceControlBlock dcb = new DeviceControlBlock()
            {
                DCBlength = (uint)sizeof(DeviceControlBlock)
            };

            Error.ThrowLastErrorIfFalse(
                Imports.GetCommState(fileHandle, ref dcb));

            return(dcb);
        }
Example #4
0
        public unsafe static DeviceControlBlock GetCommunicationsState(SafeFileHandle fileHandle)
        {
            DeviceControlBlock dcb = new DeviceControlBlock()
            {
                DCBlength = (uint)sizeof(DeviceControlBlock)
            };

            if (!Imports.GetCommState(fileHandle, ref dcb))
            {
                throw Error.GetExceptionForLastError();
            }

            return(dcb);
        }