Changed the initialisation of the KeyState array.
[wine] / server / trace.c
1 /*
2  * Server request tracing
3  *
4  * Copyright (C) 1999 Alexandre Julliard
5  */
6
7 #include <stdio.h>
8 #include <sys/types.h>
9 #include <sys/uio.h>
10 #include "winsock2.h"
11 #include "request.h"
12
13
14 /* dumping for functions for requests that have a variable part */
15
16 static void dump_varargs_select( struct select_request *req )
17 {
18     int i;
19     for (i = 0; i < req->count; i++)
20         fprintf( stderr, "%c%d", i ? ',' : '{', req->handles[i] );
21     fprintf( stderr, "}" );
22 }
23
24 static void dump_varargs_get_apcs( struct get_apcs_request *req )
25 {
26     int i;
27     for (i = 0; i < 2 * req->count; i++)
28         fprintf( stderr, "%c%p", i ? ',' : '{', req->apcs[i] );
29     fprintf( stderr, "}" );
30 }
31
32 static void dump_varargs_get_socket_event( struct get_socket_event_request *req )
33 {
34     int i;
35     for (i = 0; i < FD_MAX_EVENTS; i++)
36         fprintf( stderr, "%c%d", i ? ',' : '{', req->errors[i] );
37     fprintf( stderr, "}" );
38 }
39
40
41 typedef void (*dump_func)( const void *req );
42
43 /* Everything below this line is generated automatically by tools/make_requests */
44 /* ### make_requests begin ### */
45
46 static void dump_new_process_request( struct new_process_request *req )
47 {
48     fprintf( stderr, " inherit=%d,", req->inherit );
49     fprintf( stderr, " inherit_all=%d,", req->inherit_all );
50     fprintf( stderr, " create_flags=%d,", req->create_flags );
51     fprintf( stderr, " start_flags=%d,", req->start_flags );
52     fprintf( stderr, " hstdin=%d,", req->hstdin );
53     fprintf( stderr, " hstdout=%d,", req->hstdout );
54     fprintf( stderr, " hstderr=%d,", req->hstderr );
55     fprintf( stderr, " cmd_show=%d,", req->cmd_show );
56     fprintf( stderr, " env_ptr=%p,", req->env_ptr );
57     fprintf( stderr, " cmdline=\"%s\"", req->cmdline );
58 }
59
60 static void dump_new_process_reply( struct new_process_request *req )
61 {
62     fprintf( stderr, " pid=%p,", req->pid );
63     fprintf( stderr, " handle=%d", req->handle );
64 }
65
66 static void dump_new_thread_request( struct new_thread_request *req )
67 {
68     fprintf( stderr, " pid=%p,", req->pid );
69     fprintf( stderr, " suspend=%d,", req->suspend );
70     fprintf( stderr, " inherit=%d", req->inherit );
71 }
72
73 static void dump_new_thread_reply( struct new_thread_request *req )
74 {
75     fprintf( stderr, " tid=%p,", req->tid );
76     fprintf( stderr, " handle=%d", req->handle );
77 }
78
79 static void dump_set_debug_request( struct set_debug_request *req )
80 {
81     fprintf( stderr, " level=%d", req->level );
82 }
83
84 static void dump_init_process_request( struct init_process_request *req )
85 {
86 }
87
88 static void dump_init_process_reply( struct init_process_request *req )
89 {
90     fprintf( stderr, " start_flags=%d,", req->start_flags );
91     fprintf( stderr, " hstdin=%d,", req->hstdin );
92     fprintf( stderr, " hstdout=%d,", req->hstdout );
93     fprintf( stderr, " hstderr=%d,", req->hstderr );
94     fprintf( stderr, " cmd_show=%d,", req->cmd_show );
95     fprintf( stderr, " env_ptr=%p,", req->env_ptr );
96     fprintf( stderr, " cmdline=\"%s\"", req->cmdline );
97 }
98
99 static void dump_init_thread_request( struct init_thread_request *req )
100 {
101     fprintf( stderr, " unix_pid=%d,", req->unix_pid );
102     fprintf( stderr, " teb=%p", req->teb );
103 }
104
105 static void dump_init_thread_reply( struct init_thread_request *req )
106 {
107     fprintf( stderr, " pid=%p,", req->pid );
108     fprintf( stderr, " tid=%p", req->tid );
109 }
110
111 static void dump_get_thread_buffer_request( struct get_thread_buffer_request *req )
112 {
113     fprintf( stderr, " dummy=%d", req->dummy );
114 }
115
116 static void dump_terminate_process_request( struct terminate_process_request *req )
117 {
118     fprintf( stderr, " handle=%d,", req->handle );
119     fprintf( stderr, " exit_code=%d", req->exit_code );
120 }
121
122 static void dump_terminate_thread_request( struct terminate_thread_request *req )
123 {
124     fprintf( stderr, " handle=%d,", req->handle );
125     fprintf( stderr, " exit_code=%d", req->exit_code );
126 }
127
128 static void dump_get_process_info_request( struct get_process_info_request *req )
129 {
130     fprintf( stderr, " handle=%d", req->handle );
131 }
132
133 static void dump_get_process_info_reply( struct get_process_info_request *req )
134 {
135     fprintf( stderr, " pid=%p,", req->pid );
136     fprintf( stderr, " exit_code=%d,", req->exit_code );
137     fprintf( stderr, " priority=%d,", req->priority );
138     fprintf( stderr, " process_affinity=%d,", req->process_affinity );
139     fprintf( stderr, " system_affinity=%d", req->system_affinity );
140 }
141
142 static void dump_set_process_info_request( struct set_process_info_request *req )
143 {
144     fprintf( stderr, " handle=%d,", req->handle );
145     fprintf( stderr, " mask=%d,", req->mask );
146     fprintf( stderr, " priority=%d,", req->priority );
147     fprintf( stderr, " affinity=%d", req->affinity );
148 }
149
150 static void dump_get_thread_info_request( struct get_thread_info_request *req )
151 {
152     fprintf( stderr, " handle=%d", req->handle );
153 }
154
155 static void dump_get_thread_info_reply( struct get_thread_info_request *req )
156 {
157     fprintf( stderr, " tid=%p,", req->tid );
158     fprintf( stderr, " exit_code=%d,", req->exit_code );
159     fprintf( stderr, " priority=%d", req->priority );
160 }
161
162 static void dump_set_thread_info_request( struct set_thread_info_request *req )
163 {
164     fprintf( stderr, " handle=%d,", req->handle );
165     fprintf( stderr, " mask=%d,", req->mask );
166     fprintf( stderr, " priority=%d,", req->priority );
167     fprintf( stderr, " affinity=%d", req->affinity );
168 }
169
170 static void dump_suspend_thread_request( struct suspend_thread_request *req )
171 {
172     fprintf( stderr, " handle=%d", req->handle );
173 }
174
175 static void dump_suspend_thread_reply( struct suspend_thread_request *req )
176 {
177     fprintf( stderr, " count=%d", req->count );
178 }
179
180 static void dump_resume_thread_request( struct resume_thread_request *req )
181 {
182     fprintf( stderr, " handle=%d", req->handle );
183 }
184
185 static void dump_resume_thread_reply( struct resume_thread_request *req )
186 {
187     fprintf( stderr, " count=%d", req->count );
188 }
189
190 static void dump_debugger_request( struct debugger_request *req )
191 {
192     fprintf( stderr, " op=%d", req->op );
193 }
194
195 static void dump_queue_apc_request( struct queue_apc_request *req )
196 {
197     fprintf( stderr, " handle=%d,", req->handle );
198     fprintf( stderr, " func=%p,", req->func );
199     fprintf( stderr, " param=%p", req->param );
200 }
201
202 static void dump_get_apcs_request( struct get_apcs_request *req )
203 {
204 }
205
206 static void dump_get_apcs_reply( struct get_apcs_request *req )
207 {
208     fprintf( stderr, " count=%d,", req->count );
209     fprintf( stderr, " apcs=" );
210     dump_varargs_get_apcs( req );
211 }
212
213 static void dump_close_handle_request( struct close_handle_request *req )
214 {
215     fprintf( stderr, " handle=%d", req->handle );
216 }
217
218 static void dump_get_handle_info_request( struct get_handle_info_request *req )
219 {
220     fprintf( stderr, " handle=%d", req->handle );
221 }
222
223 static void dump_get_handle_info_reply( struct get_handle_info_request *req )
224 {
225     fprintf( stderr, " flags=%d", req->flags );
226 }
227
228 static void dump_set_handle_info_request( struct set_handle_info_request *req )
229 {
230     fprintf( stderr, " handle=%d,", req->handle );
231     fprintf( stderr, " flags=%d,", req->flags );
232     fprintf( stderr, " mask=%d", req->mask );
233 }
234
235 static void dump_dup_handle_request( struct dup_handle_request *req )
236 {
237     fprintf( stderr, " src_process=%d,", req->src_process );
238     fprintf( stderr, " src_handle=%d,", req->src_handle );
239     fprintf( stderr, " dst_process=%d,", req->dst_process );
240     fprintf( stderr, " access=%08x,", req->access );
241     fprintf( stderr, " inherit=%d,", req->inherit );
242     fprintf( stderr, " options=%d", req->options );
243 }
244
245 static void dump_dup_handle_reply( struct dup_handle_request *req )
246 {
247     fprintf( stderr, " handle=%d", req->handle );
248 }
249
250 static void dump_open_process_request( struct open_process_request *req )
251 {
252     fprintf( stderr, " pid=%p,", req->pid );
253     fprintf( stderr, " access=%08x,", req->access );
254     fprintf( stderr, " inherit=%d", req->inherit );
255 }
256
257 static void dump_open_process_reply( struct open_process_request *req )
258 {
259     fprintf( stderr, " handle=%d", req->handle );
260 }
261
262 static void dump_select_request( struct select_request *req )
263 {
264     fprintf( stderr, " count=%d,", req->count );
265     fprintf( stderr, " flags=%d,", req->flags );
266     fprintf( stderr, " timeout=%d,", req->timeout );
267     fprintf( stderr, " handles=" );
268     dump_varargs_select( req );
269 }
270
271 static void dump_select_reply( struct select_request *req )
272 {
273     fprintf( stderr, " signaled=%d", req->signaled );
274 }
275
276 static void dump_create_event_request( struct create_event_request *req )
277 {
278     fprintf( stderr, " manual_reset=%d,", req->manual_reset );
279     fprintf( stderr, " initial_state=%d,", req->initial_state );
280     fprintf( stderr, " inherit=%d,", req->inherit );
281     fprintf( stderr, " name=\"%s\"", req->name );
282 }
283
284 static void dump_create_event_reply( struct create_event_request *req )
285 {
286     fprintf( stderr, " handle=%d", req->handle );
287 }
288
289 static void dump_event_op_request( struct event_op_request *req )
290 {
291     fprintf( stderr, " handle=%d,", req->handle );
292     fprintf( stderr, " op=%d", req->op );
293 }
294
295 static void dump_open_event_request( struct open_event_request *req )
296 {
297     fprintf( stderr, " access=%08x,", req->access );
298     fprintf( stderr, " inherit=%d,", req->inherit );
299     fprintf( stderr, " name=\"%s\"", req->name );
300 }
301
302 static void dump_open_event_reply( struct open_event_request *req )
303 {
304     fprintf( stderr, " handle=%d", req->handle );
305 }
306
307 static void dump_create_mutex_request( struct create_mutex_request *req )
308 {
309     fprintf( stderr, " owned=%d,", req->owned );
310     fprintf( stderr, " inherit=%d,", req->inherit );
311     fprintf( stderr, " name=\"%s\"", req->name );
312 }
313
314 static void dump_create_mutex_reply( struct create_mutex_request *req )
315 {
316     fprintf( stderr, " handle=%d", req->handle );
317 }
318
319 static void dump_release_mutex_request( struct release_mutex_request *req )
320 {
321     fprintf( stderr, " handle=%d", req->handle );
322 }
323
324 static void dump_open_mutex_request( struct open_mutex_request *req )
325 {
326     fprintf( stderr, " access=%08x,", req->access );
327     fprintf( stderr, " inherit=%d,", req->inherit );
328     fprintf( stderr, " name=\"%s\"", req->name );
329 }
330
331 static void dump_open_mutex_reply( struct open_mutex_request *req )
332 {
333     fprintf( stderr, " handle=%d", req->handle );
334 }
335
336 static void dump_create_semaphore_request( struct create_semaphore_request *req )
337 {
338     fprintf( stderr, " initial=%08x,", req->initial );
339     fprintf( stderr, " max=%08x,", req->max );
340     fprintf( stderr, " inherit=%d,", req->inherit );
341     fprintf( stderr, " name=\"%s\"", req->name );
342 }
343
344 static void dump_create_semaphore_reply( struct create_semaphore_request *req )
345 {
346     fprintf( stderr, " handle=%d", req->handle );
347 }
348
349 static void dump_release_semaphore_request( struct release_semaphore_request *req )
350 {
351     fprintf( stderr, " handle=%d,", req->handle );
352     fprintf( stderr, " count=%08x", req->count );
353 }
354
355 static void dump_release_semaphore_reply( struct release_semaphore_request *req )
356 {
357     fprintf( stderr, " prev_count=%08x", req->prev_count );
358 }
359
360 static void dump_open_semaphore_request( struct open_semaphore_request *req )
361 {
362     fprintf( stderr, " access=%08x,", req->access );
363     fprintf( stderr, " inherit=%d,", req->inherit );
364     fprintf( stderr, " name=\"%s\"", req->name );
365 }
366
367 static void dump_open_semaphore_reply( struct open_semaphore_request *req )
368 {
369     fprintf( stderr, " handle=%d", req->handle );
370 }
371
372 static void dump_create_file_request( struct create_file_request *req )
373 {
374     fprintf( stderr, " access=%08x,", req->access );
375     fprintf( stderr, " inherit=%d,", req->inherit );
376     fprintf( stderr, " sharing=%08x,", req->sharing );
377     fprintf( stderr, " create=%d,", req->create );
378     fprintf( stderr, " attrs=%08x,", req->attrs );
379     fprintf( stderr, " name=\"%s\"", req->name );
380 }
381
382 static void dump_create_file_reply( struct create_file_request *req )
383 {
384     fprintf( stderr, " handle=%d", req->handle );
385 }
386
387 static void dump_alloc_file_handle_request( struct alloc_file_handle_request *req )
388 {
389     fprintf( stderr, " access=%08x", req->access );
390 }
391
392 static void dump_alloc_file_handle_reply( struct alloc_file_handle_request *req )
393 {
394     fprintf( stderr, " handle=%d", req->handle );
395 }
396
397 static void dump_get_read_fd_request( struct get_read_fd_request *req )
398 {
399     fprintf( stderr, " handle=%d", req->handle );
400 }
401
402 static void dump_get_write_fd_request( struct get_write_fd_request *req )
403 {
404     fprintf( stderr, " handle=%d", req->handle );
405 }
406
407 static void dump_set_file_pointer_request( struct set_file_pointer_request *req )
408 {
409     fprintf( stderr, " handle=%d,", req->handle );
410     fprintf( stderr, " low=%d,", req->low );
411     fprintf( stderr, " high=%d,", req->high );
412     fprintf( stderr, " whence=%d", req->whence );
413 }
414
415 static void dump_set_file_pointer_reply( struct set_file_pointer_request *req )
416 {
417     fprintf( stderr, " new_low=%d,", req->new_low );
418     fprintf( stderr, " new_high=%d", req->new_high );
419 }
420
421 static void dump_truncate_file_request( struct truncate_file_request *req )
422 {
423     fprintf( stderr, " handle=%d", req->handle );
424 }
425
426 static void dump_set_file_time_request( struct set_file_time_request *req )
427 {
428     fprintf( stderr, " handle=%d,", req->handle );
429     fprintf( stderr, " access_time=%ld,", req->access_time );
430     fprintf( stderr, " write_time=%ld", req->write_time );
431 }
432
433 static void dump_flush_file_request( struct flush_file_request *req )
434 {
435     fprintf( stderr, " handle=%d", req->handle );
436 }
437
438 static void dump_get_file_info_request( struct get_file_info_request *req )
439 {
440     fprintf( stderr, " handle=%d", req->handle );
441 }
442
443 static void dump_get_file_info_reply( struct get_file_info_request *req )
444 {
445     fprintf( stderr, " type=%d,", req->type );
446     fprintf( stderr, " attr=%d,", req->attr );
447     fprintf( stderr, " access_time=%ld,", req->access_time );
448     fprintf( stderr, " write_time=%ld,", req->write_time );
449     fprintf( stderr, " size_high=%d,", req->size_high );
450     fprintf( stderr, " size_low=%d,", req->size_low );
451     fprintf( stderr, " links=%d,", req->links );
452     fprintf( stderr, " index_high=%d,", req->index_high );
453     fprintf( stderr, " index_low=%d,", req->index_low );
454     fprintf( stderr, " serial=%08x", req->serial );
455 }
456
457 static void dump_lock_file_request( struct lock_file_request *req )
458 {
459     fprintf( stderr, " handle=%d,", req->handle );
460     fprintf( stderr, " offset_low=%08x,", req->offset_low );
461     fprintf( stderr, " offset_high=%08x,", req->offset_high );
462     fprintf( stderr, " count_low=%08x,", req->count_low );
463     fprintf( stderr, " count_high=%08x", req->count_high );
464 }
465
466 static void dump_unlock_file_request( struct unlock_file_request *req )
467 {
468     fprintf( stderr, " handle=%d,", req->handle );
469     fprintf( stderr, " offset_low=%08x,", req->offset_low );
470     fprintf( stderr, " offset_high=%08x,", req->offset_high );
471     fprintf( stderr, " count_low=%08x,", req->count_low );
472     fprintf( stderr, " count_high=%08x", req->count_high );
473 }
474
475 static void dump_create_pipe_request( struct create_pipe_request *req )
476 {
477     fprintf( stderr, " inherit=%d", req->inherit );
478 }
479
480 static void dump_create_pipe_reply( struct create_pipe_request *req )
481 {
482     fprintf( stderr, " handle_read=%d,", req->handle_read );
483     fprintf( stderr, " handle_write=%d", req->handle_write );
484 }
485
486 static void dump_create_socket_request( struct create_socket_request *req )
487 {
488     fprintf( stderr, " access=%08x,", req->access );
489     fprintf( stderr, " inherit=%d,", req->inherit );
490     fprintf( stderr, " family=%d,", req->family );
491     fprintf( stderr, " type=%d,", req->type );
492     fprintf( stderr, " protocol=%d", req->protocol );
493 }
494
495 static void dump_create_socket_reply( struct create_socket_request *req )
496 {
497     fprintf( stderr, " handle=%d", req->handle );
498 }
499
500 static void dump_accept_socket_request( struct accept_socket_request *req )
501 {
502     fprintf( stderr, " lhandle=%d,", req->lhandle );
503     fprintf( stderr, " access=%08x,", req->access );
504     fprintf( stderr, " inherit=%d", req->inherit );
505 }
506
507 static void dump_accept_socket_reply( struct accept_socket_request *req )
508 {
509     fprintf( stderr, " handle=%d", req->handle );
510 }
511
512 static void dump_set_socket_event_request( struct set_socket_event_request *req )
513 {
514     fprintf( stderr, " handle=%d,", req->handle );
515     fprintf( stderr, " mask=%08x,", req->mask );
516     fprintf( stderr, " event=%d", req->event );
517 }
518
519 static void dump_get_socket_event_request( struct get_socket_event_request *req )
520 {
521     fprintf( stderr, " handle=%d,", req->handle );
522     fprintf( stderr, " service=%d,", req->service );
523     fprintf( stderr, " s_event=%d", req->s_event );
524 }
525
526 static void dump_get_socket_event_reply( struct get_socket_event_request *req )
527 {
528     fprintf( stderr, " mask=%08x,", req->mask );
529     fprintf( stderr, " pmask=%08x,", req->pmask );
530     fprintf( stderr, " state=%08x,", req->state );
531     fprintf( stderr, " errors=" );
532     dump_varargs_get_socket_event( req );
533 }
534
535 static void dump_enable_socket_event_request( struct enable_socket_event_request *req )
536 {
537     fprintf( stderr, " handle=%d,", req->handle );
538     fprintf( stderr, " mask=%08x,", req->mask );
539     fprintf( stderr, " sstate=%08x,", req->sstate );
540     fprintf( stderr, " cstate=%08x", req->cstate );
541 }
542
543 static void dump_alloc_console_request( struct alloc_console_request *req )
544 {
545     fprintf( stderr, " access=%08x,", req->access );
546     fprintf( stderr, " inherit=%d", req->inherit );
547 }
548
549 static void dump_alloc_console_reply( struct alloc_console_request *req )
550 {
551     fprintf( stderr, " handle_in=%d,", req->handle_in );
552     fprintf( stderr, " handle_out=%d", req->handle_out );
553 }
554
555 static void dump_free_console_request( struct free_console_request *req )
556 {
557     fprintf( stderr, " dummy=%d", req->dummy );
558 }
559
560 static void dump_open_console_request( struct open_console_request *req )
561 {
562     fprintf( stderr, " output=%d,", req->output );
563     fprintf( stderr, " access=%08x,", req->access );
564     fprintf( stderr, " inherit=%d", req->inherit );
565 }
566
567 static void dump_open_console_reply( struct open_console_request *req )
568 {
569     fprintf( stderr, " handle=%d", req->handle );
570 }
571
572 static void dump_set_console_fd_request( struct set_console_fd_request *req )
573 {
574     fprintf( stderr, " handle=%d,", req->handle );
575     fprintf( stderr, " file_handle=%d,", req->file_handle );
576     fprintf( stderr, " pid=%d", req->pid );
577 }
578
579 static void dump_get_console_mode_request( struct get_console_mode_request *req )
580 {
581     fprintf( stderr, " handle=%d", req->handle );
582 }
583
584 static void dump_get_console_mode_reply( struct get_console_mode_request *req )
585 {
586     fprintf( stderr, " mode=%d", req->mode );
587 }
588
589 static void dump_set_console_mode_request( struct set_console_mode_request *req )
590 {
591     fprintf( stderr, " handle=%d,", req->handle );
592     fprintf( stderr, " mode=%d", req->mode );
593 }
594
595 static void dump_set_console_info_request( struct set_console_info_request *req )
596 {
597     fprintf( stderr, " handle=%d,", req->handle );
598     fprintf( stderr, " mask=%d,", req->mask );
599     fprintf( stderr, " cursor_size=%d,", req->cursor_size );
600     fprintf( stderr, " cursor_visible=%d,", req->cursor_visible );
601     fprintf( stderr, " title=\"%s\"", req->title );
602 }
603
604 static void dump_get_console_info_request( struct get_console_info_request *req )
605 {
606     fprintf( stderr, " handle=%d", req->handle );
607 }
608
609 static void dump_get_console_info_reply( struct get_console_info_request *req )
610 {
611     fprintf( stderr, " cursor_size=%d,", req->cursor_size );
612     fprintf( stderr, " cursor_visible=%d,", req->cursor_visible );
613     fprintf( stderr, " pid=%d,", req->pid );
614     fprintf( stderr, " title=\"%s\"", req->title );
615 }
616
617 static void dump_write_console_input_request( struct write_console_input_request *req )
618 {
619     fprintf( stderr, " handle=%d,", req->handle );
620     fprintf( stderr, " count=%d", req->count );
621 }
622
623 static void dump_write_console_input_reply( struct write_console_input_request *req )
624 {
625     fprintf( stderr, " written=%d", req->written );
626 }
627
628 static void dump_read_console_input_request( struct read_console_input_request *req )
629 {
630     fprintf( stderr, " handle=%d,", req->handle );
631     fprintf( stderr, " count=%d,", req->count );
632     fprintf( stderr, " flush=%d", req->flush );
633 }
634
635 static void dump_read_console_input_reply( struct read_console_input_request *req )
636 {
637     fprintf( stderr, " read=%d", req->read );
638 }
639
640 static void dump_create_change_notification_request( struct create_change_notification_request *req )
641 {
642     fprintf( stderr, " subtree=%d,", req->subtree );
643     fprintf( stderr, " filter=%d", req->filter );
644 }
645
646 static void dump_create_change_notification_reply( struct create_change_notification_request *req )
647 {
648     fprintf( stderr, " handle=%d", req->handle );
649 }
650
651 static void dump_create_mapping_request( struct create_mapping_request *req )
652 {
653     fprintf( stderr, " size_high=%d,", req->size_high );
654     fprintf( stderr, " size_low=%d,", req->size_low );
655     fprintf( stderr, " protect=%d,", req->protect );
656     fprintf( stderr, " inherit=%d,", req->inherit );
657     fprintf( stderr, " file_handle=%d,", req->file_handle );
658     fprintf( stderr, " name=\"%s\"", req->name );
659 }
660
661 static void dump_create_mapping_reply( struct create_mapping_request *req )
662 {
663     fprintf( stderr, " handle=%d", req->handle );
664 }
665
666 static void dump_open_mapping_request( struct open_mapping_request *req )
667 {
668     fprintf( stderr, " access=%08x,", req->access );
669     fprintf( stderr, " inherit=%d,", req->inherit );
670     fprintf( stderr, " name=\"%s\"", req->name );
671 }
672
673 static void dump_open_mapping_reply( struct open_mapping_request *req )
674 {
675     fprintf( stderr, " handle=%d", req->handle );
676 }
677
678 static void dump_get_mapping_info_request( struct get_mapping_info_request *req )
679 {
680     fprintf( stderr, " handle=%d", req->handle );
681 }
682
683 static void dump_get_mapping_info_reply( struct get_mapping_info_request *req )
684 {
685     fprintf( stderr, " size_high=%d,", req->size_high );
686     fprintf( stderr, " size_low=%d,", req->size_low );
687     fprintf( stderr, " protect=%d", req->protect );
688 }
689
690 static void dump_create_device_request( struct create_device_request *req )
691 {
692     fprintf( stderr, " access=%08x,", req->access );
693     fprintf( stderr, " inherit=%d,", req->inherit );
694     fprintf( stderr, " id=%d", req->id );
695 }
696
697 static void dump_create_device_reply( struct create_device_request *req )
698 {
699     fprintf( stderr, " handle=%d", req->handle );
700 }
701
702 static void dump_create_snapshot_request( struct create_snapshot_request *req )
703 {
704     fprintf( stderr, " inherit=%d,", req->inherit );
705     fprintf( stderr, " flags=%d", req->flags );
706 }
707
708 static void dump_create_snapshot_reply( struct create_snapshot_request *req )
709 {
710     fprintf( stderr, " handle=%d", req->handle );
711 }
712
713 static void dump_next_process_request( struct next_process_request *req )
714 {
715     fprintf( stderr, " handle=%d,", req->handle );
716     fprintf( stderr, " reset=%d", req->reset );
717 }
718
719 static void dump_next_process_reply( struct next_process_request *req )
720 {
721     fprintf( stderr, " pid=%p,", req->pid );
722     fprintf( stderr, " threads=%d,", req->threads );
723     fprintf( stderr, " priority=%d", req->priority );
724 }
725
726 static void dump_wait_debug_event_request( struct wait_debug_event_request *req )
727 {
728     fprintf( stderr, " timeout=%d", req->timeout );
729 }
730
731 static void dump_wait_debug_event_reply( struct wait_debug_event_request *req )
732 {
733     fprintf( stderr, " code=%d,", req->code );
734     fprintf( stderr, " pid=%p,", req->pid );
735     fprintf( stderr, " tid=%p", req->tid );
736 }
737
738 static void dump_send_debug_event_request( struct send_debug_event_request *req )
739 {
740     fprintf( stderr, " code=%d", req->code );
741 }
742
743 static void dump_send_debug_event_reply( struct send_debug_event_request *req )
744 {
745     fprintf( stderr, " status=%d", req->status );
746 }
747
748 static void dump_continue_debug_event_request( struct continue_debug_event_request *req )
749 {
750     fprintf( stderr, " pid=%p,", req->pid );
751     fprintf( stderr, " tid=%p,", req->tid );
752     fprintf( stderr, " status=%d", req->status );
753 }
754
755 static void dump_debug_process_request( struct debug_process_request *req )
756 {
757     fprintf( stderr, " pid=%p", req->pid );
758 }
759
760 static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
761     (dump_func)dump_new_process_request,
762     (dump_func)dump_new_thread_request,
763     (dump_func)dump_set_debug_request,
764     (dump_func)dump_init_process_request,
765     (dump_func)dump_init_thread_request,
766     (dump_func)dump_get_thread_buffer_request,
767     (dump_func)dump_terminate_process_request,
768     (dump_func)dump_terminate_thread_request,
769     (dump_func)dump_get_process_info_request,
770     (dump_func)dump_set_process_info_request,
771     (dump_func)dump_get_thread_info_request,
772     (dump_func)dump_set_thread_info_request,
773     (dump_func)dump_suspend_thread_request,
774     (dump_func)dump_resume_thread_request,
775     (dump_func)dump_debugger_request,
776     (dump_func)dump_queue_apc_request,
777     (dump_func)dump_get_apcs_request,
778     (dump_func)dump_close_handle_request,
779     (dump_func)dump_get_handle_info_request,
780     (dump_func)dump_set_handle_info_request,
781     (dump_func)dump_dup_handle_request,
782     (dump_func)dump_open_process_request,
783     (dump_func)dump_select_request,
784     (dump_func)dump_create_event_request,
785     (dump_func)dump_event_op_request,
786     (dump_func)dump_open_event_request,
787     (dump_func)dump_create_mutex_request,
788     (dump_func)dump_release_mutex_request,
789     (dump_func)dump_open_mutex_request,
790     (dump_func)dump_create_semaphore_request,
791     (dump_func)dump_release_semaphore_request,
792     (dump_func)dump_open_semaphore_request,
793     (dump_func)dump_create_file_request,
794     (dump_func)dump_alloc_file_handle_request,
795     (dump_func)dump_get_read_fd_request,
796     (dump_func)dump_get_write_fd_request,
797     (dump_func)dump_set_file_pointer_request,
798     (dump_func)dump_truncate_file_request,
799     (dump_func)dump_set_file_time_request,
800     (dump_func)dump_flush_file_request,
801     (dump_func)dump_get_file_info_request,
802     (dump_func)dump_lock_file_request,
803     (dump_func)dump_unlock_file_request,
804     (dump_func)dump_create_pipe_request,
805     (dump_func)dump_create_socket_request,
806     (dump_func)dump_accept_socket_request,
807     (dump_func)dump_set_socket_event_request,
808     (dump_func)dump_get_socket_event_request,
809     (dump_func)dump_enable_socket_event_request,
810     (dump_func)dump_alloc_console_request,
811     (dump_func)dump_free_console_request,
812     (dump_func)dump_open_console_request,
813     (dump_func)dump_set_console_fd_request,
814     (dump_func)dump_get_console_mode_request,
815     (dump_func)dump_set_console_mode_request,
816     (dump_func)dump_set_console_info_request,
817     (dump_func)dump_get_console_info_request,
818     (dump_func)dump_write_console_input_request,
819     (dump_func)dump_read_console_input_request,
820     (dump_func)dump_create_change_notification_request,
821     (dump_func)dump_create_mapping_request,
822     (dump_func)dump_open_mapping_request,
823     (dump_func)dump_get_mapping_info_request,
824     (dump_func)dump_create_device_request,
825     (dump_func)dump_create_snapshot_request,
826     (dump_func)dump_next_process_request,
827     (dump_func)dump_wait_debug_event_request,
828     (dump_func)dump_send_debug_event_request,
829     (dump_func)dump_continue_debug_event_request,
830     (dump_func)dump_debug_process_request,
831 };
832
833 static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
834     (dump_func)dump_new_process_reply,
835     (dump_func)dump_new_thread_reply,
836     (dump_func)0,
837     (dump_func)dump_init_process_reply,
838     (dump_func)dump_init_thread_reply,
839     (dump_func)0,
840     (dump_func)0,
841     (dump_func)0,
842     (dump_func)dump_get_process_info_reply,
843     (dump_func)0,
844     (dump_func)dump_get_thread_info_reply,
845     (dump_func)0,
846     (dump_func)dump_suspend_thread_reply,
847     (dump_func)dump_resume_thread_reply,
848     (dump_func)0,
849     (dump_func)0,
850     (dump_func)dump_get_apcs_reply,
851     (dump_func)0,
852     (dump_func)dump_get_handle_info_reply,
853     (dump_func)0,
854     (dump_func)dump_dup_handle_reply,
855     (dump_func)dump_open_process_reply,
856     (dump_func)dump_select_reply,
857     (dump_func)dump_create_event_reply,
858     (dump_func)0,
859     (dump_func)dump_open_event_reply,
860     (dump_func)dump_create_mutex_reply,
861     (dump_func)0,
862     (dump_func)dump_open_mutex_reply,
863     (dump_func)dump_create_semaphore_reply,
864     (dump_func)dump_release_semaphore_reply,
865     (dump_func)dump_open_semaphore_reply,
866     (dump_func)dump_create_file_reply,
867     (dump_func)dump_alloc_file_handle_reply,
868     (dump_func)0,
869     (dump_func)0,
870     (dump_func)dump_set_file_pointer_reply,
871     (dump_func)0,
872     (dump_func)0,
873     (dump_func)0,
874     (dump_func)dump_get_file_info_reply,
875     (dump_func)0,
876     (dump_func)0,
877     (dump_func)dump_create_pipe_reply,
878     (dump_func)dump_create_socket_reply,
879     (dump_func)dump_accept_socket_reply,
880     (dump_func)0,
881     (dump_func)dump_get_socket_event_reply,
882     (dump_func)0,
883     (dump_func)dump_alloc_console_reply,
884     (dump_func)0,
885     (dump_func)dump_open_console_reply,
886     (dump_func)0,
887     (dump_func)dump_get_console_mode_reply,
888     (dump_func)0,
889     (dump_func)0,
890     (dump_func)dump_get_console_info_reply,
891     (dump_func)dump_write_console_input_reply,
892     (dump_func)dump_read_console_input_reply,
893     (dump_func)dump_create_change_notification_reply,
894     (dump_func)dump_create_mapping_reply,
895     (dump_func)dump_open_mapping_reply,
896     (dump_func)dump_get_mapping_info_reply,
897     (dump_func)dump_create_device_reply,
898     (dump_func)dump_create_snapshot_reply,
899     (dump_func)dump_next_process_reply,
900     (dump_func)dump_wait_debug_event_reply,
901     (dump_func)dump_send_debug_event_reply,
902     (dump_func)0,
903     (dump_func)0,
904 };
905
906 static const char * const req_names[REQ_NB_REQUESTS] = {
907     "new_process",
908     "new_thread",
909     "set_debug",
910     "init_process",
911     "init_thread",
912     "get_thread_buffer",
913     "terminate_process",
914     "terminate_thread",
915     "get_process_info",
916     "set_process_info",
917     "get_thread_info",
918     "set_thread_info",
919     "suspend_thread",
920     "resume_thread",
921     "debugger",
922     "queue_apc",
923     "get_apcs",
924     "close_handle",
925     "get_handle_info",
926     "set_handle_info",
927     "dup_handle",
928     "open_process",
929     "select",
930     "create_event",
931     "event_op",
932     "open_event",
933     "create_mutex",
934     "release_mutex",
935     "open_mutex",
936     "create_semaphore",
937     "release_semaphore",
938     "open_semaphore",
939     "create_file",
940     "alloc_file_handle",
941     "get_read_fd",
942     "get_write_fd",
943     "set_file_pointer",
944     "truncate_file",
945     "set_file_time",
946     "flush_file",
947     "get_file_info",
948     "lock_file",
949     "unlock_file",
950     "create_pipe",
951     "create_socket",
952     "accept_socket",
953     "set_socket_event",
954     "get_socket_event",
955     "enable_socket_event",
956     "alloc_console",
957     "free_console",
958     "open_console",
959     "set_console_fd",
960     "get_console_mode",
961     "set_console_mode",
962     "set_console_info",
963     "get_console_info",
964     "write_console_input",
965     "read_console_input",
966     "create_change_notification",
967     "create_mapping",
968     "open_mapping",
969     "get_mapping_info",
970     "create_device",
971     "create_snapshot",
972     "next_process",
973     "wait_debug_event",
974     "send_debug_event",
975     "continue_debug_event",
976     "debug_process",
977 };
978
979 /* ### make_requests end ### */
980 /* Everything above this line is generated automatically by tools/make_requests */
981
982 void trace_request( enum request req, int fd )
983 {
984     current->last_req = req;
985     if (req < REQ_NB_REQUESTS)
986     {
987         fprintf( stderr, "%08x: %s(", (unsigned int)current, req_names[req] );
988         req_dumpers[req]( current->buffer );
989     }
990     else
991         fprintf( stderr, "%08x: %d(", (unsigned int)current, req );
992     if (fd != -1) fprintf( stderr, " ) fd=%d\n", fd );
993     else fprintf( stderr, " )\n" );
994 }
995
996 void trace_timeout(void)
997 {
998     fprintf( stderr, "%08x: *timeout*\n", (unsigned int)current );
999 }
1000
1001 void trace_kill( int exit_code )
1002 {
1003     fprintf( stderr,"%08x: *killed* exit_code=%d\n",
1004              (unsigned int)current, exit_code );
1005 }
1006
1007 void trace_reply( struct thread *thread, unsigned int res, int pass_fd )
1008 {
1009     fprintf( stderr, "%08x: %s() = %d",
1010              (unsigned int)thread, req_names[thread->last_req], res );
1011     if (reply_dumpers[thread->last_req])
1012     {
1013         fprintf( stderr, " {" );
1014         reply_dumpers[thread->last_req]( thread->buffer );
1015         fprintf( stderr, " }" );
1016     }
1017     if (pass_fd != -1) fprintf( stderr, " fd=%d\n", pass_fd );
1018     else fprintf( stderr, "\n" );
1019 }