kernel32: DETACHED_PROCESS doesn't affect STARTUPINFO console handles.
Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b1b4de5d6b
commit
0ad641af9c
|
@ -1711,7 +1711,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
|
|||
info->hstdin = wine_server_obj_handle( hstdin );
|
||||
info->hstdout = wine_server_obj_handle( hstdout );
|
||||
info->hstderr = wine_server_obj_handle( hstderr );
|
||||
if ((flags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS)) != 0)
|
||||
if ((flags & CREATE_NEW_CONSOLE) != 0)
|
||||
{
|
||||
/* this is temporary (for console handles). We have no way to control that the handle is invalid in child process otherwise */
|
||||
if (is_console_handle(hstdin)) info->hstdin = wine_server_obj_handle( INVALID_HANDLE_VALUE );
|
||||
|
|
|
@ -2895,6 +2895,46 @@ static void test_StartupNoConsole(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void test_DetachConsoleHandles(void)
|
||||
{
|
||||
#ifndef _WIN64
|
||||
char buffer[MAX_PATH];
|
||||
STARTUPINFOA startup;
|
||||
PROCESS_INFORMATION info;
|
||||
UINT result;
|
||||
|
||||
memset(&startup, 0, sizeof(startup));
|
||||
startup.cb = sizeof(startup);
|
||||
startup.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES;
|
||||
startup.wShowWindow = SW_SHOWNORMAL;
|
||||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
get_file_name(resfile);
|
||||
sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
||||
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup,
|
||||
&info), "CreateProcess\n");
|
||||
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
||||
|
||||
result = GetPrivateProfileIntA("StartupInfoA", "hStdInput", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
result = GetPrivateProfileIntA("StartupInfoA", "hStdOutput", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
result = GetPrivateProfileIntA("StartupInfoA", "hStdError", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
result = GetPrivateProfileIntA("TEB", "hStdInput", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
result = GetPrivateProfileIntA("TEB", "hStdOutput", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
result = GetPrivateProfileIntA("TEB", "hStdError", 0, resfile);
|
||||
ok(result != 0 && result != (UINT)INVALID_HANDLE_VALUE, "bad handle %x\n", result);
|
||||
|
||||
release_memory();
|
||||
DeleteFileA(resfile);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_DetachStdHandles(void)
|
||||
{
|
||||
#ifndef _WIN64
|
||||
|
@ -3380,6 +3420,7 @@ START_TEST(process)
|
|||
test_RegistryQuota();
|
||||
test_DuplicateHandle();
|
||||
test_StartupNoConsole();
|
||||
test_DetachConsoleHandles();
|
||||
test_DetachStdHandles();
|
||||
test_GetNumaProcessorNode();
|
||||
test_session_info();
|
||||
|
|
Loading…
Reference in New Issue