kernel32: Move Beep implementation to conhost.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-09-22 16:48:04 +02:00 committed by Alexandre Julliard
parent cd9f96c7ce
commit 810873eb75
3 changed files with 13 additions and 14 deletions

View File

@ -23,21 +23,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Reference applications:
* - IDA (interactive disassembler) full version 3.75. Works.
* - LYNX/W32. Works mostly, some keys crash it.
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#define NONAMELESSUNION
#include "ntstatus.h"
@ -84,9 +73,9 @@ HWND WINAPI GetConsoleWindow(void)
*/
BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
{
static const char beep = '\a';
/* dwFreq and dwDur are ignored by Win95 */
if (isatty(2)) write( 2, &beep, 1 );
/* FIXME: we should not require a console to be attached */
DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_BEEP, NULL, 0, NULL, 0, NULL, NULL );
return TRUE;
}

View File

@ -38,6 +38,7 @@
#define IOCTL_CONDRV_GET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 16, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_CONDRV_SET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 17, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_CONDRV_CTRL_EVENT CTL_CODE(FILE_DEVICE_CONSOLE, 18, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_CONDRV_BEEP CTL_CODE(FILE_DEVICE_CONSOLE, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
/* console output ioctls */
#define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)

View File

@ -2569,6 +2569,15 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
if (in_size % sizeof(WCHAR) || *out_size) return STATUS_INVALID_PARAMETER;
return set_console_title( console, in_data, in_size );
case IOCTL_CONDRV_BEEP:
if (in_size || *out_size) return STATUS_INVALID_PARAMETER;
if (console->is_unix)
{
tty_write( console, "\a", 1 );
tty_sync( console );
}
return STATUS_SUCCESS;
default:
FIXME( "unsupported ioctl %x\n", code );
return STATUS_NOT_SUPPORTED;