4 * Copyright (C) 1999 Alexandre Julliard
7 #ifndef __WINE_SERVER_REQUEST_H
8 #define __WINE_SERVER_REQUEST_H
10 #ifndef __WINE_SERVER__
11 #error This file can only be used in the Wine server
16 /* max request length */
17 #define MAX_REQUEST_LENGTH 8192
19 /* request handler definition */
20 #define DECL_HANDLER(name) void req_##name( struct name##_request *req )
22 /* request functions */
25 extern void fatal_protocol_error( struct thread
*thread
,
26 const char *err
, ... ) __attribute__((format (printf
,2,3)));
28 extern void fatal_protocol_error( struct thread
*thread
, const char *err
, ... );
31 extern void read_request( struct thread
*thread
);
32 extern int write_request( struct thread
*thread
);
33 extern void set_reply_fd( struct thread
*thread
, int pass_fd
);
34 extern void send_reply( struct thread
*thread
);
35 extern void open_master_socket(void);
36 extern void close_master_socket(void);
37 extern void lock_master_socket( int locked
);
39 extern void trace_request( enum request req
);
40 extern void trace_reply( struct thread
*thread
);
42 /* get the request buffer */
43 static inline void *get_req_ptr( struct thread
*thread
)
45 return thread
->buffer
;
48 /* get the remaining size in the request buffer for object of a given size */
49 static inline int get_req_size( const void *req
, const void *ptr
, size_t typesize
)
51 return ((char *)req
+ MAX_REQUEST_LENGTH
- (char *)ptr
) / typesize
;
54 /* get the length of a request string, without going past the end of the request */
55 static inline size_t get_req_strlen( const void *req
, const char *str
)
58 while (*p
&& (p
< (char *)req
+ MAX_REQUEST_LENGTH
- 1)) p
++;
62 /* same as above for Unicode */
63 static inline size_t get_req_strlenW( const void *req
, const WCHAR
*str
)
66 while (*p
&& (p
< (WCHAR
*)req
+ MAX_REQUEST_LENGTH
/sizeof(WCHAR
) - 1)) p
++;
70 /* Everything below this line is generated automatically by tools/make_requests */
71 /* ### make_requests begin ### */
73 DECL_HANDLER(new_process
);
74 DECL_HANDLER(wait_process
);
75 DECL_HANDLER(new_thread
);
76 DECL_HANDLER(boot_done
);
77 DECL_HANDLER(init_process
);
78 DECL_HANDLER(init_process_done
);
79 DECL_HANDLER(init_thread
);
80 DECL_HANDLER(get_thread_buffer
);
81 DECL_HANDLER(terminate_process
);
82 DECL_HANDLER(terminate_thread
);
83 DECL_HANDLER(get_process_info
);
84 DECL_HANDLER(set_process_info
);
85 DECL_HANDLER(get_thread_info
);
86 DECL_HANDLER(set_thread_info
);
87 DECL_HANDLER(suspend_thread
);
88 DECL_HANDLER(resume_thread
);
89 DECL_HANDLER(load_dll
);
90 DECL_HANDLER(unload_dll
);
91 DECL_HANDLER(queue_apc
);
92 DECL_HANDLER(get_apcs
);
93 DECL_HANDLER(close_handle
);
94 DECL_HANDLER(get_handle_info
);
95 DECL_HANDLER(set_handle_info
);
96 DECL_HANDLER(dup_handle
);
97 DECL_HANDLER(open_process
);
99 DECL_HANDLER(create_event
);
100 DECL_HANDLER(event_op
);
101 DECL_HANDLER(open_event
);
102 DECL_HANDLER(create_mutex
);
103 DECL_HANDLER(release_mutex
);
104 DECL_HANDLER(open_mutex
);
105 DECL_HANDLER(create_semaphore
);
106 DECL_HANDLER(release_semaphore
);
107 DECL_HANDLER(open_semaphore
);
108 DECL_HANDLER(create_file
);
109 DECL_HANDLER(alloc_file_handle
);
110 DECL_HANDLER(get_read_fd
);
111 DECL_HANDLER(get_write_fd
);
112 DECL_HANDLER(set_file_pointer
);
113 DECL_HANDLER(truncate_file
);
114 DECL_HANDLER(set_file_time
);
115 DECL_HANDLER(flush_file
);
116 DECL_HANDLER(get_file_info
);
117 DECL_HANDLER(lock_file
);
118 DECL_HANDLER(unlock_file
);
119 DECL_HANDLER(create_pipe
);
120 DECL_HANDLER(create_socket
);
121 DECL_HANDLER(accept_socket
);
122 DECL_HANDLER(set_socket_event
);
123 DECL_HANDLER(get_socket_event
);
124 DECL_HANDLER(enable_socket_event
);
125 DECL_HANDLER(alloc_console
);
126 DECL_HANDLER(free_console
);
127 DECL_HANDLER(open_console
);
128 DECL_HANDLER(set_console_fd
);
129 DECL_HANDLER(get_console_mode
);
130 DECL_HANDLER(set_console_mode
);
131 DECL_HANDLER(set_console_info
);
132 DECL_HANDLER(get_console_info
);
133 DECL_HANDLER(write_console_input
);
134 DECL_HANDLER(read_console_input
);
135 DECL_HANDLER(create_change_notification
);
136 DECL_HANDLER(create_mapping
);
137 DECL_HANDLER(open_mapping
);
138 DECL_HANDLER(get_mapping_info
);
139 DECL_HANDLER(create_device
);
140 DECL_HANDLER(create_snapshot
);
141 DECL_HANDLER(next_process
);
142 DECL_HANDLER(next_thread
);
143 DECL_HANDLER(next_module
);
144 DECL_HANDLER(wait_debug_event
);
145 DECL_HANDLER(exception_event
);
146 DECL_HANDLER(output_debug_string
);
147 DECL_HANDLER(continue_debug_event
);
148 DECL_HANDLER(debug_process
);
149 DECL_HANDLER(read_process_memory
);
150 DECL_HANDLER(write_process_memory
);
151 DECL_HANDLER(create_key
);
152 DECL_HANDLER(open_key
);
153 DECL_HANDLER(delete_key
);
154 DECL_HANDLER(close_key
);
155 DECL_HANDLER(enum_key
);
156 DECL_HANDLER(query_key_info
);
157 DECL_HANDLER(set_key_value
);
158 DECL_HANDLER(get_key_value
);
159 DECL_HANDLER(enum_key_value
);
160 DECL_HANDLER(delete_key_value
);
161 DECL_HANDLER(load_registry
);
162 DECL_HANDLER(save_registry
);
163 DECL_HANDLER(save_registry_atexit
);
164 DECL_HANDLER(set_registry_levels
);
165 DECL_HANDLER(create_timer
);
166 DECL_HANDLER(open_timer
);
167 DECL_HANDLER(set_timer
);
168 DECL_HANDLER(cancel_timer
);
169 DECL_HANDLER(get_thread_context
);
170 DECL_HANDLER(set_thread_context
);
171 DECL_HANDLER(get_selector_entry
);
172 DECL_HANDLER(add_atom
);
173 DECL_HANDLER(delete_atom
);
174 DECL_HANDLER(find_atom
);
175 DECL_HANDLER(get_atom_name
);
176 DECL_HANDLER(init_atom_table
);
177 DECL_HANDLER(get_msg_queue
);
178 DECL_HANDLER(wake_queue
);
179 DECL_HANDLER(wait_input_idle
);
181 #ifdef WANT_REQUEST_HANDLERS
183 typedef void (*req_handler
)( void *req
);
184 static const req_handler req_handlers
[REQ_NB_REQUESTS
] =
186 (req_handler
)req_new_process
,
187 (req_handler
)req_wait_process
,
188 (req_handler
)req_new_thread
,
189 (req_handler
)req_boot_done
,
190 (req_handler
)req_init_process
,
191 (req_handler
)req_init_process_done
,
192 (req_handler
)req_init_thread
,
193 (req_handler
)req_get_thread_buffer
,
194 (req_handler
)req_terminate_process
,
195 (req_handler
)req_terminate_thread
,
196 (req_handler
)req_get_process_info
,
197 (req_handler
)req_set_process_info
,
198 (req_handler
)req_get_thread_info
,
199 (req_handler
)req_set_thread_info
,
200 (req_handler
)req_suspend_thread
,
201 (req_handler
)req_resume_thread
,
202 (req_handler
)req_load_dll
,
203 (req_handler
)req_unload_dll
,
204 (req_handler
)req_queue_apc
,
205 (req_handler
)req_get_apcs
,
206 (req_handler
)req_close_handle
,
207 (req_handler
)req_get_handle_info
,
208 (req_handler
)req_set_handle_info
,
209 (req_handler
)req_dup_handle
,
210 (req_handler
)req_open_process
,
211 (req_handler
)req_select
,
212 (req_handler
)req_create_event
,
213 (req_handler
)req_event_op
,
214 (req_handler
)req_open_event
,
215 (req_handler
)req_create_mutex
,
216 (req_handler
)req_release_mutex
,
217 (req_handler
)req_open_mutex
,
218 (req_handler
)req_create_semaphore
,
219 (req_handler
)req_release_semaphore
,
220 (req_handler
)req_open_semaphore
,
221 (req_handler
)req_create_file
,
222 (req_handler
)req_alloc_file_handle
,
223 (req_handler
)req_get_read_fd
,
224 (req_handler
)req_get_write_fd
,
225 (req_handler
)req_set_file_pointer
,
226 (req_handler
)req_truncate_file
,
227 (req_handler
)req_set_file_time
,
228 (req_handler
)req_flush_file
,
229 (req_handler
)req_get_file_info
,
230 (req_handler
)req_lock_file
,
231 (req_handler
)req_unlock_file
,
232 (req_handler
)req_create_pipe
,
233 (req_handler
)req_create_socket
,
234 (req_handler
)req_accept_socket
,
235 (req_handler
)req_set_socket_event
,
236 (req_handler
)req_get_socket_event
,
237 (req_handler
)req_enable_socket_event
,
238 (req_handler
)req_alloc_console
,
239 (req_handler
)req_free_console
,
240 (req_handler
)req_open_console
,
241 (req_handler
)req_set_console_fd
,
242 (req_handler
)req_get_console_mode
,
243 (req_handler
)req_set_console_mode
,
244 (req_handler
)req_set_console_info
,
245 (req_handler
)req_get_console_info
,
246 (req_handler
)req_write_console_input
,
247 (req_handler
)req_read_console_input
,
248 (req_handler
)req_create_change_notification
,
249 (req_handler
)req_create_mapping
,
250 (req_handler
)req_open_mapping
,
251 (req_handler
)req_get_mapping_info
,
252 (req_handler
)req_create_device
,
253 (req_handler
)req_create_snapshot
,
254 (req_handler
)req_next_process
,
255 (req_handler
)req_next_thread
,
256 (req_handler
)req_next_module
,
257 (req_handler
)req_wait_debug_event
,
258 (req_handler
)req_exception_event
,
259 (req_handler
)req_output_debug_string
,
260 (req_handler
)req_continue_debug_event
,
261 (req_handler
)req_debug_process
,
262 (req_handler
)req_read_process_memory
,
263 (req_handler
)req_write_process_memory
,
264 (req_handler
)req_create_key
,
265 (req_handler
)req_open_key
,
266 (req_handler
)req_delete_key
,
267 (req_handler
)req_close_key
,
268 (req_handler
)req_enum_key
,
269 (req_handler
)req_query_key_info
,
270 (req_handler
)req_set_key_value
,
271 (req_handler
)req_get_key_value
,
272 (req_handler
)req_enum_key_value
,
273 (req_handler
)req_delete_key_value
,
274 (req_handler
)req_load_registry
,
275 (req_handler
)req_save_registry
,
276 (req_handler
)req_save_registry_atexit
,
277 (req_handler
)req_set_registry_levels
,
278 (req_handler
)req_create_timer
,
279 (req_handler
)req_open_timer
,
280 (req_handler
)req_set_timer
,
281 (req_handler
)req_cancel_timer
,
282 (req_handler
)req_get_thread_context
,
283 (req_handler
)req_set_thread_context
,
284 (req_handler
)req_get_selector_entry
,
285 (req_handler
)req_add_atom
,
286 (req_handler
)req_delete_atom
,
287 (req_handler
)req_find_atom
,
288 (req_handler
)req_get_atom_name
,
289 (req_handler
)req_init_atom_table
,
290 (req_handler
)req_get_msg_queue
,
291 (req_handler
)req_wake_queue
,
292 (req_handler
)req_wait_input_idle
,
294 #endif /* WANT_REQUEST_HANDLERS */
296 /* ### make_requests end ### */
297 /* Everything above this line is generated automatically by tools/make_requests */
299 #endif /* __WINE_SERVER_REQUEST_H */