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

            Error.ThrowLastErrorIfFalse(
                Imports.GetCommState(fileHandle, ref dcb));
        }
コード例 #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();
            }
        }
コード例 #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);
        }
コード例 #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);
        }