From a6e2fd3c8f61638df837d50cabda53133c0de890 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 1 Oct 2013 20:19:26 +1000 Subject: csbix-server --- server/console.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ server/protocol.def | 17 ++++++++++++++- server/trace.c | 10 +++++++++ tools/make_requests | 3 ++- 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/server/console.c b/server/console.c index 2a5ca80..89d6381 100644 --- a/server/console.c +++ b/server/console.c @@ -39,6 +39,24 @@ #include "wincon.h" #include "winternl.h" +/* ColorTable */ +#define BLACK 0x00000000 +#define DARK_BLUE 0x00800000 +#define DARK_GREEN 0x00008000 +#define DARK_AQUA 0x00808000 +#define DARK_RED 0x00000080 +#define PURPLE 0x00800080 +#define DARK_YELLOW 0x00008080 +#define GRAY 0x00C0C0C0 +#define DARK_GRAY 0x00808080 +#define BLUE 0x00FF0000 +#define GREEN 0x0000FF00 +#define CYAN 0x00FFFF00 +#define RED 0x000000FF +#define MAGENTA 0x00FF00FF +#define YELLOW 0x0000FFFF +#define WHITE 0x00FFFFFF + struct screen_buffer; struct console_input_events; @@ -139,6 +157,9 @@ struct screen_buffer unsigned short attr; /* default attribute for screen buffer */ rectangle_t win; /* current visible window on the screen buffer * * as seen in wineconsole */ + unsigned short popup_attr; /* console popup fill attribute */ + int fullscreen; /* indicates whether full-screen mode is supported */ + colortable_t colortable; /* console color settings (struct containing an array) */ struct fd *fd; /* for bare console, attached output fd */ }; @@ -402,6 +423,24 @@ static struct screen_buffer *create_console_output( struct console_input *consol screen_buffer->win.right = screen_buffer->max_width - 1; screen_buffer->win.top = 0; screen_buffer->win.bottom = screen_buffer->max_height - 1; + screen_buffer->popup_attr = 0xF5; + screen_buffer->fullscreen = FALSE; + screen_buffer->colortable.ct[0] = BLACK; + screen_buffer->colortable.ct[1] = DARK_BLUE; + screen_buffer->colortable.ct[2] = DARK_GREEN; + screen_buffer->colortable.ct[3] = DARK_AQUA; + screen_buffer->colortable.ct[4] = DARK_RED; + screen_buffer->colortable.ct[5] = PURPLE; + screen_buffer->colortable.ct[6] = DARK_YELLOW; + screen_buffer->colortable.ct[7] = GRAY; + screen_buffer->colortable.ct[8] = DARK_GRAY; + screen_buffer->colortable.ct[9] = BLUE; + screen_buffer->colortable.ct[10] = GREEN; + screen_buffer->colortable.ct[11] = CYAN; + screen_buffer->colortable.ct[12] = RED; + screen_buffer->colortable.ct[13] = MAGENTA; + screen_buffer->colortable.ct[14] = YELLOW; + screen_buffer->colortable.ct[15] = WHITE; if (fd == -1) screen_buffer->fd = NULL; else @@ -1664,6 +1703,25 @@ DECL_HANDLER(get_console_output_info) } } +/* get extended info about a console screen buffer */ +DECL_HANDLER(get_console_output_infoex) +{ + struct screen_buffer *screen_buffer; + int i; + + if ((screen_buffer = (struct screen_buffer *)get_handle_obj( current->process, req->handle, + FILE_READ_PROPERTIES, &screen_buffer_ops))) + { + reply->popup_attr = screen_buffer->popup_attr; + reply->fullscreen = screen_buffer->fullscreen; + for (i=0;i<16;i++) + { + reply->colortable.ct[i] = screen_buffer->colortable.ct[i]; + } + release_object( screen_buffer ); + } +} + /* read data (chars & attrs) from a screen buffer */ DECL_HANDLER(read_console_output) { diff --git a/server/protocol.def b/server/protocol.def index a7c5478..24e799c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -63,7 +63,7 @@ struct reply_header /* this is used to construct the generic_request union */ struct request_max_size { - int pad[16]; /* the max request size is 16 ints */ + int pad[20]; /* the max request size is 20 ints */ }; #define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */ @@ -668,6 +668,12 @@ struct rawinput_device user_handle_t target; }; +/* structure containing the console ColorTable array */ +typedef struct +{ + unsigned long ct[16]; +} colortable_t; + /****************************************************************/ /* Request declarations */ @@ -1473,6 +1479,15 @@ struct console_renderer_event short int max_height; @END +/* Get extended info about a console (output only) */ +@REQ(get_console_output_infoex) + obj_handle_t handle; /* handle to the console */ +@REPLY + unsigned short popup_attr; /* console popup fill attributes */ + short int fullscreen; /* indicates whether full-screen mode is supported */ + colortable_t colortable; /* console color settings (struct containing an array) */ +@END + /* Add input records to a console input queue */ @REQ(write_console_input) obj_handle_t handle; /* handle to the console input */ diff --git a/server/trace.c b/server/trace.c index 3f17b61..52f0ff7 100644 --- a/server/trace.c +++ b/server/trace.c @@ -333,6 +333,16 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) } } +static void dump_colortable( const char *prefix, const colortable_t *ct ) +{ + int i; + for (i=0;i<16;i++) + { + fprintf( stderr, "%s\n", prefix); + fprintf( stderr, "%d: %08lX\n", i, ct->ct[i]); + } +} + static void dump_luid( const char *prefix, const luid_t *luid ) { fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part ); diff --git a/tools/make_requests b/tools/make_requests index 445ad06..1461fe2 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -52,6 +52,7 @@ my %formats = "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "cpu_type_t" => [ 4, 4, "&dump_cpu_type" ], "hw_input_t" => [ 32, 8, "&dump_hw_input" ], + "colortable_t" => [ 64, 4, "&dump_colortable" ], ); my @requests = (); @@ -60,7 +61,7 @@ my @asserts = (); my @trace_lines = (); -my $max_req_size = 64; +my $max_req_size = 80; my $warnings = scalar(@ARGV) && $ARGV[0] eq "-w"; -- 1.7.10.4