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
);
177 #ifdef WANT_REQUEST_HANDLERS
179 typedef void (*req_handler
)( void *req
);
180 static const req_handler req_handlers
[REQ_NB_REQUESTS
] =
182 (req_handler
)req_new_process
,
183 (req_handler
)req_wait_process
,
184 (req_handler
)req_new_thread
,
185 (req_handler
)req_boot_done
,
186 (req_handler
)req_init_process
,
187 (req_handler
)req_init_process_done
,
188 (req_handler
)req_init_thread
,
189 (req_handler
)req_get_thread_buffer
,
190 (req_handler
)req_terminate_process
,
191 (req_handler
)req_terminate_thread
,
192 (req_handler
)req_get_process_info
,
193 (req_handler
)req_set_process_info
,
194 (req_handler
)req_get_thread_info
,
195 (req_handler
)req_set_thread_info
,
196 (req_handler
)req_suspend_thread
,
197 (req_handler
)req_resume_thread
,
198 (req_handler
)req_load_dll
,
199 (req_handler
)req_unload_dll
,
200 (req_handler
)req_queue_apc
,
201 (req_handler
)req_get_apcs
,
202 (req_handler
)req_close_handle
,
203 (req_handler
)req_get_handle_info
,
204 (req_handler
)req_set_handle_info
,
205 (req_handler
)req_dup_handle
,
206 (req_handler
)req_open_process
,
207 (req_handler
)req_select
,
208 (req_handler
)req_create_event
,
209 (req_handler
)req_event_op
,
210 (req_handler
)req_open_event
,
211 (req_handler
)req_create_mutex
,
212 (req_handler
)req_release_mutex
,
213 (req_handler
)req_open_mutex
,
214 (req_handler
)req_create_semaphore
,
215 (req_handler
)req_release_semaphore
,
216 (req_handler
)req_open_semaphore
,
217 (req_handler
)req_create_file
,
218 (req_handler
)req_alloc_file_handle
,
219 (req_handler
)req_get_read_fd
,
220 (req_handler
)req_get_write_fd
,
221 (req_handler
)req_set_file_pointer
,
222 (req_handler
)req_truncate_file
,
223 (req_handler
)req_set_file_time
,
224 (req_handler
)req_flush_file
,
225 (req_handler
)req_get_file_info
,
226 (req_handler
)req_lock_file
,
227 (req_handler
)req_unlock_file
,
228 (req_handler
)req_create_pipe
,
229 (req_handler
)req_create_socket
,
230 (req_handler
)req_accept_socket
,
231 (req_handler
)req_set_socket_event
,
232 (req_handler
)req_get_socket_event
,
233 (req_handler
)req_enable_socket_event
,
234 (req_handler
)req_alloc_console
,
235 (req_handler
)req_free_console
,
236 (req_handler
)req_open_console
,
237 (req_handler
)req_set_console_fd
,
238 (req_handler
)req_get_console_mode
,
239 (req_handler
)req_set_console_mode
,
240 (req_handler
)req_set_console_info
,
241 (req_handler
)req_get_console_info
,
242 (req_handler
)req_write_console_input
,
243 (req_handler
)req_read_console_input
,
244 (req_handler
)req_create_change_notification
,
245 (req_handler
)req_create_mapping
,
246 (req_handler
)req_open_mapping
,
247 (req_handler
)req_get_mapping_info
,
248 (req_handler
)req_create_device
,
249 (req_handler
)req_create_snapshot
,
250 (req_handler
)req_next_process
,
251 (req_handler
)req_next_thread
,
252 (req_handler
)req_next_module
,
253 (req_handler
)req_wait_debug_event
,
254 (req_handler
)req_exception_event
,
255 (req_handler
)req_output_debug_string
,
256 (req_handler
)req_continue_debug_event
,
257 (req_handler
)req_debug_process
,
258 (req_handler
)req_read_process_memory
,
259 (req_handler
)req_write_process_memory
,
260 (req_handler
)req_create_key
,
261 (req_handler
)req_open_key
,
262 (req_handler
)req_delete_key
,
263 (req_handler
)req_close_key
,
264 (req_handler
)req_enum_key
,
265 (req_handler
)req_query_key_info
,
266 (req_handler
)req_set_key_value
,
267 (req_handler
)req_get_key_value
,
268 (req_handler
)req_enum_key_value
,
269 (req_handler
)req_delete_key_value
,
270 (req_handler
)req_load_registry
,
271 (req_handler
)req_save_registry
,
272 (req_handler
)req_save_registry_atexit
,
273 (req_handler
)req_set_registry_levels
,
274 (req_handler
)req_create_timer
,
275 (req_handler
)req_open_timer
,
276 (req_handler
)req_set_timer
,
277 (req_handler
)req_cancel_timer
,
278 (req_handler
)req_get_thread_context
,
279 (req_handler
)req_set_thread_context
,
280 (req_handler
)req_get_selector_entry
,
281 (req_handler
)req_add_atom
,
282 (req_handler
)req_delete_atom
,
283 (req_handler
)req_find_atom
,
284 (req_handler
)req_get_atom_name
,
286 #endif /* WANT_REQUEST_HANDLERS */
288 /* ### make_requests end ### */
289 /* Everything above this line is generated automatically by tools/make_requests */
291 #endif /* __WINE_SERVER_REQUEST_H */