Fixed memory leak.
[wine/multimedia.git] / server / request.h
blobee18ecbb7f8f3b5efcaa7d8ce47e424cb2e3728a
1 /*
2 * Wine server requests
4 * Copyright (C) 1999 Alexandre Julliard
5 */
7 #ifndef __WINE_SERVER_REQUEST_H
8 #define __WINE_SERVER_REQUEST_H
10 #include <assert.h>
12 #include "thread.h"
13 #include "wine/server_protocol.h"
15 /* max request length */
16 #define MAX_REQUEST_LENGTH 8192
18 /* request handler definition */
19 #define DECL_HANDLER(name) \
20 void req_##name( const struct name##_request *req, struct name##_reply *reply )
22 /* request functions */
24 #ifdef __GNUC__
25 extern void fatal_protocol_error( struct thread *thread,
26 const char *err, ... ) __attribute__((format (printf,2,3)));
27 extern void fatal_protocol_perror( struct thread *thread,
28 const char *err, ... ) __attribute__((format (printf,2,3)));
29 extern void fatal_error( const char *err, ... ) __attribute__((noreturn,format(printf,1,2)));
30 extern void fatal_perror( const char *err, ... ) __attribute__((noreturn,format(printf,1,2)));
31 #else
32 extern void fatal_protocol_error( struct thread *thread, const char *err, ... );
33 extern void fatal_protocol_perror( struct thread *thread, const char *err, ... );
34 extern void fatal_error( const char *err, ... );
35 extern void fatal_perror( const char *err, ... );
36 #endif
38 extern const char *get_config_dir(void);
39 extern void *set_reply_data_size( size_t size );
40 extern int receive_fd( struct process *process );
41 extern int send_client_fd( struct process *process, int fd, handle_t handle );
42 extern void read_request( struct thread *thread );
43 extern void write_reply( struct thread *thread );
44 extern unsigned int get_tick_count(void);
45 extern void open_master_socket(void);
46 extern void close_master_socket(void);
47 extern void lock_master_socket( int locked );
49 extern void trace_request(void);
50 extern void trace_reply( enum request req, const union generic_reply *reply );
52 /* get the request vararg data */
53 inline static const void *get_req_data(void)
55 return current->req_data;
58 /* get the request vararg size */
59 inline static size_t get_req_data_size(void)
61 return current->req.request_header.request_size;
64 /* get the reply maximum vararg size */
65 inline static size_t get_reply_max_size(void)
67 return current->req.request_header.reply_size;
70 /* allocate and fill the reply data */
71 inline static void *set_reply_data( const void *data, size_t size )
73 void *ret = set_reply_data_size( size );
74 if (ret) memcpy( ret, data, size );
75 return ret;
78 /* set the reply data pointer directly (will be freed by request code) */
79 inline static void set_reply_data_ptr( void *data, size_t size )
81 assert( size <= get_reply_max_size() );
82 current->reply_size = size;
83 current->reply_data = data;
87 /* Everything below this line is generated automatically by tools/make_requests */
88 /* ### make_requests begin ### */
90 DECL_HANDLER(new_process);
91 DECL_HANDLER(get_new_process_info);
92 DECL_HANDLER(new_thread);
93 DECL_HANDLER(boot_done);
94 DECL_HANDLER(init_process);
95 DECL_HANDLER(init_process_done);
96 DECL_HANDLER(init_thread);
97 DECL_HANDLER(terminate_process);
98 DECL_HANDLER(terminate_thread);
99 DECL_HANDLER(get_process_info);
100 DECL_HANDLER(set_process_info);
101 DECL_HANDLER(get_thread_info);
102 DECL_HANDLER(set_thread_info);
103 DECL_HANDLER(suspend_thread);
104 DECL_HANDLER(resume_thread);
105 DECL_HANDLER(load_dll);
106 DECL_HANDLER(unload_dll);
107 DECL_HANDLER(queue_apc);
108 DECL_HANDLER(get_apc);
109 DECL_HANDLER(close_handle);
110 DECL_HANDLER(set_handle_info);
111 DECL_HANDLER(dup_handle);
112 DECL_HANDLER(open_process);
113 DECL_HANDLER(select);
114 DECL_HANDLER(create_event);
115 DECL_HANDLER(event_op);
116 DECL_HANDLER(open_event);
117 DECL_HANDLER(create_mutex);
118 DECL_HANDLER(release_mutex);
119 DECL_HANDLER(open_mutex);
120 DECL_HANDLER(create_semaphore);
121 DECL_HANDLER(release_semaphore);
122 DECL_HANDLER(open_semaphore);
123 DECL_HANDLER(create_file);
124 DECL_HANDLER(alloc_file_handle);
125 DECL_HANDLER(get_handle_fd);
126 DECL_HANDLER(set_file_pointer);
127 DECL_HANDLER(truncate_file);
128 DECL_HANDLER(set_file_time);
129 DECL_HANDLER(flush_file);
130 DECL_HANDLER(get_file_info);
131 DECL_HANDLER(lock_file);
132 DECL_HANDLER(unlock_file);
133 DECL_HANDLER(create_pipe);
134 DECL_HANDLER(create_socket);
135 DECL_HANDLER(accept_socket);
136 DECL_HANDLER(set_socket_event);
137 DECL_HANDLER(get_socket_event);
138 DECL_HANDLER(enable_socket_event);
139 DECL_HANDLER(alloc_console);
140 DECL_HANDLER(free_console);
141 DECL_HANDLER(get_console_renderer_events);
142 DECL_HANDLER(open_console);
143 DECL_HANDLER(get_console_mode);
144 DECL_HANDLER(set_console_mode);
145 DECL_HANDLER(set_console_input_info);
146 DECL_HANDLER(get_console_input_info);
147 DECL_HANDLER(append_console_input_history);
148 DECL_HANDLER(get_console_input_history);
149 DECL_HANDLER(create_console_output);
150 DECL_HANDLER(set_console_output_info);
151 DECL_HANDLER(get_console_output_info);
152 DECL_HANDLER(write_console_input);
153 DECL_HANDLER(read_console_input);
154 DECL_HANDLER(write_console_output);
155 DECL_HANDLER(fill_console_output);
156 DECL_HANDLER(read_console_output);
157 DECL_HANDLER(move_console_output);
158 DECL_HANDLER(create_change_notification);
159 DECL_HANDLER(create_mapping);
160 DECL_HANDLER(open_mapping);
161 DECL_HANDLER(get_mapping_info);
162 DECL_HANDLER(create_device);
163 DECL_HANDLER(create_snapshot);
164 DECL_HANDLER(next_process);
165 DECL_HANDLER(next_thread);
166 DECL_HANDLER(next_module);
167 DECL_HANDLER(wait_debug_event);
168 DECL_HANDLER(queue_exception_event);
169 DECL_HANDLER(get_exception_status);
170 DECL_HANDLER(output_debug_string);
171 DECL_HANDLER(continue_debug_event);
172 DECL_HANDLER(debug_process);
173 DECL_HANDLER(read_process_memory);
174 DECL_HANDLER(write_process_memory);
175 DECL_HANDLER(create_key);
176 DECL_HANDLER(open_key);
177 DECL_HANDLER(delete_key);
178 DECL_HANDLER(enum_key);
179 DECL_HANDLER(set_key_value);
180 DECL_HANDLER(get_key_value);
181 DECL_HANDLER(enum_key_value);
182 DECL_HANDLER(delete_key_value);
183 DECL_HANDLER(load_registry);
184 DECL_HANDLER(save_registry);
185 DECL_HANDLER(save_registry_atexit);
186 DECL_HANDLER(set_registry_levels);
187 DECL_HANDLER(create_timer);
188 DECL_HANDLER(open_timer);
189 DECL_HANDLER(set_timer);
190 DECL_HANDLER(cancel_timer);
191 DECL_HANDLER(get_thread_context);
192 DECL_HANDLER(set_thread_context);
193 DECL_HANDLER(get_selector_entry);
194 DECL_HANDLER(add_atom);
195 DECL_HANDLER(delete_atom);
196 DECL_HANDLER(find_atom);
197 DECL_HANDLER(get_atom_name);
198 DECL_HANDLER(init_atom_table);
199 DECL_HANDLER(get_msg_queue);
200 DECL_HANDLER(set_queue_mask);
201 DECL_HANDLER(get_queue_status);
202 DECL_HANDLER(wait_input_idle);
203 DECL_HANDLER(send_message);
204 DECL_HANDLER(get_message);
205 DECL_HANDLER(reply_message);
206 DECL_HANDLER(get_message_reply);
207 DECL_HANDLER(set_win_timer);
208 DECL_HANDLER(kill_win_timer);
209 DECL_HANDLER(create_serial);
210 DECL_HANDLER(get_serial_info);
211 DECL_HANDLER(set_serial_info);
212 DECL_HANDLER(register_async);
213 DECL_HANDLER(create_named_pipe);
214 DECL_HANDLER(open_named_pipe);
215 DECL_HANDLER(connect_named_pipe);
216 DECL_HANDLER(wait_named_pipe);
217 DECL_HANDLER(disconnect_named_pipe);
218 DECL_HANDLER(get_named_pipe_info);
219 DECL_HANDLER(create_window);
220 DECL_HANDLER(link_window);
221 DECL_HANDLER(destroy_window);
222 DECL_HANDLER(set_window_owner);
223 DECL_HANDLER(get_window_info);
224 DECL_HANDLER(set_window_info);
225 DECL_HANDLER(get_window_parents);
226 DECL_HANDLER(get_window_children);
227 DECL_HANDLER(get_window_tree);
228 DECL_HANDLER(set_window_rectangles);
229 DECL_HANDLER(get_window_rectangles);
230 DECL_HANDLER(get_window_text);
231 DECL_HANDLER(set_window_text);
232 DECL_HANDLER(inc_window_paint_count);
233 DECL_HANDLER(get_windows_offset);
234 DECL_HANDLER(set_window_property);
235 DECL_HANDLER(remove_window_property);
236 DECL_HANDLER(get_window_property);
237 DECL_HANDLER(get_window_properties);
239 #ifdef WANT_REQUEST_HANDLERS
241 typedef void (*req_handler)( const void *req, void *reply );
242 static const req_handler req_handlers[REQ_NB_REQUESTS] =
244 (req_handler)req_new_process,
245 (req_handler)req_get_new_process_info,
246 (req_handler)req_new_thread,
247 (req_handler)req_boot_done,
248 (req_handler)req_init_process,
249 (req_handler)req_init_process_done,
250 (req_handler)req_init_thread,
251 (req_handler)req_terminate_process,
252 (req_handler)req_terminate_thread,
253 (req_handler)req_get_process_info,
254 (req_handler)req_set_process_info,
255 (req_handler)req_get_thread_info,
256 (req_handler)req_set_thread_info,
257 (req_handler)req_suspend_thread,
258 (req_handler)req_resume_thread,
259 (req_handler)req_load_dll,
260 (req_handler)req_unload_dll,
261 (req_handler)req_queue_apc,
262 (req_handler)req_get_apc,
263 (req_handler)req_close_handle,
264 (req_handler)req_set_handle_info,
265 (req_handler)req_dup_handle,
266 (req_handler)req_open_process,
267 (req_handler)req_select,
268 (req_handler)req_create_event,
269 (req_handler)req_event_op,
270 (req_handler)req_open_event,
271 (req_handler)req_create_mutex,
272 (req_handler)req_release_mutex,
273 (req_handler)req_open_mutex,
274 (req_handler)req_create_semaphore,
275 (req_handler)req_release_semaphore,
276 (req_handler)req_open_semaphore,
277 (req_handler)req_create_file,
278 (req_handler)req_alloc_file_handle,
279 (req_handler)req_get_handle_fd,
280 (req_handler)req_set_file_pointer,
281 (req_handler)req_truncate_file,
282 (req_handler)req_set_file_time,
283 (req_handler)req_flush_file,
284 (req_handler)req_get_file_info,
285 (req_handler)req_lock_file,
286 (req_handler)req_unlock_file,
287 (req_handler)req_create_pipe,
288 (req_handler)req_create_socket,
289 (req_handler)req_accept_socket,
290 (req_handler)req_set_socket_event,
291 (req_handler)req_get_socket_event,
292 (req_handler)req_enable_socket_event,
293 (req_handler)req_alloc_console,
294 (req_handler)req_free_console,
295 (req_handler)req_get_console_renderer_events,
296 (req_handler)req_open_console,
297 (req_handler)req_get_console_mode,
298 (req_handler)req_set_console_mode,
299 (req_handler)req_set_console_input_info,
300 (req_handler)req_get_console_input_info,
301 (req_handler)req_append_console_input_history,
302 (req_handler)req_get_console_input_history,
303 (req_handler)req_create_console_output,
304 (req_handler)req_set_console_output_info,
305 (req_handler)req_get_console_output_info,
306 (req_handler)req_write_console_input,
307 (req_handler)req_read_console_input,
308 (req_handler)req_write_console_output,
309 (req_handler)req_fill_console_output,
310 (req_handler)req_read_console_output,
311 (req_handler)req_move_console_output,
312 (req_handler)req_create_change_notification,
313 (req_handler)req_create_mapping,
314 (req_handler)req_open_mapping,
315 (req_handler)req_get_mapping_info,
316 (req_handler)req_create_device,
317 (req_handler)req_create_snapshot,
318 (req_handler)req_next_process,
319 (req_handler)req_next_thread,
320 (req_handler)req_next_module,
321 (req_handler)req_wait_debug_event,
322 (req_handler)req_queue_exception_event,
323 (req_handler)req_get_exception_status,
324 (req_handler)req_output_debug_string,
325 (req_handler)req_continue_debug_event,
326 (req_handler)req_debug_process,
327 (req_handler)req_read_process_memory,
328 (req_handler)req_write_process_memory,
329 (req_handler)req_create_key,
330 (req_handler)req_open_key,
331 (req_handler)req_delete_key,
332 (req_handler)req_enum_key,
333 (req_handler)req_set_key_value,
334 (req_handler)req_get_key_value,
335 (req_handler)req_enum_key_value,
336 (req_handler)req_delete_key_value,
337 (req_handler)req_load_registry,
338 (req_handler)req_save_registry,
339 (req_handler)req_save_registry_atexit,
340 (req_handler)req_set_registry_levels,
341 (req_handler)req_create_timer,
342 (req_handler)req_open_timer,
343 (req_handler)req_set_timer,
344 (req_handler)req_cancel_timer,
345 (req_handler)req_get_thread_context,
346 (req_handler)req_set_thread_context,
347 (req_handler)req_get_selector_entry,
348 (req_handler)req_add_atom,
349 (req_handler)req_delete_atom,
350 (req_handler)req_find_atom,
351 (req_handler)req_get_atom_name,
352 (req_handler)req_init_atom_table,
353 (req_handler)req_get_msg_queue,
354 (req_handler)req_set_queue_mask,
355 (req_handler)req_get_queue_status,
356 (req_handler)req_wait_input_idle,
357 (req_handler)req_send_message,
358 (req_handler)req_get_message,
359 (req_handler)req_reply_message,
360 (req_handler)req_get_message_reply,
361 (req_handler)req_set_win_timer,
362 (req_handler)req_kill_win_timer,
363 (req_handler)req_create_serial,
364 (req_handler)req_get_serial_info,
365 (req_handler)req_set_serial_info,
366 (req_handler)req_register_async,
367 (req_handler)req_create_named_pipe,
368 (req_handler)req_open_named_pipe,
369 (req_handler)req_connect_named_pipe,
370 (req_handler)req_wait_named_pipe,
371 (req_handler)req_disconnect_named_pipe,
372 (req_handler)req_get_named_pipe_info,
373 (req_handler)req_create_window,
374 (req_handler)req_link_window,
375 (req_handler)req_destroy_window,
376 (req_handler)req_set_window_owner,
377 (req_handler)req_get_window_info,
378 (req_handler)req_set_window_info,
379 (req_handler)req_get_window_parents,
380 (req_handler)req_get_window_children,
381 (req_handler)req_get_window_tree,
382 (req_handler)req_set_window_rectangles,
383 (req_handler)req_get_window_rectangles,
384 (req_handler)req_get_window_text,
385 (req_handler)req_set_window_text,
386 (req_handler)req_inc_window_paint_count,
387 (req_handler)req_get_windows_offset,
388 (req_handler)req_set_window_property,
389 (req_handler)req_remove_window_property,
390 (req_handler)req_get_window_property,
391 (req_handler)req_get_window_properties,
393 #endif /* WANT_REQUEST_HANDLERS */
395 /* ### make_requests end ### */
396 /* Everything above this line is generated automatically by tools/make_requests */
398 #endif /* __WINE_SERVER_REQUEST_H */