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
4225ec99
Commit
4225ec99
authored
Aug 25, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conhost: Implement IOCTL_CONDRV_WRITE_INPUT.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3be18bb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
2 deletions
+52
-2
conhost.c
programs/conhost/conhost.c
+52
-2
No files found.
programs/conhost/conhost.c
View file @
4225ec99
...
...
@@ -45,7 +45,9 @@ struct console
{
HANDLE
server
;
/* console server handle */
unsigned
int
mode
;
/* input mode */
unsigned
int
recnum
;
/* number of input records */
INPUT_RECORD
*
records
;
/* input records */
unsigned
int
record_count
;
/* number of input records */
unsigned
int
record_size
;
/* size of input records buffer */
WCHAR
*
title
;
/* console title */
size_t
title_len
;
/* length of console title */
struct
history_line
**
history
;
/* lines history */
...
...
@@ -73,6 +75,49 @@ static void *alloc_ioctl_buffer( size_t size )
return
ioctl_buffer
;
}
/* add input events to a console input queue */
static
NTSTATUS
write_console_input
(
struct
console
*
console
,
const
INPUT_RECORD
*
records
,
unsigned
int
count
)
{
TRACE
(
"%u
\n
"
,
count
);
if
(
!
count
)
return
STATUS_SUCCESS
;
if
(
console
->
record_count
+
count
>
console
->
record_size
)
{
INPUT_RECORD
*
new_rec
;
if
(
!
(
new_rec
=
realloc
(
console
->
records
,
(
console
->
record_size
*
2
+
count
)
*
sizeof
(
INPUT_RECORD
)
)))
return
STATUS_NO_MEMORY
;
console
->
records
=
new_rec
;
console
->
record_size
=
console
->
record_size
*
2
+
count
;
}
memcpy
(
console
->
records
+
console
->
record_count
,
records
,
count
*
sizeof
(
INPUT_RECORD
)
);
if
(
console
->
mode
&
ENABLE_PROCESSED_INPUT
)
{
unsigned
int
i
=
0
;
while
(
i
<
count
)
{
if
(
records
[
i
].
EventType
==
KEY_EVENT
&&
records
[
i
].
Event
.
KeyEvent
.
uChar
.
UnicodeChar
==
'C'
-
64
&&
!
(
records
[
i
].
Event
.
KeyEvent
.
dwControlKeyState
&
ENHANCED_KEY
))
{
if
(
i
!=
count
-
1
)
memcpy
(
&
console
->
records
[
console
->
record_count
+
i
],
&
console
->
records
[
console
->
record_count
+
i
+
1
],
(
count
-
i
-
1
)
*
sizeof
(
INPUT_RECORD
)
);
count
--
;
if
(
records
[
i
].
Event
.
KeyEvent
.
bKeyDown
)
{
FIXME
(
"CTRL C
\n
"
);
}
}
else
i
++
;
}
}
console
->
record_count
+=
count
;
return
STATUS_SUCCESS
;
}
static
NTSTATUS
set_console_title
(
struct
console
*
console
,
const
WCHAR
*
in_title
,
size_t
size
)
{
WCHAR
*
title
=
NULL
;
...
...
@@ -111,6 +156,10 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
TRACE
(
"set %x mode
\n
"
,
console
->
mode
);
return
STATUS_SUCCESS
;
case
IOCTL_CONDRV_WRITE_INPUT
:
if
(
in_size
%
sizeof
(
INPUT_RECORD
)
||
*
out_size
)
return
STATUS_INVALID_PARAMETER
;
return
write_console_input
(
console
,
in_data
,
in_size
/
sizeof
(
INPUT_RECORD
)
);
case
IOCTL_CONDRV_GET_INPUT_INFO
:
{
struct
condrv_input_info
*
info
;
...
...
@@ -124,7 +173,7 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
info
->
input_cp
=
console
->
input_cp
;
info
->
output_cp
=
console
->
output_cp
;
info
->
win
=
console
->
win
;
info
->
input_count
=
console
->
rec
num
;
info
->
input_count
=
console
->
rec
ord_count
;
return
STATUS_SUCCESS
;
}
...
...
@@ -221,6 +270,7 @@ static NTSTATUS process_console_ioctls( struct console *console )
{
req
->
handle
=
wine_server_obj_handle
(
console
->
server
);
req
->
status
=
status
;
req
->
signal
=
console
->
record_count
!=
0
;
wine_server_add_data
(
req
,
ioctl_buffer
,
out_size
);
wine_server_set_reply
(
req
,
ioctl_buffer
,
ioctl_buffer_size
);
status
=
wine_server_call
(
req
);
...
...
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