1999-05-15 10:48:19 +00:00
|
|
|
/*
|
|
|
|
* Wine server processes
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Alexandre Julliard
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-05-15 10:48:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_SERVER_PROCESS_H
|
|
|
|
#define __WINE_SERVER_PROCESS_H
|
|
|
|
|
|
|
|
#include "object.h"
|
|
|
|
|
2000-05-30 19:48:18 +00:00
|
|
|
struct msg_queue;
|
2000-05-30 20:32:06 +00:00
|
|
|
struct atom_table;
|
2002-10-02 23:49:30 +00:00
|
|
|
struct handle_table;
|
2002-05-24 21:20:27 +00:00
|
|
|
struct startup_info;
|
2000-05-30 19:48:18 +00:00
|
|
|
|
2002-05-25 21:15:03 +00:00
|
|
|
/* process startup state */
|
|
|
|
enum startup_state { STARTUP_IN_PROGRESS, STARTUP_DONE, STARTUP_ABORTED };
|
|
|
|
|
1999-05-15 10:48:19 +00:00
|
|
|
/* process structures */
|
|
|
|
|
2000-03-09 18:18:41 +00:00
|
|
|
struct process_dll
|
|
|
|
{
|
2005-03-02 10:20:09 +00:00
|
|
|
struct list entry; /* entry in per-process dll list */
|
2000-03-09 18:18:41 +00:00
|
|
|
struct file *file; /* dll file */
|
|
|
|
void *base; /* dll base address (in process addr space) */
|
2002-03-22 00:21:23 +00:00
|
|
|
size_t size; /* dll size */
|
2000-03-09 18:18:41 +00:00
|
|
|
void *name; /* ptr to ptr to name (in process addr space) */
|
|
|
|
int dbg_offset; /* debug info offset */
|
|
|
|
int dbg_size; /* debug info size */
|
2002-03-22 00:21:23 +00:00
|
|
|
size_t namelen; /* length of dll file name */
|
2003-09-30 01:04:19 +00:00
|
|
|
WCHAR *filename; /* dll file name */
|
2000-03-09 18:18:41 +00:00
|
|
|
};
|
|
|
|
|
1999-05-16 16:54:54 +00:00
|
|
|
struct process
|
|
|
|
{
|
|
|
|
struct object obj; /* object header */
|
2005-02-25 19:31:26 +00:00
|
|
|
struct list entry; /* entry in system-wide process list */
|
2001-11-23 23:04:58 +00:00
|
|
|
struct process *parent; /* parent process */
|
2005-03-01 10:56:18 +00:00
|
|
|
struct list thread_list; /* thread list */
|
1999-05-16 16:54:54 +00:00
|
|
|
struct thread *debugger; /* thread debugging this process */
|
2002-10-02 23:49:30 +00:00
|
|
|
struct handle_table *handles; /* handle entries */
|
2003-02-19 00:33:32 +00:00
|
|
|
struct fd *msg_fd; /* fd for sendmsg/recvmsg */
|
2003-02-01 01:38:40 +00:00
|
|
|
process_id_t id; /* id of the process */
|
|
|
|
process_id_t group_id; /* group id of the process */
|
1999-05-16 16:54:54 +00:00
|
|
|
int exit_code; /* process exit code */
|
|
|
|
int running_threads; /* number of threads running in this process */
|
|
|
|
struct timeval start_time; /* absolute time at process start */
|
|
|
|
struct timeval end_time; /* absolute time at process end */
|
|
|
|
int priority; /* priority class */
|
|
|
|
int affinity; /* process affinity mask */
|
|
|
|
int suspend; /* global process suspend count */
|
1999-11-29 02:10:56 +00:00
|
|
|
int create_flags; /* process creation flags */
|
2003-03-18 05:04:33 +00:00
|
|
|
struct list locks; /* list of file locks owned by the process */
|
2003-12-10 04:08:06 +00:00
|
|
|
struct list classes; /* window classes owned by the process */
|
2001-11-23 23:04:58 +00:00
|
|
|
struct console_input*console; /* console input */
|
2002-05-25 21:15:03 +00:00
|
|
|
enum startup_state startup_state; /* startup state */
|
2002-05-24 21:20:27 +00:00
|
|
|
struct startup_info *startup_info; /* startup info while init is in progress */
|
2000-05-30 19:48:18 +00:00
|
|
|
struct event *idle_event; /* event for input idle */
|
|
|
|
struct msg_queue *queue; /* main message queue */
|
2005-06-08 18:44:50 +00:00
|
|
|
obj_handle_t winstation; /* main handle to process window station */
|
2005-06-09 12:07:12 +00:00
|
|
|
obj_handle_t desktop; /* handle to desktop to use for new threads */
|
2003-07-24 00:07:00 +00:00
|
|
|
struct token *token; /* security token associated with this process */
|
2000-03-09 18:18:41 +00:00
|
|
|
struct process_dll exe; /* main exe file */
|
2005-03-02 10:20:09 +00:00
|
|
|
struct list dlls; /* list of loaded dlls */
|
2003-10-14 01:30:42 +00:00
|
|
|
void *peb; /* PEB address in client address space */
|
2000-01-27 02:54:17 +00:00
|
|
|
void *ldt_copy; /* pointer to LDT copy in client addr space */
|
1999-05-16 16:54:54 +00:00
|
|
|
};
|
1999-05-15 10:48:19 +00:00
|
|
|
|
|
|
|
struct process_snapshot
|
|
|
|
{
|
|
|
|
struct process *process; /* process ptr */
|
2000-04-16 19:45:05 +00:00
|
|
|
int count; /* process refcount */
|
1999-05-15 10:48:19 +00:00
|
|
|
int threads; /* number of threads */
|
|
|
|
int priority; /* priority class */
|
2003-09-16 01:07:21 +00:00
|
|
|
int handles; /* number of handles */
|
1999-05-15 10:48:19 +00:00
|
|
|
};
|
|
|
|
|
2000-04-16 19:45:05 +00:00
|
|
|
struct module_snapshot
|
|
|
|
{
|
|
|
|
void *base; /* module base addr */
|
2002-03-22 00:21:23 +00:00
|
|
|
size_t size; /* module size */
|
|
|
|
size_t namelen; /* length of file name */
|
2003-09-30 01:04:19 +00:00
|
|
|
WCHAR *filename; /* module file name */
|
2000-04-16 19:45:05 +00:00
|
|
|
};
|
|
|
|
|
1999-05-15 10:48:19 +00:00
|
|
|
/* process functions */
|
|
|
|
|
2003-02-01 01:38:40 +00:00
|
|
|
extern unsigned int alloc_ptid( void *ptr );
|
|
|
|
extern void free_ptid( unsigned int id );
|
|
|
|
extern void *get_ptid_entry( unsigned int id );
|
2000-05-01 16:24:22 +00:00
|
|
|
extern struct thread *create_process( int fd );
|
2005-03-01 10:56:18 +00:00
|
|
|
extern struct thread *get_process_first_thread( struct process *process );
|
2002-10-03 19:54:57 +00:00
|
|
|
extern struct process *get_process_from_id( process_id_t id );
|
2002-05-30 20:12:58 +00:00
|
|
|
extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access );
|
1999-05-16 16:54:54 +00:00
|
|
|
extern int process_set_debugger( struct process *process, struct thread *thread );
|
2002-02-27 01:28:30 +00:00
|
|
|
extern int debugger_detach( struct process* process, struct thread* debugger );
|
2003-10-14 01:30:42 +00:00
|
|
|
extern int set_process_debug_flag( struct process *process, int flag );
|
2002-02-27 01:28:30 +00:00
|
|
|
|
1999-05-15 10:48:19 +00:00
|
|
|
extern void add_process_thread( struct process *process,
|
|
|
|
struct thread *thread );
|
|
|
|
extern void remove_process_thread( struct process *process,
|
|
|
|
struct thread *thread );
|
1999-05-16 16:54:54 +00:00
|
|
|
extern void suspend_process( struct process *process );
|
|
|
|
extern void resume_process( struct process *process );
|
2002-08-16 20:02:15 +00:00
|
|
|
extern void kill_all_processes( struct process *skip, int exit_code );
|
2001-02-28 21:45:23 +00:00
|
|
|
extern void kill_process( struct process *process, struct thread *skip, int exit_code );
|
2001-12-04 20:17:43 +00:00
|
|
|
extern void kill_console_processes( struct thread *renderer, int exit_code );
|
1999-11-24 01:22:14 +00:00
|
|
|
extern void kill_debugged_processes( struct thread *debugger, int exit_code );
|
2002-02-27 01:28:30 +00:00
|
|
|
extern void detach_debugged_processes( struct thread *debugger );
|
1999-05-15 10:48:19 +00:00
|
|
|
extern struct process_snapshot *process_snap( int *count );
|
2000-04-16 19:45:05 +00:00
|
|
|
extern struct module_snapshot *module_snap( struct process *process, int *count );
|
2002-06-02 21:22:22 +00:00
|
|
|
extern void enum_processes( int (*cb)(struct process*, void*), void *user);
|
1999-05-15 10:48:19 +00:00
|
|
|
|
2003-02-01 01:38:40 +00:00
|
|
|
inline static process_id_t get_process_id( struct process *process ) { return process->id; }
|
|
|
|
|
2002-05-25 21:15:03 +00:00
|
|
|
inline static int is_process_init_done( struct process *process )
|
|
|
|
{
|
|
|
|
return process->startup_state == STARTUP_DONE;
|
|
|
|
}
|
2000-03-08 12:01:30 +00:00
|
|
|
|
1999-05-15 10:48:19 +00:00
|
|
|
#endif /* __WINE_SERVER_PROCESS_H */
|