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
1f478ea3
Commit
1f478ea3
authored
Dec 01, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Don't inherit std console handles for non CUI child process.
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
a7c5e241
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
21 deletions
+29
-21
console.c
dlls/kernel32/tests/console.c
+10
-15
process.c
dlls/kernel32/tests/process.c
+3
-3
env.c
dlls/ntdll/unix/env.c
+16
-3
No files found.
dlls/kernel32/tests/console.c
View file @
1f478ea3
...
...
@@ -4986,7 +4986,6 @@ static void test_CreateProcessCUI(void)
DWORD
cp_flags
;
enum
inheritance_model
inherit
;
DWORD
expected
;
BOOL
is_todo
;
DWORD
is_broken
;
}
no_console_tests
[]
=
...
...
@@ -5021,12 +5020,12 @@ static void test_CreateProcessCUI(void)
/*10*/
{
FALSE
,
DETACHED_PROCESS
|
CREATE_NO_WINDOW
,
CONSOLE_STD
,
0
},
{
FALSE
,
CREATE_NEW_CONSOLE
|
CREATE_NO_WINDOW
,
CONSOLE_STD
,
0
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
0
,
TRUE
},
{
FALSE
,
DETACHED_PROCESS
,
STARTUPINFO_STD
,
0
,
TRUE
},
{
FALSE
,
CREATE_NEW_CONSOLE
,
STARTUPINFO_STD
,
0
,
TRUE
},
/*15*/
{
FALSE
,
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
,
TRUE
},
{
FALSE
,
DETACHED_PROCESS
|
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
,
TRUE
},
{
FALSE
,
CREATE_NEW_CONSOLE
|
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
,
TRUE
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
0
},
{
FALSE
,
DETACHED_PROCESS
,
STARTUPINFO_STD
,
0
},
{
FALSE
,
CREATE_NEW_CONSOLE
,
STARTUPINFO_STD
,
0
},
/*15*/
{
FALSE
,
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
},
{
FALSE
,
DETACHED_PROCESS
|
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
},
{
FALSE
,
CREATE_NEW_CONSOLE
|
CREATE_NO_WINDOW
,
STARTUPINFO_STD
,
0
},
{
TRUE
,
0
,
NULL_STD
,
CP_WITH_CONSOLE
|
CP_WITH_HANDLE
|
CP_WITH_WINDOW
},
{
TRUE
,
DETACHED_PROCESS
,
NULL_STD
,
0
},
...
...
@@ -5058,7 +5057,6 @@ static void test_CreateProcessCUI(void)
BOOL
noctrl_flag
;
/* output */
DWORD
expected
;
BOOL
is_todo
;
}
group_flags_tests
[]
=
{
...
...
@@ -5074,10 +5072,10 @@ static void test_CreateProcessCUI(void)
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
CONSOLE_STD
,
TRUE
,
CP_GROUP_LEADER
},
/* 10 */
{
FALSE
,
0
,
CONSOLE_STD
,
FALSE
,
CP_ENABLED_CTRLC
},
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
CONSOLE_STD
,
FALSE
,
CP_GROUP_LEADER
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
TRUE
,
0
,
.
is_todo
=
TRUE
},
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
STARTUPINFO_STD
,
TRUE
,
CP_GROUP_LEADER
,
.
is_todo
=
TRUE
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
FALSE
,
CP_ENABLED_CTRLC
,
.
is_todo
=
TRUE
},
/* 15 */
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
STARTUPINFO_STD
,
FALSE
,
CP_GROUP_LEADER
,
.
is_todo
=
TRUE
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
TRUE
,
0
},
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
STARTUPINFO_STD
,
TRUE
,
CP_GROUP_LEADER
},
{
FALSE
,
0
,
STARTUPINFO_STD
,
FALSE
,
CP_ENABLED_CTRLC
},
/* 15 */
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
,
STARTUPINFO_STD
,
FALSE
,
CP_GROUP_LEADER
},
{
TRUE
,
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
,
CONSOLE_STD
,
TRUE
,
CP_INH_CONSOLE
|
CP_WITH_WINDOW
|
CP_GROUP_LEADER
|
CP_ALONE
},
{
FALSE
,
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
,
CONSOLE_STD
,
TRUE
,
CP_GROUP_LEADER
},
{
TRUE
,
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
,
CONSOLE_STD
,
FALSE
,
CP_INH_CONSOLE
|
CP_WITH_WINDOW
|
CP_GROUP_LEADER
|
CP_ALONE
|
CP_ENABLED_CTRLC
},
...
...
@@ -5107,7 +5105,6 @@ static void test_CreateProcessCUI(void)
res
=
check_child_console_bits
(
no_console_tests
[
i
].
use_cui
?
cuiexec
:
guiexec
,
no_console_tests
[
i
].
cp_flags
,
no_console_tests
[
i
].
inherit
);
todo_wine_if
(
no_console_tests
[
i
].
is_todo
)
ok
(
res
==
no_console_tests
[
i
].
expected
,
"[%d] Unexpected result %x (%lx)
\n
"
,
i
,
res
,
no_console_tests
[
i
].
expected
);
}
...
...
@@ -5119,7 +5116,6 @@ static void test_CreateProcessCUI(void)
res
=
check_child_console_bits
(
with_console_tests
[
i
].
use_cui
?
cuiexec
:
guiexec
,
with_console_tests
[
i
].
cp_flags
,
with_console_tests
[
i
].
inherit
);
todo_wine_if
(
with_console_tests
[
i
].
is_todo
)
ok
(
res
==
with_console_tests
[
i
].
expected
||
broken
(
with_console_tests
[
i
].
is_broken
&&
res
==
(
with_console_tests
[
i
].
is_broken
&
0xff
)),
"[%d] Unexpected result %x (%lx)
\n
"
,
...
...
@@ -5135,7 +5131,6 @@ static void test_CreateProcessCUI(void)
res
=
check_child_console_bits
(
group_flags_tests
[
i
].
use_cui
?
cuiexec
:
guiexec
,
group_flags_tests
[
i
].
cp_flags
,
group_flags_tests
[
i
].
inherit
);
todo_wine_if
(
group_flags_tests
[
i
].
is_todo
)
ok
(
res
==
group_flags_tests
[
i
].
expected
||
/* Win7 doesn't report group id */
broken
(
res
==
(
group_flags_tests
[
i
].
expected
&
~
CP_GROUP_LEADER
)),
...
...
dlls/kernel32/tests/process.c
View file @
1f478ea3
...
...
@@ -3269,8 +3269,8 @@ static void test_StdHandleInheritance(void)
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_PIPE
,
HATTR_TYPE
|
HATTR_INHERIT
|
FILE_TYPE_PIPE
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CHAR
,
HATTR_TYPE
|
HATTR_INHERIT
|
FILE_TYPE_CHAR
},
/* 5*/
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CHAR
,
HATTR_TYPE
|
HATTR_INHERIT
|
FILE_TYPE_CHAR
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_
todo
=
7
,
.
is_
broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_
todo
=
1
,
.
is_
broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
/* all others handles type behave as H_DISK */
{
ARG_STARTUPINFO
|
ARG_HANDLE_INHERIT
|
H_DISK
,
HATTR_NULL
,
.
is_broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
...
...
@@ -3287,7 +3287,7 @@ static void test_StdHandleInheritance(void)
detached_gui
[]
=
{
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_
todo
=
7
,
.
is_
broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_CONSOLE
,
HATTR_NULL
,
.
is_broken
=
HATTR_TYPE
|
FILE_TYPE_UNKNOWN
},
/* all others handles type behave as H_DISK */
{
ARG_STD
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_DISK
,
HATTR_NULL
},
{
ARG_STARTUPINFO
|
ARG_CP_INHERIT
|
ARG_HANDLE_INHERIT
|
H_DISK
,
HATTR_TYPE
|
HATTR_INHERIT
|
FILE_TYPE_DISK
},
...
...
dlls/ntdll/unix/env.c
View file @
1f478ea3
...
...
@@ -2139,6 +2139,16 @@ void init_startup_info(void)
}
/* helper for create_startup_info */
static
BOOL
is_console_handle
(
HANDLE
handle
)
{
IO_STATUS_BLOCK
io
;
DWORD
mode
;
return
NtDeviceIoControlFile
(
handle
,
NULL
,
NULL
,
NULL
,
&
io
,
IOCTL_CONDRV_GET_MODE
,
NULL
,
0
,
&
mode
,
sizeof
(
mode
)
)
==
STATUS_SUCCESS
;
}
/***********************************************************************
* create_startup_info
*/
...
...
@@ -2175,9 +2185,12 @@ void *create_startup_info( const UNICODE_STRING *nt_image, ULONG process_flags,
if
((
process_flags
&
PROCESS_CREATE_FLAGS_INHERIT_HANDLES
)
||
(
pe_info
->
subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
&&
!
(
params
->
dwFlags
&
STARTF_USESTDHANDLES
)))
{
info
->
hstdin
=
wine_server_obj_handle
(
params
->
hStdInput
);
info
->
hstdout
=
wine_server_obj_handle
(
params
->
hStdOutput
);
info
->
hstderr
=
wine_server_obj_handle
(
params
->
hStdError
);
if
(
pe_info
->
subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
||
!
is_console_handle
(
params
->
hStdInput
))
info
->
hstdin
=
wine_server_obj_handle
(
params
->
hStdInput
);
if
(
pe_info
->
subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
||
!
is_console_handle
(
params
->
hStdOutput
))
info
->
hstdout
=
wine_server_obj_handle
(
params
->
hStdOutput
);
if
(
pe_info
->
subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
||
!
is_console_handle
(
params
->
hStdError
))
info
->
hstderr
=
wine_server_obj_handle
(
params
->
hStdError
);
}
info
->
x
=
params
->
dwX
;
info
->
y
=
params
->
dwY
;
...
...
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