Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
4149643f
Commit
4149643f
authored
Dec 12, 2010
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: When reading chars out of a bare console, use the Unix API (instead of the Windows one).
parent
10aa13a9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
22 deletions
+28
-22
console.c
dlls/kernel32/console.c
+28
-22
No files found.
dlls/kernel32/console.c
View file @
4149643f
...
...
@@ -41,6 +41,9 @@
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
...
...
@@ -1112,33 +1115,35 @@ static BOOL handle_simple_char(HANDLE conin, unsigned real_inchar)
return
WriteConsoleInputW
(
conin
,
ir
,
numEvent
,
&
written
);
}
static
enum
read_console_input_return
bare_console_fetch_input
(
HANDLE
handle
,
DWORD
timeout
)
static
enum
read_console_input_return
bare_console_fetch_input
(
HANDLE
handle
,
int
fd
,
DWORD
timeout
)
{
OVERLAPPED
ov
;
enum
read_console_input_return
ret
;
struct
pollfd
pollfd
;
char
ch
;
enum
read_console_input_return
ret
;
/* get the real handle to the console object */
handle
=
wine_server_ptr_handle
(
console_handle_unmap
(
handle
));
memset
(
&
ov
,
0
,
sizeof
(
ov
));
ov
.
hEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
pollfd
.
fd
=
fd
;
pollfd
.
events
=
POLLIN
;
pollfd
.
revents
=
0
;
if
(
ReadFile
(
handle
,
&
ch
,
1
,
NULL
,
&
ov
)
||
(
GetLastError
()
==
ERROR_IO_PENDING
&&
WaitForSingleObject
(
ov
.
hEvent
,
timeout
)
==
WAIT_OBJECT_0
&&
GetOverlappedResult
(
handle
,
&
ov
,
NULL
,
FALSE
)))
switch
(
poll
(
&
pollfd
,
1
,
timeout
))
{
ret
=
handle_simple_char
(
handle
,
ch
)
?
rci_gotone
:
rci_error
;
}
else
case
1
:
RtlEnterCriticalSection
(
&
CONSOLE_CritSect
);
switch
(
read
(
fd
,
&
ch
,
1
))
{
WARN
(
"Failed read %x
\n
"
,
GetLastError
());
ret
=
rci_error
;
case
1
:
ret
=
handle_simple_char
(
handle
,
ch
)
?
rci_gotone
:
rci_error
;
break
;
/* actually another thread likely beat us to reading the char
* return gotone, while not perfect, it should work in most of the cases (as the new event
* should be now in the queue)
*/
case
0
:
ret
=
rci_gotone
;
break
;
default:
ret
=
rci_error
;
break
;
}
CloseHandle
(
ov
.
hEvent
);
RtlLeaveCriticalSection
(
&
CONSOLE_CritSect
);
return
ret
;
case
0
:
return
rci_timeout
;
default:
return
rci_error
;
}
}
static
enum
read_console_input_return
read_console_input
(
HANDLE
handle
,
PINPUT_RECORD
ir
,
DWORD
timeout
)
...
...
@@ -1149,12 +1154,13 @@ static enum read_console_input_return read_console_input(HANDLE handle, PINPUT_R
if
((
fd
=
get_console_bare_fd
(
handle
))
!=
-
1
)
{
put_console_into_raw_mode
(
fd
);
close
(
fd
);
if
(
WaitForSingleObject
(
GetConsoleInputWaitHandle
(),
0
)
!=
WAIT_OBJECT_0
)
{
ret
=
bare_console_fetch_input
(
handle
,
timeout
);
if
(
ret
!=
rci_gotone
)
return
ret
;
ret
=
bare_console_fetch_input
(
handle
,
fd
,
timeout
);
}
else
ret
=
rci_gotone
;
close
(
fd
);
if
(
ret
!=
rci_gotone
)
return
ret
;
}
else
{
...
...
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