Commit 5386b7e4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32: Allow non-console handles in CloseConsoleHandle.

parent 1335768f
...@@ -125,12 +125,7 @@ HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit, ...@@ -125,12 +125,7 @@ HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
*/ */
BOOL WINAPI CloseConsoleHandle(HANDLE handle) BOOL WINAPI CloseConsoleHandle(HANDLE handle)
{ {
if (!is_console_handle(handle)) return CloseHandle(handle);
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return CloseHandle(wine_server_ptr_handle(console_handle_unmap(handle)));
} }
/****************************************************************** /******************************************************************
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#ifndef __WINE_KERNEL_PRIVATE_H #ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H #define __WINE_KERNEL_PRIVATE_H
#include "wine/server.h"
NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir ); NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir );
BOOL CONSOLE_Init(RTL_USER_PROCESS_PARAMETERS *params) DECLSPEC_HIDDEN; BOOL CONSOLE_Init(RTL_USER_PROCESS_PARAMETERS *params) DECLSPEC_HIDDEN;
...@@ -37,12 +35,6 @@ static inline HANDLE console_handle_map(HANDLE h) ...@@ -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; 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 ) static inline BOOL set_ntstatus( NTSTATUS status )
{ {
if (status) SetLastError( RtlNtStatusToDosError( status )); if (status) SetLastError( RtlNtStatusToDosError( status ));
......
...@@ -1523,10 +1523,8 @@ static void test_DuplicateConsoleHandle(void) ...@@ -1523,10 +1523,8 @@ static void test_DuplicateConsoleHandle(void)
ok(ret, "SetEvent failed: %u\n", GetLastError()); ok(ret, "SetEvent failed: %u\n", GetLastError());
ret = CloseConsoleHandle(handle); ret = CloseConsoleHandle(handle);
todo_wine
ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError()); ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError());
ret = CloseConsoleHandle(event); ret = CloseConsoleHandle(event);
todo_wine
ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError()); ok(ret, "CloseConsoleHandle failed: %u\n", GetLastError());
handle = DuplicateConsoleHandle((HANDLE)0xdeadbeef, 0, FALSE, DUPLICATE_SAME_ACCESS); handle = DuplicateConsoleHandle((HANDLE)0xdeadbeef, 0, FALSE, DUPLICATE_SAME_ACCESS);
......
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