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
b1b4de5d
Commit
b1b4de5d
authored
Jan 25, 2017
by
Vincent Povirk
Committed by
Alexandre Julliard
Jan 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: DETACHED_PROCESS prevents automatic std handle inheritance.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a60144ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
process.c
dlls/kernel32/process.c
+6
-0
process.c
dlls/kernel32/tests/process.c
+53
-0
No files found.
dlls/kernel32/process.c
View file @
b1b4de5d
...
...
@@ -1696,6 +1696,12 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
hstdout
=
startup
->
hStdOutput
;
hstderr
=
startup
->
hStdError
;
}
else
if
(
flags
&
DETACHED_PROCESS
)
{
hstdin
=
INVALID_HANDLE_VALUE
;
hstdout
=
INVALID_HANDLE_VALUE
;
hstderr
=
INVALID_HANDLE_VALUE
;
}
else
{
hstdin
=
GetStdHandle
(
STD_INPUT_HANDLE
);
...
...
dlls/kernel32/tests/process.c
View file @
b1b4de5d
...
...
@@ -2895,6 +2895,58 @@ static void test_StartupNoConsole(void)
#endif
}
static
void
test_DetachStdHandles
(
void
)
{
#ifndef _WIN64
char
buffer
[
MAX_PATH
],
tempfile
[
MAX_PATH
];
STARTUPINFOA
startup
;
PROCESS_INFORMATION
info
;
HANDLE
hstdin
,
hstdout
,
hstderr
,
htemp
;
BOOL
res
;
hstdin
=
GetStdHandle
(
STD_INPUT_HANDLE
);
hstdout
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
hstderr
=
GetStdHandle
(
STD_ERROR_HANDLE
);
get_file_name
(
tempfile
);
htemp
=
CreateFileA
(
tempfile
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
htemp
!=
INVALID_HANDLE_VALUE
,
"failed opening temporary file
\n
"
);
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
SW_SHOWNORMAL
;
get_file_name
(
resfile
);
sprintf
(
buffer
,
"
\"
%s
\"
tests/process.c dump
\"
%s
\"
"
,
selfname
,
resfile
);
SetStdHandle
(
STD_INPUT_HANDLE
,
htemp
);
SetStdHandle
(
STD_OUTPUT_HANDLE
,
htemp
);
SetStdHandle
(
STD_ERROR_HANDLE
,
htemp
);
res
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
DETACHED_PROCESS
,
NULL
,
NULL
,
&
startup
,
&
info
);
SetStdHandle
(
STD_INPUT_HANDLE
,
hstdin
);
SetStdHandle
(
STD_OUTPUT_HANDLE
,
hstdout
);
SetStdHandle
(
STD_ERROR_HANDLE
,
hstderr
);
ok
(
res
,
"CreateProcess failed
\n
"
);
ok
(
WaitForSingleObject
(
info
.
hProcess
,
30000
)
==
WAIT_OBJECT_0
,
"Child process termination
\n
"
);
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
resfile
);
okChildInt
(
"StartupInfoA"
,
"hStdInput"
,
(
UINT
)
INVALID_HANDLE_VALUE
);
okChildInt
(
"StartupInfoA"
,
"hStdOutput"
,
(
UINT
)
INVALID_HANDLE_VALUE
);
okChildInt
(
"StartupInfoA"
,
"hStdError"
,
(
UINT
)
INVALID_HANDLE_VALUE
);
okChildInt
(
"TEB"
,
"hStdInput"
,
0
);
okChildInt
(
"TEB"
,
"hStdOutput"
,
0
);
okChildInt
(
"TEB"
,
"hStdError"
,
0
);
release_memory
();
DeleteFileA
(
resfile
);
CloseHandle
(
htemp
);
DeleteFileA
(
tempfile
);
#endif
}
static
void
test_GetNumaProcessorNode
(
void
)
{
SYSTEM_INFO
si
;
...
...
@@ -3328,6 +3380,7 @@ START_TEST(process)
test_RegistryQuota
();
test_DuplicateHandle
();
test_StartupNoConsole
();
test_DetachStdHandles
();
test_GetNumaProcessorNode
();
test_session_info
();
test_GetLogicalProcessorInformationEx
();
...
...
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