Commit 6891faf4 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

conhost: Save original console title on initialization.

parent b1dc5a53
......@@ -2461,21 +2461,38 @@ static NTSTATUS scroll_output( struct screen_buffer *screen_buffer, const struct
return STATUS_SUCCESS;
}
static WCHAR *set_title( const WCHAR *in_title, size_t size )
{
WCHAR *title = NULL;
title = malloc( size + sizeof(WCHAR) );
if (!title) return NULL;
memcpy( title, in_title, size );
title[ size / sizeof(WCHAR) ] = 0;
return title;
}
static NTSTATUS set_console_title( struct console *console, const WCHAR *in_title, size_t size )
{
WCHAR *title = NULL;
TRACE( "%s\n", debugstr_wn(in_title, size / sizeof(WCHAR)) );
if (size)
{
if (!(title = malloc( size + sizeof(WCHAR) ))) return STATUS_NO_MEMORY;
memcpy( title, in_title, size );
title[size / sizeof(WCHAR)] = 0;
}
if (!(title = set_title( in_title, size )))
return STATUS_NO_MEMORY;
free( console->title );
console->title = title;
if (!console->title_orig && !(console->title_orig = set_title( in_title, size )))
{
free( console->title );
console->title = NULL;
return STATUS_NO_MEMORY;
}
if (console->tty_output)
{
size_t len;
......
......@@ -93,6 +93,7 @@ struct console
unsigned int key_state;
struct console_window *window;
WCHAR *title; /* console title */
WCHAR *title_orig; /* original console title */
struct history_line **history; /* lines history */
unsigned int history_size; /* number of entries in history array */
unsigned int history_index; /* number of used entries in history array */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment