win32u: Don't use WINAPI for the font enumeration function.
[wine.git] / server / process.h
blob97e0d455ece05b2a0cec18da6fcfffb4f3da1f6a
1 /*
2 * Wine server processes
4 * Copyright (C) 1999 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_SERVER_PROCESS_H
22 #define __WINE_SERVER_PROCESS_H
24 #include "object.h"
26 struct atom_table;
27 struct handle_table;
28 struct startup_info;
29 struct job;
31 /* process startup state */
32 enum startup_state { STARTUP_IN_PROGRESS, STARTUP_DONE, STARTUP_ABORTED };
34 /* process structures */
36 struct process
38 struct object obj; /* object header */
39 struct list entry; /* entry in system-wide process list */
40 process_id_t parent_id; /* parent process id (at the time of creation) */
41 struct list thread_list; /* thread list */
42 struct debug_obj *debug_obj; /* debug object debugging this process */
43 struct debug_event *debug_event; /* debug event being sent to debugger */
44 struct handle_table *handles; /* handle entries */
45 struct fd *msg_fd; /* fd for sendmsg/recvmsg */
46 process_id_t id; /* id of the process */
47 process_id_t group_id; /* group id of the process */
48 unsigned int session_id; /* session id */
49 struct timeout_user *sigkill_timeout; /* timeout for final SIGKILL */
50 timeout_t sigkill_delay; /* delay before final SIGKILL */
51 unsigned short machine; /* client machine type */
52 int unix_pid; /* Unix pid for final SIGKILL */
53 int exit_code; /* process exit code */
54 int running_threads; /* number of threads running in this process */
55 timeout_t start_time; /* absolute time at process start */
56 timeout_t end_time; /* absolute time at process end */
57 affinity_t affinity; /* process affinity mask */
58 int priority; /* priority class */
59 int suspend; /* global process suspend count */
60 unsigned int is_system:1; /* is it a system process? */
61 unsigned int debug_children:1;/* also debug all child processes */
62 unsigned int is_terminating:1;/* is process terminating? */
63 data_size_t imagelen; /* length of image path in bytes */
64 WCHAR *image; /* main exe image full path */
65 struct job *job; /* job object associated with this process */
66 struct list job_entry; /* list entry for job object */
67 struct list asyncs; /* list of async object owned by the process */
68 struct list locks; /* list of file locks owned by the process */
69 struct list classes; /* window classes owned by the process */
70 struct console *console; /* console input */
71 enum startup_state startup_state; /* startup state */
72 struct startup_info *startup_info; /* startup info while init is in progress */
73 struct event *idle_event; /* event for input idle */
74 obj_handle_t winstation; /* main handle to process window station */
75 obj_handle_t desktop; /* handle to desktop to use for new threads */
76 struct token *token; /* security token associated with this process */
77 struct list views; /* list of memory views */
78 client_ptr_t peb; /* PEB address in client address space */
79 client_ptr_t ldt_copy; /* pointer to LDT copy in client addr space */
80 struct dir_cache *dir_cache; /* map of client-side directory cache */
81 unsigned int trace_data; /* opaque data used by the process tracing mechanism */
82 struct rawinput_device *rawinput_devices; /* list of registered rawinput devices */
83 unsigned int rawinput_device_count; /* number of registered rawinput devices */
84 const struct rawinput_device *rawinput_mouse; /* rawinput mouse device, if any */
85 const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */
86 struct list kernel_object; /* list of kernel object pointers */
87 pe_image_info_t image_info; /* main exe image info */
90 /* process functions */
92 extern unsigned int alloc_ptid( void *ptr );
93 extern void free_ptid( unsigned int id );
94 extern void *get_ptid_entry( unsigned int id );
95 extern struct process *create_process( int fd, struct process *parent, unsigned int flags, const startup_info_t *info,
96 const struct security_descriptor *sd, const obj_handle_t *handles,
97 unsigned int handle_count, struct token *token );
98 extern data_size_t get_process_startup_info_size( struct process *process );
99 extern struct thread *get_process_first_thread( struct process *process );
100 extern struct process *get_process_from_id( process_id_t id );
101 extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access );
102 extern struct debug_obj *get_debug_obj( struct process *process, obj_handle_t handle, unsigned int access );
103 extern int process_set_debugger( struct process *process, struct thread *thread );
104 extern void debugger_detach( struct process *process, struct debug_obj *debug_obj );
105 extern int set_process_debug_flag( struct process *process, int flag );
107 extern void add_process_thread( struct process *process,
108 struct thread *thread );
109 extern void remove_process_thread( struct process *process,
110 struct thread *thread );
111 extern void suspend_process( struct process *process );
112 extern void resume_process( struct process *process );
113 extern void kill_process( struct process *process, int violent_death );
114 extern void kill_console_processes( struct thread *renderer, int exit_code );
115 extern void detach_debugged_processes( struct debug_obj *debug_obj, int exit_code );
116 extern void enum_processes( int (*cb)(struct process*, void*), void *user);
118 /* console functions */
119 extern struct thread *console_get_renderer( struct console *console );
121 /* process tracing mechanism to use */
122 #ifdef __APPLE__
123 #define USE_MACH
124 #elif defined(__sun)
125 #define USE_PROCFS
126 #else
127 #define USE_PTRACE
128 #endif
130 extern void init_tracing_mechanism(void);
131 extern void init_process_tracing( struct process *process );
132 extern void finish_process_tracing( struct process *process );
133 extern int read_process_memory( struct process *process, client_ptr_t ptr, data_size_t size, char *dest );
134 extern int write_process_memory( struct process *process, client_ptr_t ptr, data_size_t size, const char *src );
136 static inline process_id_t get_process_id( struct process *process ) { return process->id; }
138 static inline int is_process_init_done( struct process *process )
140 return process->startup_state == STARTUP_DONE;
143 static const unsigned int default_session_id = 1;
145 #endif /* __WINE_SERVER_PROCESS_H */