Hi Hugh,
On 2/2/22 12:10, Hugh McMaster wrote:
+struct condrv_output_info_params_font {
- struct condrv_output_info_params params;
- WCHAR face_name[LF_FACESIZE];
+};
Since you use it only for SetCurrentConsoleFontEx, you could just move it there. See how GetCurrentConsoleFontEx is handling it. Also, ioclt() size should probably only contain meaningful bytes (no extra uninitialized LF_FACESIZE bytes and no null-byte). On conhost side, we can calculate string length from params size.
#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002 #define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004 @@ -155,6 +160,7 @@ struct condrv_output_info_params #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020 #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040 +#define SET_CONSOLE_OUTPUT_INFO_FONT 0x0080
/* IOCTL_CONDRV_FILL_OUTPUT params */ struct condrv_fill_output_params diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 78f6e345170..456f3a4889e 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -1913,6 +1913,13 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer, screen_buffer->max_width = info->max_width; screen_buffer->max_height = info->max_height; }
- if (params->mask & SET_CONSOLE_OUTPUT_INFO_FONT)
- {
WCHAR *face_name = (WCHAR *)(params + 1);
update_console_font( screen_buffer->console, face_name,
info->font_height, info->font_weight );
- }
Looking at update_console_font, if creating a font with passed arguments fails, it will set a first found font, ignoring all passed arguments. Should it return a failure instead?
Thanks,
Jacek