Module: wine Branch: master Commit: 810873eb7561e147dff871aa20315e930d1f01bb URL: https://source.winehq.org/git/wine.git/?a=commit;h=810873eb7561e147dff871aa2...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Sep 22 16:48:04 2020 +0200
kernel32: Move Beep implementation to conhost.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/console.c | 17 +++-------------- include/wine/condrv.h | 1 + programs/conhost/conhost.c | 9 +++++++++ 3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index fc83b2db12..24f86a9e51 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -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; }
diff --git a/include/wine/condrv.h b/include/wine/condrv.h index a5633998db..dd870c2157 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -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) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 82cee8bdf0..a775e74961 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -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;