kernelbase: Close PEB ConsoleHandle in AttachConsole.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
57a222356c
commit
06c3e7e44c
|
@ -3737,7 +3737,6 @@ static void test_AttachConsole_child(DWORD console_pid)
|
||||||
ok(res, "AttachConsole failed: %u\n", GetLastError());
|
ok(res, "AttachConsole failed: %u\n", GetLastError());
|
||||||
|
|
||||||
ok(pipe_out != GetStdHandle(STD_ERROR_HANDLE), "std handle not set to console\n");
|
ok(pipe_out != GetStdHandle(STD_ERROR_HANDLE), "std handle not set to console\n");
|
||||||
todo_wine
|
|
||||||
ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n");
|
ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n");
|
||||||
|
|
||||||
console = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
|
console = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
|
||||||
|
|
|
@ -250,7 +250,16 @@ BOOL WINAPI DECLSPEC_HOTPATCH AttachConsole( DWORD pid )
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
SERVER_END_REQ;
|
||||||
|
|
||||||
if (ret && !(ret = init_console_std_handles())) FreeConsole();
|
if (ret)
|
||||||
|
{
|
||||||
|
if ((ret = init_console_std_handles()))
|
||||||
|
{
|
||||||
|
HANDLE console = CreateFileW( L"CONIN$", GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, 0, NULL, OPEN_EXISTING, 0, 0 );
|
||||||
|
if (console != INVALID_HANDLE_VALUE) RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle = console;
|
||||||
|
else ret = FALSE;
|
||||||
|
}
|
||||||
|
if (!ret) FreeConsole();
|
||||||
|
}
|
||||||
|
|
||||||
RtlLeaveCriticalSection( &console_section );
|
RtlLeaveCriticalSection( &console_section );
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue