Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b83c5ead
Commit
b83c5ead
authored
Feb 06, 2006
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 06, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implemented IOCTL purge for serial objects.
parent
bd8db45e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
26 deletions
+28
-26
comm.c
dlls/kernel/comm.c
+8
-26
serial.c
dlls/ntdll/serial.c
+20
-0
No files found.
dlls/kernel/comm.c
View file @
b83c5ead
...
...
@@ -848,37 +848,19 @@ BOOL WINAPI EscapeCommFunction(
* Terminates pending operations and/or discards buffers on a
* communication resource.
*
* PARAMS
*
* handle [in] The communication resource to be purged
* flags [in] Flags for clear pending/buffer on input/output
*
* RETURNS
*
* True on success and false if the communications handle is bad.
*/
BOOL
WINAPI
PurgeComm
(
HANDLE
handle
,
/* [in] The communication resource to be purged. */
DWORD
flags
)
/* [in] Flags for clear pending/buffer on input/output. */
BOOL
WINAPI
PurgeComm
(
HANDLE
handle
,
DWORD
flags
)
{
int
fd
;
TRACE
(
"handle %p, flags %lx
\n
"
,
handle
,
flags
);
fd
=
get_comm_fd
(
handle
,
FILE_READ_DATA
);
if
(
fd
<
0
)
return
FALSE
;
/*
** not exactly sure how these are different
** Perhaps if we had our own internal queues, one flushes them
** and the other flushes the kernel's buffers.
*/
if
(
flags
&
PURGE_TXABORT
)
tcflush
(
fd
,
TCOFLUSH
);
if
(
flags
&
PURGE_RXABORT
)
tcflush
(
fd
,
TCIFLUSH
);
if
(
flags
&
PURGE_TXCLEAR
)
tcflush
(
fd
,
TCOFLUSH
);
if
(
flags
&
PURGE_RXCLEAR
)
tcflush
(
fd
,
TCIFLUSH
);
release_comm_fd
(
handle
,
fd
);
return
1
;
return
DeviceIoControl
(
handle
,
IOCTL_SERIAL_PURGE
,
&
flags
,
sizeof
(
flags
),
NULL
,
0
,
NULL
,
NULL
);
}
/*****************************************************************************
...
...
dlls/ntdll/serial.c
View file @
b83c5ead
...
...
@@ -129,6 +129,20 @@ static const char* iocode2str(DWORD ioc)
}
}
static
NTSTATUS
purge
(
int
fd
,
DWORD
flags
)
{
/*
** not exactly sure how these are different
** Perhaps if we had our own internal queues, one flushes them
** and the other flushes the kernel's buffers.
*/
if
(
flags
&
PURGE_TXABORT
)
tcflush
(
fd
,
TCOFLUSH
);
if
(
flags
&
PURGE_RXABORT
)
tcflush
(
fd
,
TCIFLUSH
);
if
(
flags
&
PURGE_TXCLEAR
)
tcflush
(
fd
,
TCOFLUSH
);
if
(
flags
&
PURGE_RXCLEAR
)
tcflush
(
fd
,
TCIFLUSH
);
return
STATUS_SUCCESS
;
}
/******************************************************************
* COMM_DeviceIoControl
*
...
...
@@ -156,6 +170,12 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDevice,
switch
(
dwIoControlCode
)
{
case
IOCTL_SERIAL_PURGE
:
if
(
lpInBuffer
&&
nInBufferSize
==
sizeof
(
DWORD
))
status
=
purge
(
fd
,
*
(
DWORD
*
)
lpInBuffer
);
else
status
=
STATUS_INVALID_PARAMETER
;
break
;
case
IOCTL_SERIAL_SET_BREAK_OFF
:
#if defined(TIOCSBRK) && defined(TIOCCBRK)
/* check if available for compilation */
if
(
ioctl
(
fd
,
TIOCCBRK
,
0
)
==
-
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment