Commit 06c3e7e4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernelbase: Close PEB ConsoleHandle in AttachConsole.

parent 57a22235
......@@ -3737,7 +3737,6 @@ static void test_AttachConsole_child(DWORD console_pid)
ok(res, "AttachConsole failed: %u\n", GetLastError());
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");
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;
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 );
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment