[PATCH 1/3] conhost: Copy font width/height to the new screen buffer to prevent an unhandled exception (divide by zero)
CreateConsoleScreenBuffer() copies properties relating to the current console font to the new screen buffer when called. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50187 Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- programs/conhost/conhost.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 7db1261d3be..adcfe00d7e9 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -92,10 +92,12 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int if (console->active) { - screen_buffer->max_width = console->active->max_width; - screen_buffer->max_height = console->active->max_height; - screen_buffer->win.right = console->active->win.right - console->active->win.left; - screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top; + screen_buffer->max_width = console->active->max_width; + screen_buffer->max_height = console->active->max_height; + screen_buffer->win.right = console->active->win.right - console->active->win.left; + screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top; + screen_buffer->font.width = console->active->font.width; + screen_buffer->font.height = console->active->font.height; } else { -- 2.32.0
CreateConsoleScreenBuffer() copies the Default Popup Attributes (colors) to the new screen buffer when called. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- programs/conhost/conhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index adcfe00d7e9..e43e8678ea1 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -86,7 +86,6 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int screen_buffer->width = width; screen_buffer->height = height; screen_buffer->attr = 0x07; - screen_buffer->popup_attr = 0xf5; screen_buffer->font.weight = FW_NORMAL; screen_buffer->font.pitch_family = FIXED_PITCH | FF_DONTCARE; @@ -96,6 +95,7 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int screen_buffer->max_height = console->active->max_height; screen_buffer->win.right = console->active->win.right - console->active->win.left; screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top; + screen_buffer->popup_attr = console->active->popup_attr; screen_buffer->font.width = console->active->font.width; screen_buffer->font.height = console->active->font.height; } -- 2.32.0
Hi Hugh, On 7/9/21 2:40 PM, Hugh McMaster wrote:
CreateConsoleScreenBuffer() copies the Default Popup Attributes (colors) to the new screen buffer when called.
Please add a test case for this and the next patch. It may be right, but it's hard to tell without a test. See dlls/kernel32/tests/console.c for similar tests. Thanks, Jacek
CreateConsoleScreenBuffer() copies the Default Attributes (colors) to the new screen buffer when called. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- programs/conhost/conhost.c | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index e43e8678ea1..bf81a093a73 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -95,6 +95,7 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int screen_buffer->max_height = console->active->max_height; screen_buffer->win.right = console->active->win.right - console->active->win.left; screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top; + screen_buffer->attr = console->active->attr; screen_buffer->popup_attr = console->active->popup_attr; screen_buffer->font.width = console->active->font.width; screen_buffer->font.height = console->active->font.height; -- 2.32.0
Hi Hugh, On 7/9/21 2:40 PM, Hugh McMaster wrote:
CreateConsoleScreenBuffer() copies properties relating to the current console font to the new screen buffer when called.
This originates from the old wineconsole code, but I wonder if we should store separated font info for each screen buffer. It seems that we could just store it once, in console struct, instead. Thanks, Jacek
participants (2)
-
Hugh McMaster -
Jacek Caban