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
859b526c
Commit
859b526c
authored
Oct 12, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use conhost in AllocConsole.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
12cc863a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
console.c
dlls/kernelbase/console.c
+16
-16
No files found.
dlls/kernelbase/console.c
View file @
859b526c
...
@@ -326,9 +326,10 @@ BOOL WINAPI AllocConsole(void)
...
@@ -326,9 +326,10 @@ BOOL WINAPI AllocConsole(void)
{
{
SECURITY_ATTRIBUTES
inheritable_attr
=
{
sizeof
(
inheritable_attr
),
NULL
,
TRUE
};
SECURITY_ATTRIBUTES
inheritable_attr
=
{
sizeof
(
inheritable_attr
),
NULL
,
TRUE
};
STARTUPINFOW
app_si
,
console_si
;
STARTUPINFOW
app_si
,
console_si
;
WCHAR
buffer
[
1024
],
cmd
[
256
];
HANDLE
server
,
console
=
NULL
;
WCHAR
buffer
[
1024
],
cmd
[
256
],
conhost_path
[
MAX_PATH
];
PROCESS_INFORMATION
pi
;
PROCESS_INFORMATION
pi
;
HANDLE
event
,
console
;
void
*
redir
;
BOOL
ret
;
BOOL
ret
;
TRACE
(
"()
\n
"
);
TRACE
(
"()
\n
"
);
...
@@ -343,6 +344,8 @@ BOOL WINAPI AllocConsole(void)
...
@@ -343,6 +344,8 @@ BOOL WINAPI AllocConsole(void)
return
FALSE
;
return
FALSE
;
}
}
if
(
!
(
server
=
create_console_server
())
||
!
(
console
=
create_console_reference
(
server
)))
goto
error
;
GetStartupInfoW
(
&
app_si
);
GetStartupInfoW
(
&
app_si
);
memset
(
&
console_si
,
0
,
sizeof
(
console_si
));
memset
(
&
console_si
,
0
,
sizeof
(
console_si
));
...
@@ -372,30 +375,27 @@ BOOL WINAPI AllocConsole(void)
...
@@ -372,30 +375,27 @@ BOOL WINAPI AllocConsole(void)
console_si
.
lpTitle
=
buffer
;
console_si
.
lpTitle
=
buffer
;
}
}
if
(
!
(
event
=
CreateEventW
(
&
inheritable_attr
,
TRUE
,
FALSE
,
NULL
)))
goto
error
;
swprintf
(
conhost_path
,
ARRAY_SIZE
(
conhost_path
),
L"%s
\\
conhost.exe"
,
system_dir
);
swprintf
(
cmd
,
ARRAY_SIZE
(
cmd
),
L"
\"
%s
\"
--server 0x%x"
,
conhost_path
,
condrv_handle
(
server
));
Wow64DisableWow64FsRedirection
(
&
redir
);
ret
=
CreateProcessW
(
conhost_path
,
cmd
,
NULL
,
NULL
,
TRUE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
console_si
,
&
pi
);
Wow64RevertWow64FsRedirection
(
redir
);
if
(
!
ret
||
!
create_console_connection
(
console
))
goto
error
;
if
(
!
init_console_std_handles
(
!
(
app_si
.
dwFlags
&
STARTF_USESTDHANDLES
)
))
goto
error
;
swprintf
(
cmd
,
ARRAY_SIZE
(
cmd
),
L"wineconsole --use-event=%ld"
,
(
DWORD_PTR
)
event
);
if
((
ret
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
TRUE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
console_si
,
&
pi
)))
{
HANDLE
wait_handles
[
2
]
=
{
event
,
pi
.
hProcess
};
ret
=
WaitForMultipleObjects
(
ARRAY_SIZE
(
wait_handles
),
wait_handles
,
FALSE
,
INFINITE
)
==
WAIT_OBJECT_0
;
CloseHandle
(
pi
.
hThread
);
CloseHandle
(
pi
.
hProcess
);
}
CloseHandle
(
event
);
if
(
!
ret
||
!
init_console_std_handles
(
!
(
app_si
.
dwFlags
&
STARTF_USESTDHANDLES
)
))
goto
error
;
console
=
CreateFileW
(
L"CONIN$"
,
GENERIC_READ
|
GENERIC_WRITE
|
SYNCHRONIZE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
console
==
INVALID_HANDLE_VALUE
)
goto
error
;
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
=
console
;
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
=
console
;
TRACE
(
"Started wineconsole pid=%08x tid=%08x
\n
"
,
pi
.
dwProcessId
,
pi
.
dwThreadId
);
TRACE
(
"Started wineconsole pid=%08x tid=%08x
\n
"
,
pi
.
dwProcessId
,
pi
.
dwThreadId
);
CloseHandle
(
server
);
RtlLeaveCriticalSection
(
&
console_section
);
RtlLeaveCriticalSection
(
&
console_section
);
SetLastError
(
ERROR_SUCCESS
);
SetLastError
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
error:
error:
ERR
(
"Can't allocate console
\n
"
);
ERR
(
"Can't allocate console
\n
"
);
NtClose
(
console
);
NtClose
(
server
);
FreeConsole
();
FreeConsole
();
RtlLeaveCriticalSection
(
&
console_section
);
RtlLeaveCriticalSection
(
&
console_section
);
return
FALSE
;
return
FALSE
;
...
...
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