Jacek Caban : kernel32: Reimplement OpenConsoleW on top of CreateFileW.
Alexandre Julliard
julliard at winehq.org
Fri Jun 26 17:00:54 CDT 2020
Module: wine
Branch: master
Commit: be2443e0c5f021bb98f92d72191c6c55a031873f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=be2443e0c5f021bb98f92d72191c6c55a031873f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jun 25 22:27:51 2020 +0200
kernel32: Reimplement OpenConsoleW on top of CreateFileW.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/console.c | 32 +++++++-------------------------
1 file changed, 7 insertions(+), 25 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 02aa0d6f6f..04b89f8f55 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -227,39 +227,21 @@ BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
*/
HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creation)
{
- HANDLE output = INVALID_HANDLE_VALUE;
- HANDLE ret;
+ SECURITY_ATTRIBUTES sa;
TRACE("(%s, 0x%08x, %d, %u)\n", debugstr_w(name), access, inherit, creation);
- if (name)
- {
- if (strcmpiW(coninW, name) == 0)
- output = (HANDLE) FALSE;
- else if (strcmpiW(conoutW, name) == 0)
- output = (HANDLE) TRUE;
- }
-
- if (output == INVALID_HANDLE_VALUE || creation != OPEN_EXISTING)
+ if (!name || (strcmpiW( coninW, name ) && strcmpiW( conoutW, name )) || creation != OPEN_EXISTING)
{
- SetLastError(ERROR_INVALID_PARAMETER);
+ SetLastError( ERROR_INVALID_PARAMETER );
return INVALID_HANDLE_VALUE;
}
- SERVER_START_REQ( open_console )
- {
- req->from = wine_server_obj_handle( output );
- req->access = access;
- req->attributes = inherit ? OBJ_INHERIT : 0;
- req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;
- wine_server_call_err( req );
- ret = wine_server_ptr_handle( reply->handle );
- }
- SERVER_END_REQ;
- if (ret)
- ret = console_handle_map(ret);
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = inherit;
- return ret;
+ return CreateFileW( name, access, FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, creation, 0, NULL );
}
/******************************************************************
More information about the wine-cvs
mailing list