Moved all remaining console related code to dlls/kernel directory.

This commit is contained in:
Eric Pouech 2003-12-12 04:10:52 +00:00 committed by Alexandre Julliard
parent 15be906293
commit 1da37e6ac4
2 changed files with 117 additions and 118 deletions

View File

@ -181,6 +181,123 @@ BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
}
/******************************************************************
* OpenConsoleW (KERNEL32.@)
*
* Undocumented
* Open a handle to the current process console.
* Returns INVALID_HANDLE_VALUE on failure.
*/
HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa,
DWORD creation)
{
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
BOOL output;
HANDLE ret;
if (strcmpW(coninW, name) == 0)
output = FALSE;
else if (strcmpW(conoutW, name) == 0)
output = TRUE;
else
{
SetLastError(ERROR_INVALID_NAME);
return INVALID_HANDLE_VALUE;
}
if (creation != OPEN_EXISTING)
{
SetLastError(ERROR_INVALID_PARAMETER);
return INVALID_HANDLE_VALUE;
}
SERVER_START_REQ( open_console )
{
req->from = output;
req->access = access;
req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
SetLastError(0);
wine_server_call_err( req );
ret = reply->handle;
}
SERVER_END_REQ;
return ret ? console_handle_map(ret) : INVALID_HANDLE_VALUE;
}
/******************************************************************
* VerifyConsoleIoHandle (KERNEL32.@)
*
* Undocumented
*/
BOOL WINAPI VerifyConsoleIoHandle(HANDLE handle)
{
BOOL ret;
if (!is_console_handle(handle)) return FALSE;
SERVER_START_REQ(get_console_mode)
{
req->handle = console_handle_unmap(handle);
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
return ret;
}
/******************************************************************
* DuplicateConsoleHandle (KERNEL32.@)
*
* Undocumented
*/
HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
DWORD options)
{
HANDLE ret;
if (!is_console_handle(handle) ||
!DuplicateHandle(GetCurrentProcess(), console_handle_unmap(handle),
GetCurrentProcess(), &ret, access, inherit, options))
return INVALID_HANDLE_VALUE;
return console_handle_map(ret);
}
/******************************************************************
* CloseConsoleHandle (KERNEL32.@)
*
* Undocumented
*/
BOOL WINAPI CloseConsoleHandle(HANDLE handle)
{
if (!is_console_handle(handle))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return CloseHandle(console_handle_unmap(handle));
}
/******************************************************************
* GetConsoleInputWaitHandle (KERNEL32.@)
*
* Undocumented
*/
HANDLE WINAPI GetConsoleInputWaitHandle(void)
{
static HANDLE console_wait_event;
/* FIXME: this is not thread safe */
if (!console_wait_event)
{
SERVER_START_REQ(get_console_wait_event)
{
if (!wine_server_call_err( req )) console_wait_event = reply->handle;
}
SERVER_END_REQ;
}
return console_wait_event;
}
/******************************************************************************
* WriteConsoleInputA [KERNEL32.@]
*/

View File

@ -202,124 +202,6 @@ void FILE_SetDosError(void)
}
/******************************************************************
* OpenConsoleW (KERNEL32.@)
*
* Undocumented
* Open a handle to the current process console.
* Returns INVALID_HANDLE_VALUE on failure.
*/
HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa,
DWORD creation)
{
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
BOOL output;
HANDLE ret;
if (strcmpW(coninW, name) == 0)
output = FALSE;
else if (strcmpW(conoutW, name) == 0)
output = TRUE;
else
{
SetLastError(ERROR_INVALID_NAME);
return INVALID_HANDLE_VALUE;
}
if (creation != OPEN_EXISTING)
{
SetLastError(ERROR_INVALID_PARAMETER);
return INVALID_HANDLE_VALUE;
}
SERVER_START_REQ( open_console )
{
req->from = output;
req->access = access;
req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
SetLastError(0);
wine_server_call_err( req );
ret = reply->handle;
}
SERVER_END_REQ;
return ret ? console_handle_map(ret) : INVALID_HANDLE_VALUE;
}
/******************************************************************
* VerifyConsoleIoHandle (KERNEL32.@)
*
* Undocumented
*/
BOOL WINAPI VerifyConsoleIoHandle(HANDLE handle)
{
BOOL ret;
if (!is_console_handle(handle)) return FALSE;
SERVER_START_REQ(get_console_mode)
{
req->handle = console_handle_unmap(handle);
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
return ret;
}
/******************************************************************
* DuplicateConsoleHandle (KERNEL32.@)
*
* Undocumented
*/
HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
DWORD options)
{
HANDLE ret;
if (!is_console_handle(handle) ||
!DuplicateHandle(GetCurrentProcess(), console_handle_unmap(handle),
GetCurrentProcess(), &ret, access, inherit, options))
return INVALID_HANDLE_VALUE;
return console_handle_map(ret);
}
/******************************************************************
* CloseConsoleHandle (KERNEL32.@)
*
* Undocumented
*/
BOOL WINAPI CloseConsoleHandle(HANDLE handle)
{
if (!is_console_handle(handle))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return CloseHandle(console_handle_unmap(handle));
}
/******************************************************************
* GetConsoleInputWaitHandle (KERNEL32.@)
*
* Undocumented
*/
HANDLE WINAPI GetConsoleInputWaitHandle(void)
{
static HANDLE console_wait_event;
/* FIXME: this is not thread safe */
if (!console_wait_event)
{
SERVER_START_REQ(get_console_wait_event)
{
if (!wine_server_call_err( req )) console_wait_event = reply->handle;
}
SERVER_END_REQ;
}
return console_wait_event;
}
/* end of FIXME */
/***********************************************************************
* FILE_CreateFile
*