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
919a94aa
Commit
919a94aa
authored
Jul 16, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineconsole: Use NtCreateFile to create renderer object.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c4789b08
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
9 deletions
+30
-9
condrv.h
include/wine/condrv.h
+7
-0
wineconsole.c
programs/wineconsole/wineconsole.c
+19
-1
console.c
server/console.c
+4
-8
No files found.
include/wine/condrv.h
View file @
919a94aa
...
...
@@ -46,6 +46,13 @@
/* console handle type */
typedef
unsigned
int
condrv_handle_t
;
/* convert an object handle to a server handle */
static
inline
condrv_handle_t
condrv_handle
(
HANDLE
handle
)
{
if
((
int
)(
INT_PTR
)
handle
!=
(
INT_PTR
)
handle
)
return
0xfffffff0
;
/* some invalid handle */
return
(
INT_PTR
)
handle
;
}
/* structure for console char/attribute info */
typedef
struct
{
...
...
programs/wineconsole/wineconsole.c
View file @
919a94aa
...
...
@@ -637,10 +637,18 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
enum
init_return
(
*
backend
)(
struct
inner_data
*
),
INT
nCmdShow
)
{
OBJECT_ATTRIBUTES
attr
=
{
sizeof
(
attr
)};
struct
inner_data
*
data
=
NULL
;
DWORD
ret
;
struct
config_data
cfg
;
STARTUPINFOW
si
;
UNICODE_STRING
string
;
IO_STATUS_BLOCK
io
;
condrv_handle_t
h
;
NTSTATUS
status
;
static
const
WCHAR
renderer_pathW
[]
=
{
'\\'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'D'
,
'r'
,
'v'
,
'\\'
,
'R'
,
'e'
,
'n'
,
'd'
,
'e'
,
'r'
,
'e'
,
'r'
,
0
};
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
));
if
(
!
data
)
return
0
;
...
...
@@ -682,12 +690,22 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
ret
=
!
wine_server_call_err
(
req
);
data
->
hConIn
=
wine_server_ptr_handle
(
reply
->
handle_in
);
data
->
hSynchro
=
wine_server_ptr_handle
(
reply
->
event
);
}
SERVER_END_REQ
;
if
(
!
ret
)
goto
error
;
WINE_TRACE
(
"using hConIn %p, hSynchro event %p
\n
"
,
data
->
hConIn
,
data
->
hSynchro
);
RtlInitUnicodeString
(
&
string
,
renderer_pathW
);
attr
.
ObjectName
=
&
string
;
status
=
NtCreateFile
(
&
data
->
hSynchro
,
FILE_READ_DATA
|
FILE_WRITE_DATA
|
FILE_WRITE_PROPERTIES
|
FILE_READ_PROPERTIES
|
SYNCHRONIZE
,
&
attr
,
&
io
,
NULL
,
FILE_ATTRIBUTE_NORMAL
,
0
,
FILE_OPEN
,
FILE_NON_DIRECTORY_FILE
,
NULL
,
0
);
if
(
status
)
goto
error
;
h
=
condrv_handle
(
data
->
hConIn
);
if
(
!
DeviceIoControl
(
data
->
hSynchro
,
IOCTL_CONDRV_ATTACH_RENDERER
,
&
h
,
sizeof
(
h
),
NULL
,
0
,
NULL
,
NULL
))
goto
error
;
SERVER_START_REQ
(
create_console_output
)
{
req
->
handle_in
=
wine_server_obj_handle
(
data
->
hConIn
);
...
...
server/console.c
View file @
919a94aa
...
...
@@ -1847,7 +1847,6 @@ DECL_HANDLER(alloc_console)
obj_handle_t
in
=
0
;
obj_handle_t
evt
=
0
;
struct
process
*
process
;
struct
thread
*
renderer
;
struct
console_input
*
console
;
int
fd
;
int
attach
=
0
;
...
...
@@ -1865,8 +1864,7 @@ DECL_HANDLER(alloc_console)
switch
(
req
->
pid
)
{
case
0
:
/* renderer is current, console to be attached to parent process */
renderer
=
current
;
/* console to be attached to parent process */
if
(
!
(
process
=
get_process_from_id
(
current
->
process
->
parent_id
)))
{
if
(
fd
!=
-
1
)
close
(
fd
);
...
...
@@ -1876,15 +1874,13 @@ DECL_HANDLER(alloc_console)
attach
=
1
;
break
;
case
0xffffffff
:
/* no renderer, console to be attached to current process */
renderer
=
NULL
;
/* console to be attached to current process */
process
=
current
->
process
;
grab_object
(
process
);
attach
=
1
;
break
;
default
:
/* renderer is current, console to be attached to req->pid */
renderer
=
current
;
/* console to be attached to req->pid */
if
(
!
(
process
=
get_process_from_id
(
req
->
pid
)))
{
if
(
fd
!=
-
1
)
close
(
fd
);
...
...
@@ -1899,7 +1895,7 @@ DECL_HANDLER(alloc_console)
goto
the_end
;
}
if
((
console
=
(
struct
console_input
*
)
create_console_input
(
renderer
,
fd
)))
if
((
console
=
(
struct
console_input
*
)
create_console_input
(
NULL
,
fd
)))
{
if
((
in
=
alloc_handle
(
current
->
process
,
console
,
req
->
access
,
req
->
attributes
)))
{
...
...
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