Signed-off-by: Roman Pišl rpisl@seznam.cz --- include/wine/condrv.h | 1 + server/console.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
diff --git a/include/wine/condrv.h b/include/wine/condrv.h index b5e294b9401..4515249a673 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -43,6 +43,7 @@ #define IOCTL_CONDRV_BEEP CTL_CODE(FILE_DEVICE_CONSOLE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_CONDRV_FLUSH CTL_CODE(FILE_DEVICE_CONSOLE, 21, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_CONDRV_GET_WINDOW CTL_CODE(FILE_DEVICE_CONSOLE, 22, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CONDRV_GET_PROCESS_LIST CTL_CODE(FILE_DEVICE_CONSOLE, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
/* console output ioctls */ #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS) diff --git a/server/console.c b/server/console.c index 5407fba1411..f98175e403c 100644 --- a/server/console.c +++ b/server/console.c @@ -707,6 +707,27 @@ static void propagate_console_signal( struct console *console, enum_processes(propagate_console_signal_cb, &csi); }
+struct console_process_list +{ + unsigned int size; + unsigned int count; + unsigned int *processes; + struct console *console; +}; + +static int console_process_list_cb(struct process *process, void *user) +{ + struct console_process_list *cpl = user; + + if (process->console == cpl->console) + { + if (cpl->count < cpl->size) cpl->processes[cpl->count] = process->id; + cpl->count++; + } + + return 0; +} + /* dumb dump */ static void console_dump( struct object *obj, int verbose ) { @@ -963,6 +984,33 @@ static void console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async return; }
+ case IOCTL_CONDRV_GET_PROCESS_LIST: + { + struct console_process_list cpl; + if (get_reply_max_size() < sizeof(unsigned int)) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + + cpl.count = 0; + cpl.size = 0; + cpl.console = console; + enum_processes( console_process_list_cb, &cpl ); + if (cpl.count * sizeof(unsigned int) > get_reply_max_size()) + { + set_reply_data( &cpl.count, sizeof(cpl.count) ); + set_error( STATUS_BUFFER_TOO_SMALL ); + return; + } + + cpl.size = cpl.count; + cpl.count = 0; + if ((cpl.processes = set_reply_data_size( cpl.size * sizeof(unsigned int) ))) + enum_processes( console_process_list_cb, &cpl ); + return; + } + default: if (!console->server || code >> 16 != FILE_DEVICE_CONSOLE) {