server: Move console codepages to the server.
This commit is contained in:
parent
ef433e2792
commit
9d74661856
|
@ -55,9 +55,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(console);
|
WINE_DEFAULT_DEBUG_CHANNEL(console);
|
||||||
|
|
||||||
static UINT console_input_codepage;
|
|
||||||
static UINT console_output_codepage;
|
|
||||||
|
|
||||||
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
|
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
|
||||||
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
|
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
|
||||||
|
|
||||||
|
@ -141,12 +138,19 @@ HWND WINAPI GetConsoleWindow(VOID)
|
||||||
*/
|
*/
|
||||||
UINT WINAPI GetConsoleCP(VOID)
|
UINT WINAPI GetConsoleCP(VOID)
|
||||||
{
|
{
|
||||||
if (!console_input_codepage)
|
BOOL ret;
|
||||||
|
UINT codepage = GetOEMCP(); /* default value */
|
||||||
|
|
||||||
|
SERVER_START_REQ(get_console_input_info)
|
||||||
{
|
{
|
||||||
console_input_codepage = GetOEMCP();
|
req->handle = 0;
|
||||||
TRACE("%u\n", console_input_codepage);
|
ret = !wine_server_call_err(req);
|
||||||
|
if (ret && reply->input_cp)
|
||||||
|
codepage = reply->input_cp;
|
||||||
}
|
}
|
||||||
return console_input_codepage;
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
return codepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,9 +159,24 @@ UINT WINAPI GetConsoleCP(VOID)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetConsoleCP(UINT cp)
|
BOOL WINAPI SetConsoleCP(UINT cp)
|
||||||
{
|
{
|
||||||
if (!IsValidCodePage( cp )) return FALSE;
|
BOOL ret;
|
||||||
console_input_codepage = cp;
|
|
||||||
return TRUE;
|
if (!IsValidCodePage(cp))
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SERVER_START_REQ(set_console_input_info)
|
||||||
|
{
|
||||||
|
req->handle = 0;
|
||||||
|
req->mask = SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE;
|
||||||
|
req->input_cp = cp;
|
||||||
|
ret = !wine_server_call_err(req);
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,12 +185,19 @@ BOOL WINAPI SetConsoleCP(UINT cp)
|
||||||
*/
|
*/
|
||||||
UINT WINAPI GetConsoleOutputCP(VOID)
|
UINT WINAPI GetConsoleOutputCP(VOID)
|
||||||
{
|
{
|
||||||
if (!console_output_codepage)
|
BOOL ret;
|
||||||
|
UINT codepage = GetOEMCP(); /* default value */
|
||||||
|
|
||||||
|
SERVER_START_REQ(get_console_input_info)
|
||||||
{
|
{
|
||||||
console_output_codepage = GetOEMCP();
|
req->handle = 0;
|
||||||
TRACE("%u\n", console_output_codepage);
|
ret = !wine_server_call_err(req);
|
||||||
|
if (ret && reply->output_cp)
|
||||||
|
codepage = reply->output_cp;
|
||||||
}
|
}
|
||||||
return console_output_codepage;
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
return codepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,9 +213,24 @@ UINT WINAPI GetConsoleOutputCP(VOID)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetConsoleOutputCP(UINT cp)
|
BOOL WINAPI SetConsoleOutputCP(UINT cp)
|
||||||
{
|
{
|
||||||
if (!IsValidCodePage( cp )) return FALSE;
|
BOOL ret;
|
||||||
console_output_codepage = cp;
|
|
||||||
return TRUE;
|
if (!IsValidCodePage(cp))
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SERVER_START_REQ(set_console_input_info)
|
||||||
|
{
|
||||||
|
req->handle = 0;
|
||||||
|
req->mask = SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE;
|
||||||
|
req->output_cp = cp;
|
||||||
|
ret = !wine_server_call_err(req);
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1378,6 +1378,8 @@ struct set_console_input_info_request
|
||||||
int history_mode;
|
int history_mode;
|
||||||
int history_size;
|
int history_size;
|
||||||
int edition_mode;
|
int edition_mode;
|
||||||
|
int input_cp;
|
||||||
|
int output_cp;
|
||||||
/* VARARG(title,unicode_str); */
|
/* VARARG(title,unicode_str); */
|
||||||
};
|
};
|
||||||
struct set_console_input_info_reply
|
struct set_console_input_info_reply
|
||||||
|
@ -1389,6 +1391,8 @@ struct set_console_input_info_reply
|
||||||
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
|
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
|
||||||
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
|
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
|
||||||
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
|
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
|
||||||
|
#define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x20
|
||||||
|
#define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1404,6 +1408,8 @@ struct get_console_input_info_reply
|
||||||
int history_size;
|
int history_size;
|
||||||
int history_index;
|
int history_index;
|
||||||
int edition_mode;
|
int edition_mode;
|
||||||
|
int input_cp;
|
||||||
|
int output_cp;
|
||||||
/* VARARG(title,unicode_str); */
|
/* VARARG(title,unicode_str); */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4722,6 +4728,6 @@ union generic_reply
|
||||||
struct get_next_device_request_reply get_next_device_request_reply;
|
struct get_next_device_request_reply get_next_device_request_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 303
|
#define SERVER_PROTOCOL_VERSION 304
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||||
|
|
|
@ -255,6 +255,8 @@ static struct object *create_console_input( struct thread* renderer )
|
||||||
console_input->history_index = 0;
|
console_input->history_index = 0;
|
||||||
console_input->history_mode = 0;
|
console_input->history_mode = 0;
|
||||||
console_input->edition_mode = 0;
|
console_input->edition_mode = 0;
|
||||||
|
console_input->input_cp = 0;
|
||||||
|
console_input->output_cp = 0;
|
||||||
console_input->event = create_event( NULL, NULL, 0, 1, 0 );
|
console_input->event = create_event( NULL, NULL, 0, 1, 0 );
|
||||||
|
|
||||||
if (!console_input->history || !console_input->evt)
|
if (!console_input->history || !console_input->evt)
|
||||||
|
@ -680,6 +682,14 @@ static int set_console_input_info( const struct set_console_input_info_request *
|
||||||
{
|
{
|
||||||
console->edition_mode = req->edition_mode;
|
console->edition_mode = req->edition_mode;
|
||||||
}
|
}
|
||||||
|
if (req->mask & SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE)
|
||||||
|
{
|
||||||
|
console->input_cp = req->input_cp;
|
||||||
|
}
|
||||||
|
if (req->mask & SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE)
|
||||||
|
{
|
||||||
|
console->output_cp = req->output_cp;
|
||||||
|
}
|
||||||
release_object( console );
|
release_object( console );
|
||||||
return 1;
|
return 1;
|
||||||
error:
|
error:
|
||||||
|
@ -1372,6 +1382,8 @@ DECL_HANDLER(get_console_input_info)
|
||||||
reply->history_size = console->history_size;
|
reply->history_size = console->history_size;
|
||||||
reply->history_index = console->history_index;
|
reply->history_index = console->history_index;
|
||||||
reply->edition_mode = console->edition_mode;
|
reply->edition_mode = console->edition_mode;
|
||||||
|
reply->input_cp = console->input_cp;
|
||||||
|
reply->output_cp = console->output_cp;
|
||||||
|
|
||||||
release_object( console );
|
release_object( console );
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ struct console_input
|
||||||
int history_index; /* number of used entries in history array */
|
int history_index; /* number of used entries in history array */
|
||||||
int history_mode; /* mode of history (non zero means remove doubled strings */
|
int history_mode; /* mode of history (non zero means remove doubled strings */
|
||||||
int edition_mode; /* index to edition mode flavors */
|
int edition_mode; /* index to edition mode flavors */
|
||||||
|
int input_cp; /* console input codepage */
|
||||||
|
int output_cp; /* console output codepage */
|
||||||
struct event *event; /* event to wait on for input queue */
|
struct event *event; /* event to wait on for input queue */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1104,6 +1104,8 @@ struct console_renderer_event
|
||||||
int history_mode; /* whether we duplicate lines in history */
|
int history_mode; /* whether we duplicate lines in history */
|
||||||
int history_size; /* number of lines in history */
|
int history_size; /* number of lines in history */
|
||||||
int edition_mode; /* index to the edition mode flavors */
|
int edition_mode; /* index to the edition mode flavors */
|
||||||
|
int input_cp; /* console input codepage */
|
||||||
|
int output_cp; /* console output codepage */
|
||||||
VARARG(title,unicode_str); /* console title */
|
VARARG(title,unicode_str); /* console title */
|
||||||
@END
|
@END
|
||||||
#define SET_CONSOLE_INPUT_INFO_ACTIVE_SB 0x01
|
#define SET_CONSOLE_INPUT_INFO_ACTIVE_SB 0x01
|
||||||
|
@ -1111,6 +1113,8 @@ struct console_renderer_event
|
||||||
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
|
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE 0x04
|
||||||
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
|
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE 0x08
|
||||||
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
|
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE 0x10
|
||||||
|
#define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x20
|
||||||
|
#define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x40
|
||||||
|
|
||||||
|
|
||||||
/* Get info about a console (input only) */
|
/* Get info about a console (input only) */
|
||||||
|
@ -1121,6 +1125,8 @@ struct console_renderer_event
|
||||||
int history_size; /* number of lines in history */
|
int history_size; /* number of lines in history */
|
||||||
int history_index; /* number of used lines in history */
|
int history_index; /* number of used lines in history */
|
||||||
int edition_mode; /* index to the edition mode flavors */
|
int edition_mode; /* index to the edition mode flavors */
|
||||||
|
int input_cp; /* console input codepage */
|
||||||
|
int output_cp; /* console output codepage */
|
||||||
VARARG(title,unicode_str); /* console title */
|
VARARG(title,unicode_str); /* console title */
|
||||||
@END
|
@END
|
||||||
|
|
||||||
|
|
|
@ -1466,6 +1466,8 @@ static void dump_set_console_input_info_request( const struct set_console_input_
|
||||||
fprintf( stderr, " history_mode=%d,", req->history_mode );
|
fprintf( stderr, " history_mode=%d,", req->history_mode );
|
||||||
fprintf( stderr, " history_size=%d,", req->history_size );
|
fprintf( stderr, " history_size=%d,", req->history_size );
|
||||||
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
|
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
|
||||||
|
fprintf( stderr, " input_cp=%d,", req->input_cp );
|
||||||
|
fprintf( stderr, " output_cp=%d,", req->output_cp );
|
||||||
fprintf( stderr, " title=" );
|
fprintf( stderr, " title=" );
|
||||||
dump_varargs_unicode_str( cur_size );
|
dump_varargs_unicode_str( cur_size );
|
||||||
}
|
}
|
||||||
|
@ -1481,6 +1483,8 @@ static void dump_get_console_input_info_reply( const struct get_console_input_in
|
||||||
fprintf( stderr, " history_size=%d,", req->history_size );
|
fprintf( stderr, " history_size=%d,", req->history_size );
|
||||||
fprintf( stderr, " history_index=%d,", req->history_index );
|
fprintf( stderr, " history_index=%d,", req->history_index );
|
||||||
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
|
fprintf( stderr, " edition_mode=%d,", req->edition_mode );
|
||||||
|
fprintf( stderr, " input_cp=%d,", req->input_cp );
|
||||||
|
fprintf( stderr, " output_cp=%d,", req->output_cp );
|
||||||
fprintf( stderr, " title=" );
|
fprintf( stderr, " title=" );
|
||||||
dump_varargs_unicode_str( cur_size );
|
dump_varargs_unicode_str( cur_size );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue