diff --git a/server/console.c b/server/console.c index f1f3f3d9f9f..88a24e83d9e 100644 --- a/server/console.c +++ b/server/console.c @@ -35,13 +35,37 @@ #include "process.h" #include "request.h" #include "unicode.h" -#include "console.h" +#include "wincon.h" #include "winternl.h" /* specific access rights (FIXME: should use finer-grained access rights) */ #define CONSOLE_READ 0x01 #define CONSOLE_WRITE 0x02 +struct screen_buffer; +struct console_input_events; + +struct console_input +{ + struct object obj; /* object header */ + int num_proc; /* number of processes attached to this console */ + struct thread *renderer; /* console renderer thread */ + int mode; /* input mode */ + struct screen_buffer *active; /* active screen buffer */ + int recnum; /* number of input records */ + INPUT_RECORD *records; /* input records */ + struct console_input_events *evt; /* synchronization event with renderer */ + WCHAR *title; /* console title */ + WCHAR **history; /* lines history */ + int history_size; /* number of 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 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 */ +}; + static unsigned int console_map_access( struct object *obj, unsigned int access ); static void console_input_dump( struct object *obj, int verbose ); @@ -405,6 +429,11 @@ void inherit_console(struct thread *parent_thread, struct process *process, obj_ } } +struct thread *console_get_renderer( struct console_input *console ) +{ + return console->renderer; +} + static struct console_input* console_input_get( obj_handle_t handle, unsigned access ) { struct console_input* console = NULL; diff --git a/server/console.h b/server/console.h deleted file mode 100644 index 79e266c0165..00000000000 --- a/server/console.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Wine server consoles - * - * Copyright (C) 2001 Eric Pouech - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __WINE_SERVER_CONSOLE_H -#define __WINE_SERVER_CONSOLE_H - -#include "wincon.h" - -struct screen_buffer; -struct console_input_events; - -struct console_input -{ - struct object obj; /* object header */ - int num_proc; /* number of processes attached to this console */ - struct thread *renderer; /* console renderer thread */ - int mode; /* input mode */ - struct screen_buffer *active; /* active screen buffer */ - int recnum; /* number of input records */ - INPUT_RECORD *records; /* input records */ - struct console_input_events *evt; /* synchronization event with renderer */ - WCHAR *title; /* console title */ - WCHAR **history; /* lines history */ - int history_size; /* number of 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 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 */ -}; - -/* console functions */ - -extern void inherit_console(struct thread *parent_thread, struct process *process, obj_handle_t hconin); -extern int free_console( struct process *process ); - -#endif /* __WINE_SERVER_CONSOLE_H */ diff --git a/server/debugger.c b/server/debugger.c index 85ab63a4fea..eb89ef9ff49 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -36,7 +36,6 @@ #include "process.h" #include "thread.h" #include "request.h" -#include "console.h" enum debug_event_state { EVENT_QUEUED, EVENT_SENT, EVENT_CONTINUED }; @@ -426,7 +425,7 @@ static int debugger_attach( struct process *process, struct thread *debugger ) if (thread->process == process) goto error; /* don't let a debugger debug its console... won't work */ - if (debugger->process->console && debugger->process->console->renderer->process == process) + if (debugger->process->console && console_get_renderer(debugger->process->console)->process == process) goto error; suspend_process( process ); diff --git a/server/process.c b/server/process.c index b100b839624..092718ffa35 100644 --- a/server/process.c +++ b/server/process.c @@ -46,7 +46,6 @@ #include "process.h" #include "thread.h" #include "request.h" -#include "console.h" #include "user.h" #include "security.h" @@ -567,7 +566,7 @@ void kill_console_processes( struct thread *renderer, int exit_code ) { if (process == renderer->process) continue; if (!process->running_threads) continue; - if (process->console && process->console->renderer == renderer) break; + if (process->console && console_get_renderer( process->console ) == renderer) break; } if (&process->entry == &process_list) break; /* no process found */ terminate_process( process, NULL, exit_code ); diff --git a/server/process.h b/server/process.h index c007bae9973..b2a6849666d 100644 --- a/server/process.h +++ b/server/process.h @@ -130,6 +130,11 @@ extern struct process_snapshot *process_snap( int *count ); extern struct module_snapshot *module_snap( struct process *process, int *count ); extern void enum_processes( int (*cb)(struct process*, void*), void *user); +/* console functions */ +extern void inherit_console(struct thread *parent_thread, struct process *process, obj_handle_t hconin); +extern int free_console( struct process *process ); +extern struct thread *console_get_renderer( struct console_input *console ); + /* process tracing mechanism to use */ #ifdef __APPLE__ #define USE_MACH