Commit 36fc962f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32: Use IOCTL_CONDRV_GET_INPUT_INFO in GetConsoleWindow.

parent 7444aa42
...@@ -187,18 +187,14 @@ static BOOL restore_console_mode(HANDLE hin) ...@@ -187,18 +187,14 @@ static BOOL restore_console_mode(HANDLE hin)
* Success: hwnd of the console window. * Success: hwnd of the console window.
* Failure: NULL * Failure: NULL
*/ */
HWND WINAPI GetConsoleWindow(VOID) HWND WINAPI GetConsoleWindow(void)
{ {
HWND hWnd = NULL; struct condrv_input_info info;
BOOL ret;
SERVER_START_REQ(get_console_input_info)
{
req->handle = 0;
if (!wine_server_call_err(req)) hWnd = wine_server_ptr_handle( reply->win );
}
SERVER_END_REQ;
return hWnd; ret = DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL );
return ret ? (HWND)info.win : NULL;
} }
......
...@@ -3592,6 +3592,7 @@ static void test_FreeConsole(void) ...@@ -3592,6 +3592,7 @@ static void test_FreeConsole(void)
WCHAR title[16]; WCHAR title[16];
HANDLE handle; HANDLE handle;
DWORD size; DWORD size;
HWND hwnd;
UINT cp; UINT cp;
BOOL ret; BOOL ret;
...@@ -3646,6 +3647,11 @@ static void test_FreeConsole(void) ...@@ -3646,6 +3647,11 @@ static void test_FreeConsole(void)
ok(title[0] == 0xc0c0, "title byffer changed\n"); ok(title[0] == 0xc0c0, "title byffer changed\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
SetLastError(0xdeadbeef);
hwnd = GetConsoleWindow();
ok(!hwnd, "hwnd = %p\n", hwnd);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
if (!skip_nt) if (!skip_nt)
{ {
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef ); SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );
......
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