kernel32: Set PEB console handle in AllocConsole.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-08-13 16:00:37 +02:00 committed by Alexandre Julliard
parent ccaaf6957f
commit 57a222356c
2 changed files with 5 additions and 2 deletions

View File

@ -3592,7 +3592,6 @@ static void test_FreeConsole(void)
HANDLE handle;
BOOL ret;
todo_wine
ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n");
ret = FreeConsole();

View File

@ -266,7 +266,7 @@ BOOL WINAPI AllocConsole(void)
STARTUPINFOW app_si, console_si;
WCHAR buffer[1024], cmd[256];
PROCESS_INFORMATION pi;
HANDLE event, std_in;
HANDLE event, std_in, console;
DWORD mode;
BOOL ret;
@ -324,6 +324,10 @@ BOOL WINAPI AllocConsole(void)
}
CloseHandle( event );
if (!ret || !init_console_std_handles()) goto error;
console = CreateFileW( L"CONIN$", GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, 0, NULL, OPEN_EXISTING, 0, 0 );
if (console == INVALID_HANDLE_VALUE) goto error;
RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle = console;
TRACE( "Started wineconsole pid=%08x tid=%08x\n", pi.dwProcessId, pi.dwThreadId );
RtlLeaveCriticalSection( &console_section );