kernel32: Use IOCTL_CONDRV_GET_INPUT_INFO in CONSOLE_GetNumHistoryEntries.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-08-14 13:27:31 +02:00 committed by Alexandre Julliard
parent 36fc962f5c
commit f54c7205b6
5 changed files with 8 additions and 11 deletions

View file

@ -1009,16 +1009,11 @@ BOOL CONSOLE_AppendHistory(const WCHAR* ptr)
*
*
*/
unsigned CONSOLE_GetNumHistoryEntries(void)
unsigned CONSOLE_GetNumHistoryEntries(HANDLE console)
{
unsigned ret = -1;
SERVER_START_REQ(get_console_input_info)
{
req->handle = 0;
if (!wine_server_call_err( req )) ret = reply->history_index;
}
SERVER_END_REQ;
return ret;
struct condrv_input_info info;
BOOL ret = DeviceIoControl( console, IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL );
return ret ? info.history_index : ~0;
}
/******************************************************************

View file

@ -24,7 +24,7 @@
/* console.c */
extern int CONSOLE_GetHistory(int idx, WCHAR* buf, int buf_len) DECLSPEC_HIDDEN;
extern BOOL CONSOLE_AppendHistory(const WCHAR *p) DECLSPEC_HIDDEN;
extern unsigned CONSOLE_GetNumHistoryEntries(void) DECLSPEC_HIDDEN;
extern unsigned CONSOLE_GetNumHistoryEntries(HANDLE) DECLSPEC_HIDDEN;
extern void CONSOLE_FillLineUniform(HANDLE hConsoleOutput, int i, int j, int len, LPCHAR_INFO lpFill) DECLSPEC_HIDDEN;
extern BOOL CONSOLE_GetEditionMode(HANDLE, int*) DECLSPEC_HIDDEN;

View file

@ -408,7 +408,7 @@ static WCHAR* WCEL_GetHistory(WCEL_Context* ctx, int idx)
static void WCEL_HistoryInit(WCEL_Context* ctx)
{
ctx->histPos = CONSOLE_GetNumHistoryEntries();
ctx->histPos = CONSOLE_GetNumHistoryEntries(ctx->hConIn);
ctx->histSize = ctx->histPos + 1;
ctx->histCurr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR));
}

View file

@ -74,6 +74,7 @@ struct condrv_input_info
unsigned int output_cp; /* console output codepage */
unsigned int history_mode; /* whether we duplicate lines in history */
unsigned int history_size; /* number of lines in history */
unsigned int history_index; /* number of used lines in history */
unsigned int edition_mode; /* index to the edition mode flavors */
unsigned int input_count; /* number of available input records */
condrv_handle_t win; /* renderer window handle */

View file

@ -1595,6 +1595,7 @@ static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *
info.output_cp = console->output_cp;
info.history_mode = console->history_mode;
info.history_size = console->history_size;
info.history_index = console->history_index;
info.edition_mode = console->edition_mode;
info.input_count = console->recnum;
info.win = console->win;