kernel32: Allow non-console handles in CloseConsoleHandle.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-11-11 20:06:48 +01:00 committed by Alexandre Julliard
parent 1335768f0a
commit 5386b7e4c8
3 changed files with 1 additions and 16 deletions

View file

@ -125,12 +125,7 @@ HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
*/
BOOL WINAPI CloseConsoleHandle(HANDLE handle)
{
if (!is_console_handle(handle))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return CloseHandle(wine_server_ptr_handle(console_handle_unmap(handle)));
return CloseHandle(handle);
}
/******************************************************************

View file

@ -21,8 +21,6 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
#include "wine/server.h"
NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir );
BOOL CONSOLE_Init(RTL_USER_PROCESS_PARAMETERS *params) DECLSPEC_HIDDEN;
@ -37,12 +35,6 @@ static inline HANDLE console_handle_map(HANDLE h)
return h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE;
}
/* map a kernel32 console handle onto a real wineserver handle */
static inline obj_handle_t console_handle_unmap(HANDLE h)
{
return wine_server_obj_handle( h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE );
}
static inline BOOL set_ntstatus( NTSTATUS status )
{
if (status) SetLastError( RtlNtStatusToDosError( status ));

View file

@ -1523,10 +1523,8 @@ static void test_DuplicateConsoleHandle(void)
ok(ret, "SetEvent failed: %u\n", GetLastError());
ret = CloseConsoleHandle(handle);
todo_wine
ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError());
ret = CloseConsoleHandle(event);
todo_wine
ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError());
handle = DuplicateConsoleHandle((HANDLE)0xdeadbeef, 0, FALSE, DUPLICATE_SAME_ACCESS);