Converted a lot of server requests to the new exception handling
[wine] / include / server.h
1 /*
2  * Wine server definitions
3  *
4  * Copyright (C) 1998 Alexandre Julliard
5  */
6
7 #ifndef __WINE_SERVER_H
8 #define __WINE_SERVER_H
9
10 #include <stdlib.h>
11 #include <time.h>
12 #include "winbase.h"
13
14 /* Request structures */
15
16 /* Following are the definitions of all the client<->server   */
17 /* communication format; if you make any change in this file, */
18 /* you must run tools/make_requests again. */
19
20
21 /* These empty macros are used by tools/make_requests */
22 /* to generate the request/reply tracing functions */
23 #define IN  /*nothing*/
24 #define OUT /*nothing*/
25 #define VARARG(name,func) /*nothing*/
26
27 struct request_header
28 {
29     IN  int            req;          /* request code */
30     IN  unsigned short fixed_size;   /* size of the fixed part of the request */
31     IN  unsigned short var_size;     /* size of the variable part of the request */
32     OUT unsigned int   error;        /* error result */
33 };
34 #define REQUEST_HEADER  struct request_header header
35
36
37 /* placeholder structure for the maximum allowed request size */
38 /* this is used to construct the generic_request union */
39 struct request_max_size
40 {
41     int pad[16]; /* the max request size is 16 ints */
42 };
43
44 /* max size of the variable part of a request */
45 #define REQUEST_MAX_VAR_SIZE  1024
46
47 /* a path name for server requests (Unicode) */
48 typedef WCHAR path_t[MAX_PATH+1];
49
50
51 /* definitions of the event data depending on the event code */
52 struct debug_event_exception
53 {
54     EXCEPTION_RECORD record;   /* exception record */
55     int              first;    /* first chance exception? */
56 };
57 struct debug_event_create_thread
58 {
59     int         handle;     /* handle to the new thread */
60     void       *teb;        /* thread teb (in debugged process address space) */
61     void       *start;      /* thread startup routine */
62 };
63 struct debug_event_create_process
64 {
65     int         file;       /* handle to the process exe file */
66     int         process;    /* handle to the new process */
67     int         thread;     /* handle to the new thread */
68     void       *base;       /* base of executable image */
69     int         dbg_offset; /* offset of debug info in file */
70     int         dbg_size;   /* size of debug info */
71     void       *teb;        /* thread teb (in debugged process address space) */
72     void       *start;      /* thread startup routine */
73     void       *name;       /* image name (optional) */
74     int         unicode;    /* is it Unicode? */
75 };
76 struct debug_event_exit
77 {
78     int         exit_code;  /* thread or process exit code */
79 };
80 struct debug_event_load_dll
81 {
82     int         handle;     /* file handle for the dll */
83     void       *base;       /* base address of the dll */
84     int         dbg_offset; /* offset of debug info in file */
85     int         dbg_size;   /* size of debug info */
86     void       *name;       /* image name (optional) */
87     int         unicode;    /* is it Unicode? */
88 };
89 struct debug_event_unload_dll
90 {
91     void       *base;       /* base address of the dll */
92 };
93 struct debug_event_output_string
94 {
95     void       *string;     /* string to display (in debugged process address space) */
96     int         unicode;    /* is it Unicode? */
97     int         length;     /* string length */
98 };
99 struct debug_event_rip_info
100 {
101     int         error;      /* ??? */
102     int         type;       /* ??? */
103 };
104 union debug_event_data
105 {
106     struct debug_event_exception      exception;
107     struct debug_event_create_thread  create_thread;
108     struct debug_event_create_process create_process;
109     struct debug_event_exit           exit;
110     struct debug_event_load_dll       load_dll;
111     struct debug_event_unload_dll     unload_dll;
112     struct debug_event_output_string  output_string;
113     struct debug_event_rip_info       rip_info;
114 };
115
116 /* debug event data */
117 typedef struct
118 {
119     int                      code;   /* event code */
120     union debug_event_data   info;   /* event information */
121 } debug_event_t;
122
123
124 /* Create a new process from the context of the parent */
125 struct new_process_request
126 {
127     REQUEST_HEADER;                /* request header */
128     IN  int          inherit_all;  /* inherit all handles from parent */
129     IN  int          create_flags; /* creation flags */
130     IN  int          start_flags;  /* flags from startup info */
131     IN  int          exe_file;     /* file handle for main exe */
132     IN  int          hstdin;       /* handle for stdin */
133     IN  int          hstdout;      /* handle for stdout */
134     IN  int          hstderr;      /* handle for stderr */
135     IN  int          cmd_show;     /* main window show mode */
136     IN  int          alloc_fd;     /* create the fd pair right now? */
137     IN  VARARG(filename,string);   /* file name of main exe */
138 };
139
140
141 /* Wait for the new process to start */
142 struct wait_process_request
143 {
144     REQUEST_HEADER;                /* request header */
145     IN  int          pinherit;     /* process handle inherit flag */
146     IN  int          tinherit;     /* thread handle inherit flag */
147     IN  int          timeout;      /* wait timeout */
148     IN  int          cancel;       /* cancel the process creation? */
149     OUT void*        pid;          /* process id */
150     OUT int          phandle;      /* process handle (in the current process) */
151     OUT void*        tid;          /* thread id */
152     OUT int          thandle;      /* thread handle (in the current process) */
153     OUT int          event;        /* event handle to signal startup */
154 };
155
156
157 /* Create a new thread from the context of the parent */
158 struct new_thread_request
159 {
160     REQUEST_HEADER;                /* request header */
161     IN  int          suspend;      /* new thread should be suspended on creation */ 
162     IN  int          inherit;      /* inherit flag */
163     OUT void*        tid;          /* thread id */
164     OUT int          handle;       /* thread handle (in the current process) */
165 };
166
167
168 /* Signal that we are finished booting on the client side */
169 struct boot_done_request
170 {
171     REQUEST_HEADER;                /* request header */
172     IN  int          debug_level;  /* new debug level */
173 };
174
175
176 /* Initialize a process; called from the new process context */
177 struct init_process_request
178 {
179     REQUEST_HEADER;                /* request header */
180     IN  void*        ldt_copy;     /* addr of LDT copy */
181     IN  void*        ldt_flags;    /* addr of LDT flags */
182     IN  int          ppid;         /* parent Unix pid */
183     OUT int          start_flags;  /* flags from startup info */
184     OUT int          exe_file;     /* file handle for main exe */
185     OUT int          hstdin;       /* handle for stdin */
186     OUT int          hstdout;      /* handle for stdout */
187     OUT int          hstderr;      /* handle for stderr */
188     OUT int          cmd_show;     /* main window show mode */
189     OUT VARARG(filename,string);   /* file name of main exe */
190 };
191
192
193 /* Signal the end of the process initialization */
194 struct init_process_done_request
195 {
196     REQUEST_HEADER;                /* request header */
197     IN  void*        module;       /* main module base address */
198     IN  void*        entry;        /* process entry point */
199     IN  void*        name;         /* ptr to ptr to name (in process addr space) */
200     IN  int          gui;          /* is it a GUI process? */
201     OUT int          debugged;     /* being debugged? */
202 };
203
204
205 /* Initialize a thread; called from the child after fork()/clone() */
206 struct init_thread_request
207 {
208     REQUEST_HEADER;                /* request header */
209     IN  int          unix_pid;     /* Unix pid of new thread */
210     IN  void*        teb;          /* TEB of new thread (in thread address space) */
211     IN  void*        entry;        /* thread entry point (in thread address space) */
212 };
213
214
215 /* Retrieve the thread buffer file descriptor */
216 /* The reply to this request is the first thing a newly */
217 /* created thread gets (without having to request it) */
218 struct get_thread_buffer_request
219 {
220     REQUEST_HEADER;                /* request header */
221     OUT void*        pid;          /* process id of the new thread's process */
222     OUT void*        tid;          /* thread id of the new thread */
223     OUT int          boot;         /* is this the boot thread? */
224     OUT int          version;      /* protocol version */
225 };
226
227
228 /* Terminate a process */
229 struct terminate_process_request
230 {
231     REQUEST_HEADER;                /* request header */
232     IN  int          handle;       /* process handle to terminate */
233     IN  int          exit_code;    /* process exit code */
234     OUT int          self;         /* suicide? */
235 };
236
237
238 /* Terminate a thread */
239 struct terminate_thread_request
240 {
241     REQUEST_HEADER;                /* request header */
242     IN  int          handle;       /* thread handle to terminate */
243     IN  int          exit_code;    /* thread exit code */
244     OUT int          self;         /* suicide? */
245     OUT int          last;         /* last thread in this process? */
246 };
247
248
249 /* Retrieve information about a process */
250 struct get_process_info_request
251 {
252     REQUEST_HEADER;                    /* request header */
253     IN  int          handle;           /* process handle */
254     OUT void*        pid;              /* server process id */
255     OUT int          debugged;         /* debugged? */
256     OUT int          exit_code;        /* process exit code */
257     OUT int          priority;         /* priority class */
258     OUT int          process_affinity; /* process affinity mask */
259     OUT int          system_affinity;  /* system affinity mask */
260 };
261
262
263 /* Set a process informations */
264 struct set_process_info_request
265 {
266     REQUEST_HEADER;                /* request header */
267     IN  int          handle;       /* process handle */
268     IN  int          mask;         /* setting mask (see below) */
269     IN  int          priority;     /* priority class */
270     IN  int          affinity;     /* affinity mask */
271 };
272 #define SET_PROCESS_INFO_PRIORITY 0x01
273 #define SET_PROCESS_INFO_AFFINITY 0x02
274
275
276 /* Retrieve information about a thread */
277 struct get_thread_info_request
278 {
279     REQUEST_HEADER;                /* request header */
280     IN  int          handle;       /* thread handle */
281     IN  void*        tid_in;       /* thread id (optional) */
282     OUT void*        tid;          /* server thread id */
283     OUT void*        teb;          /* thread teb pointer */
284     OUT int          exit_code;    /* thread exit code */
285     OUT int          priority;     /* thread priority level */
286 };
287
288
289 /* Set a thread informations */
290 struct set_thread_info_request
291 {
292     REQUEST_HEADER;                /* request header */
293     IN  int          handle;       /* thread handle */
294     IN  int          mask;         /* setting mask (see below) */
295     IN  int          priority;     /* priority class */
296     IN  int          affinity;     /* affinity mask */
297 };
298 #define SET_THREAD_INFO_PRIORITY 0x01
299 #define SET_THREAD_INFO_AFFINITY 0x02
300
301
302 /* Suspend a thread */
303 struct suspend_thread_request
304 {
305     REQUEST_HEADER;                /* request header */
306     IN  int          handle;       /* thread handle */
307     OUT int          count;        /* new suspend count */
308 };
309
310
311 /* Resume a thread */
312 struct resume_thread_request
313 {
314     REQUEST_HEADER;                /* request header */
315     IN  int          handle;       /* thread handle */
316     OUT int          count;        /* new suspend count */
317 };
318
319
320 /* Notify the server that a dll has been loaded */
321 struct load_dll_request
322 {
323     REQUEST_HEADER;                /* request header */
324     IN  int          handle;       /* file handle */
325     IN  void*        base;         /* base address */
326     IN  int          dbg_offset;   /* debug info offset */
327     IN  int          dbg_size;     /* debug info size */
328     IN  void*        name;         /* ptr to ptr to name (in process addr space) */
329 };
330
331
332 /* Notify the server that a dll is being unloaded */
333 struct unload_dll_request
334 {
335     REQUEST_HEADER;                /* request header */
336     IN  void*        base;         /* base address */
337 };
338
339
340 /* Queue an APC for a thread */
341 struct queue_apc_request
342 {
343     REQUEST_HEADER;                /* request header */
344     IN  int          handle;       /* thread handle */
345     IN  void*        func;         /* function to call */
346     IN  void*        param;        /* param for function to call */
347 };
348
349
350 /* Get next APC to call */
351 struct get_apc_request
352 {
353     REQUEST_HEADER;                /* request header */
354     OUT void*        func;         /* function to call */
355     OUT int          type;         /* function type */
356     OUT VARARG(args,ptrs);         /* function arguments */
357 };
358 enum apc_type { APC_NONE, APC_USER, APC_TIMER };
359
360
361 /* Close a handle for the current process */
362 struct close_handle_request
363 {
364     REQUEST_HEADER;                /* request header */
365     IN  int          handle;       /* handle to close */
366 };
367
368
369 /* Get information about a handle */
370 struct get_handle_info_request
371 {
372     REQUEST_HEADER;                /* request header */
373     IN  int          handle;       /* handle we are interested in */
374     OUT int          flags;        /* handle flags */
375 };
376
377
378 /* Set a handle information */
379 struct set_handle_info_request
380 {
381     REQUEST_HEADER;                /* request header */
382     IN  int          handle;       /* handle we are interested in */
383     IN  int          flags;        /* new handle flags */
384     IN  int          mask;         /* mask for flags to set */
385 };
386
387
388 /* Duplicate a handle */
389 struct dup_handle_request
390 {
391     REQUEST_HEADER;                /* request header */
392     IN  int          src_process;  /* src process handle */
393     IN  int          src_handle;   /* src handle to duplicate */
394     IN  int          dst_process;  /* dst process handle */
395     IN  unsigned int access;       /* wanted access rights */
396     IN  int          inherit;      /* inherit flag */
397     IN  int          options;      /* duplicate options (see below) */
398     OUT int          handle;       /* duplicated handle in dst process */
399 };
400 #define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
401 #define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
402 #define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */
403
404
405 /* Open a handle to a process */
406 struct open_process_request
407 {
408     REQUEST_HEADER;                /* request header */
409     IN  void*        pid;          /* process id to open */
410     IN  unsigned int access;       /* wanted access rights */
411     IN  int          inherit;      /* inherit flag */
412     OUT int          handle;       /* handle to the process */
413 };
414
415
416 /* Wait for handles */
417 struct select_request
418 {
419     REQUEST_HEADER;                /* request header */
420     IN  int          flags;        /* wait flags (see below) */
421     IN  int          timeout;      /* timeout in ms */
422     OUT int          signaled;     /* signaled handle */
423     IN  VARARG(handles,ints);      /* handles to select on */
424 };
425 #define SELECT_ALL       1
426 #define SELECT_ALERTABLE 2
427 #define SELECT_TIMEOUT   4
428
429
430 /* Create an event */
431 struct create_event_request
432 {
433     REQUEST_HEADER;                 /* request header */
434     IN  int          manual_reset;  /* manual reset event */
435     IN  int          initial_state; /* initial state of the event */
436     IN  int          inherit;       /* inherit flag */
437     OUT int          handle;        /* handle to the event */
438     IN  VARARG(name,unicode_str);   /* object name */
439 };
440
441 /* Event operation */
442 struct event_op_request
443 {
444     REQUEST_HEADER;                 /* request header */
445     IN  int           handle;       /* handle to event */
446     IN  int           op;           /* event operation (see below) */
447 };
448 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
449
450
451 /* Open an event */
452 struct open_event_request
453 {
454     REQUEST_HEADER;                 /* request header */
455     IN  unsigned int access;        /* wanted access rights */
456     IN  int          inherit;       /* inherit flag */
457     OUT int          handle;        /* handle to the event */
458     IN  VARARG(name,unicode_str);   /* object name */
459 };
460
461
462 /* Create a mutex */
463 struct create_mutex_request
464 {
465     REQUEST_HEADER;                 /* request header */
466     IN  int          owned;         /* initially owned? */
467     IN  int          inherit;       /* inherit flag */
468     OUT int          handle;        /* handle to the mutex */
469     IN  VARARG(name,unicode_str);   /* object name */
470 };
471
472
473 /* Release a mutex */
474 struct release_mutex_request
475 {
476     REQUEST_HEADER;                 /* request header */
477     IN  int          handle;        /* handle to the mutex */
478 };
479
480
481 /* Open a mutex */
482 struct open_mutex_request
483 {
484     REQUEST_HEADER;                 /* request header */
485     IN  unsigned int access;        /* wanted access rights */
486     IN  int          inherit;       /* inherit flag */
487     OUT int          handle;        /* handle to the mutex */
488     IN  VARARG(name,unicode_str);   /* object name */
489 };
490
491
492 /* Create a semaphore */
493 struct create_semaphore_request
494 {
495     REQUEST_HEADER;                 /* request header */
496     IN  unsigned int initial;       /* initial count */
497     IN  unsigned int max;           /* maximum count */
498     IN  int          inherit;       /* inherit flag */
499     OUT int          handle;        /* handle to the semaphore */
500     IN  VARARG(name,unicode_str);   /* object name */
501 };
502
503
504 /* Release a semaphore */
505 struct release_semaphore_request
506 {
507     REQUEST_HEADER;                 /* request header */
508     IN  int          handle;        /* handle to the semaphore */
509     IN  unsigned int count;         /* count to add to semaphore */
510     OUT unsigned int prev_count;    /* previous semaphore count */
511 };
512
513
514 /* Open a semaphore */
515 struct open_semaphore_request
516 {
517     REQUEST_HEADER;                 /* request header */
518     IN  unsigned int access;        /* wanted access rights */
519     IN  int          inherit;       /* inherit flag */
520     OUT int          handle;        /* handle to the semaphore */
521     IN  VARARG(name,unicode_str);   /* object name */
522 };
523
524
525 /* Create a file */
526 struct create_file_request
527 {
528     REQUEST_HEADER;                 /* request header */
529     IN  unsigned int access;        /* wanted access rights */
530     IN  int          inherit;       /* inherit flag */
531     IN  unsigned int sharing;       /* sharing flags */
532     IN  int          create;        /* file create action */
533     IN  unsigned int attrs;         /* file attributes for creation */
534     OUT int          handle;        /* handle to the file */
535     IN  VARARG(filename,string);    /* file name */
536 };
537
538
539 /* Allocate a file handle for a Unix fd */
540 struct alloc_file_handle_request
541 {
542     REQUEST_HEADER;                 /* request header */
543     IN  unsigned int access;        /* wanted access rights */
544     OUT int          handle;        /* handle to the file */
545 };
546
547
548 /* Get a Unix fd to read from a file */
549 struct get_read_fd_request
550 {
551     REQUEST_HEADER;                 /* request header */
552     IN  int          handle;        /* handle to the file */
553 };
554
555
556 /* Get a Unix fd to write to a file */
557 struct get_write_fd_request
558 {
559     REQUEST_HEADER;                 /* request header */
560     IN  int          handle;        /* handle to the file */
561 };
562
563
564 /* Set a file current position */
565 struct set_file_pointer_request
566 {
567     REQUEST_HEADER;                 /* request header */
568     IN  int          handle;        /* handle to the file */
569     IN  int          low;           /* position low word */
570     IN  int          high;          /* position high word */
571     IN  int          whence;        /* whence to seek */
572     OUT int          new_low;       /* new position low word */
573     OUT int          new_high;      /* new position high word */
574 };
575
576
577 /* Truncate (or extend) a file */
578 struct truncate_file_request
579 {
580     REQUEST_HEADER;                 /* request header */
581     IN  int          handle;        /* handle to the file */
582 };
583
584
585 /* Set a file access and modification times */
586 struct set_file_time_request
587 {
588     REQUEST_HEADER;                 /* request header */
589     IN  int          handle;        /* handle to the file */
590     IN  time_t       access_time;   /* last access time */
591     IN  time_t       write_time;    /* last write time */
592 };
593
594
595 /* Flush a file buffers */
596 struct flush_file_request
597 {
598     REQUEST_HEADER;                 /* request header */
599     IN  int          handle;        /* handle to the file */
600 };
601
602
603 /* Get information about a file */
604 struct get_file_info_request
605 {
606     REQUEST_HEADER;                 /* request header */
607     IN  int          handle;        /* handle to the file */
608     OUT int          type;          /* file type */
609     OUT int          attr;          /* file attributes */
610     OUT time_t       access_time;   /* last access time */
611     OUT time_t       write_time;    /* last write time */
612     OUT int          size_high;     /* file size */
613     OUT int          size_low;      /* file size */
614     OUT int          links;         /* number of links */
615     OUT int          index_high;    /* unique index */
616     OUT int          index_low;     /* unique index */
617     OUT unsigned int serial;        /* volume serial number */
618 };
619
620
621 /* Lock a region of a file */
622 struct lock_file_request
623 {
624     REQUEST_HEADER;                 /* request header */
625     IN  int          handle;        /* handle to the file */
626     IN  unsigned int offset_low;    /* offset of start of lock */
627     IN  unsigned int offset_high;   /* offset of start of lock */
628     IN  unsigned int count_low;     /* count of bytes to lock */
629     IN  unsigned int count_high;    /* count of bytes to lock */
630 };
631
632
633 /* Unlock a region of a file */
634 struct unlock_file_request
635 {
636     REQUEST_HEADER;                 /* request header */
637     IN  int          handle;        /* handle to the file */
638     IN  unsigned int offset_low;    /* offset of start of unlock */
639     IN  unsigned int offset_high;   /* offset of start of unlock */
640     IN  unsigned int count_low;     /* count of bytes to unlock */
641     IN  unsigned int count_high;    /* count of bytes to unlock */
642 };
643
644
645 /* Create an anonymous pipe */
646 struct create_pipe_request
647 {
648     REQUEST_HEADER;                 /* request header */
649     IN  int          inherit;       /* inherit flag */
650     OUT int          handle_read;   /* handle to the read-side of the pipe */
651     OUT int          handle_write;  /* handle to the write-side of the pipe */
652 };
653
654
655 /* Create a socket */
656 struct create_socket_request
657 {
658     REQUEST_HEADER;                 /* request header */
659     IN  unsigned int access;        /* wanted access rights */
660     IN  int          inherit;       /* inherit flag */
661     IN  int          family;        /* family, see socket manpage */
662     IN  int          type;          /* type, see socket manpage */
663     IN  int          protocol;      /* protocol, see socket manpage */
664     OUT int          handle;        /* handle to the new socket */
665 };
666
667
668 /* Accept a socket */
669 struct accept_socket_request
670 {
671     REQUEST_HEADER;                 /* request header */
672     IN  int          lhandle;       /* handle to the listening socket */
673     IN  unsigned int access;        /* wanted access rights */
674     IN  int          inherit;       /* inherit flag */
675     OUT int          handle;        /* handle to the new socket */
676 };
677
678
679 /* Set socket event parameters */
680 struct set_socket_event_request
681 {
682     REQUEST_HEADER;                 /* request header */
683     IN  int          handle;        /* handle to the socket */
684     IN  unsigned int mask;          /* event mask */
685     IN  int          event;         /* event object */
686 };
687
688
689 /* Get socket event parameters */
690 struct get_socket_event_request
691 {
692     REQUEST_HEADER;                 /* request header */
693     IN  int          handle;        /* handle to the socket */
694     IN  int          service;       /* clear pending? */
695     IN  int          s_event;       /* "expected" event object */
696     IN  int          c_event;       /* event to clear */
697     OUT unsigned int mask;          /* event mask */
698     OUT unsigned int pmask;         /* pending events */
699     OUT unsigned int state;         /* status bits */
700     OUT VARARG(errors,ints);        /* event errors */
701 };
702
703
704 /* Reenable pending socket events */
705 struct enable_socket_event_request
706 {
707     REQUEST_HEADER;                 /* request header */
708     IN  int          handle;        /* handle to the socket */
709     IN  unsigned int mask;          /* events to re-enable */
710     IN  unsigned int sstate;        /* status bits to set */
711     IN  unsigned int cstate;        /* status bits to clear */
712 };
713
714
715 /* Allocate a console for the current process */
716 struct alloc_console_request
717 {
718     REQUEST_HEADER;                 /* request header */
719     IN  unsigned int access;        /* wanted access rights */
720     IN  int          inherit;       /* inherit flag */
721     OUT int          handle_in;     /* handle to console input */
722     OUT int          handle_out;    /* handle to console output */
723 };
724
725
726 /* Free the console of the current process */
727 struct free_console_request
728 {
729     REQUEST_HEADER;                 /* request header */
730 };
731
732
733 /* Open a handle to the process console */
734 struct open_console_request
735 {
736     REQUEST_HEADER;                 /* request header */
737     IN  int          output;        /* input or output? */
738     IN  unsigned int access;        /* wanted access rights */
739     IN  int          inherit;       /* inherit flag */
740     OUT int          handle;        /* handle to the console */
741 };
742
743
744 /* Set a console file descriptor */
745 struct set_console_fd_request
746 {
747     REQUEST_HEADER;                 /* request header */
748     IN  int          handle;        /* handle to the console */
749     IN  int          file_handle;   /* handle of file to use as file descriptor */
750     IN  int          pid;           /* pid of xterm (hack) */
751 };
752
753
754 /* Get a console mode (input or output) */
755 struct get_console_mode_request
756 {
757     REQUEST_HEADER;                 /* request header */
758     IN  int          handle;        /* handle to the console */
759     OUT int          mode;          /* console mode */
760 };
761
762
763 /* Set a console mode (input or output) */
764 struct set_console_mode_request
765 {
766     REQUEST_HEADER;                 /* request header */
767     IN  int          handle;        /* handle to the console */
768     IN  int          mode;          /* console mode */
769 };
770
771
772 /* Set info about a console (output only) */
773 struct set_console_info_request
774 {
775     REQUEST_HEADER;                 /* request header */
776     IN  int          handle;        /* handle to the console */
777     IN  int          mask;          /* setting mask (see below) */
778     IN  int          cursor_size;   /* size of cursor (percentage filled) */
779     IN  int          cursor_visible;/* cursor visibility flag */
780     IN  VARARG(title,string);       /* console title */
781 };
782 #define SET_CONSOLE_INFO_CURSOR 0x01
783 #define SET_CONSOLE_INFO_TITLE  0x02
784
785 /* Get info about a console (output only) */
786 struct get_console_info_request
787 {
788     REQUEST_HEADER;                 /* request header */
789     IN  int          handle;        /* handle to the console */
790     OUT int          cursor_size;   /* size of cursor (percentage filled) */
791     OUT int          cursor_visible;/* cursor visibility flag */
792     OUT int          pid;           /* pid of xterm (hack) */
793     OUT VARARG(title,string);       /* console title */
794 };
795
796
797 /* Add input records to a console input queue */
798 struct write_console_input_request
799 {
800     REQUEST_HEADER;                 /* request header */
801     IN  int          handle;        /* handle to the console input */
802     OUT int          written;       /* number of records written */
803     IN  VARARG(rec,input_records);  /* input records */
804 };
805
806 /* Fetch input records from a console input queue */
807 struct read_console_input_request
808 {
809     REQUEST_HEADER;                 /* request header */
810     IN  int          handle;        /* handle to the console input */
811     IN  int          flush;         /* flush the retrieved records from the queue? */
812     OUT int          read;          /* number of records read */
813     OUT VARARG(rec,input_records);  /* input records */
814 };
815
816
817 /* Create a change notification */
818 struct create_change_notification_request
819 {
820     REQUEST_HEADER;                 /* request header */
821     IN  int          subtree;       /* watch all the subtree */
822     IN  int          filter;        /* notification filter */
823     OUT int          handle;        /* handle to the change notification */
824 };
825
826
827 /* Create a file mapping */
828 struct create_mapping_request
829 {
830     REQUEST_HEADER;                 /* request header */
831     IN  int          size_high;     /* mapping size */
832     IN  int          size_low;      /* mapping size */
833     IN  int          protect;       /* protection flags (see below) */
834     IN  int          inherit;       /* inherit flag */
835     IN  int          file_handle;   /* file handle */
836     OUT int          handle;        /* handle to the mapping */
837     IN  VARARG(name,unicode_str);   /* object name */
838 };
839 /* protection flags */
840 #define VPROT_READ       0x01
841 #define VPROT_WRITE      0x02
842 #define VPROT_EXEC       0x04
843 #define VPROT_WRITECOPY  0x08
844 #define VPROT_GUARD      0x10
845 #define VPROT_NOCACHE    0x20
846 #define VPROT_COMMITTED  0x40
847 #define VPROT_IMAGE      0x80
848
849
850 /* Open a mapping */
851 struct open_mapping_request
852 {
853     REQUEST_HEADER;                 /* request header */
854     IN  unsigned int access;        /* wanted access rights */
855     IN  int          inherit;       /* inherit flag */
856     OUT int          handle;        /* handle to the mapping */
857     IN  VARARG(name,unicode_str);   /* object name */
858 };
859
860
861 /* Get information about a file mapping */
862 struct get_mapping_info_request
863 {
864     REQUEST_HEADER;                 /* request header */
865     IN  int          handle;        /* handle to the mapping */
866     OUT int          size_high;     /* mapping size */
867     OUT int          size_low;      /* mapping size */
868     OUT int          protect;       /* protection flags */
869     OUT int          header_size;   /* header size (for VPROT_IMAGE mapping) */
870     OUT void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
871     OUT int          shared_file;   /* shared mapping file handle */
872     OUT int          shared_size;   /* shared mapping size */
873 };
874
875
876 /* Create a device */
877 struct create_device_request
878 {
879     REQUEST_HEADER;                 /* request header */
880     IN  unsigned int access;        /* wanted access rights */
881     IN  int          inherit;       /* inherit flag */
882     IN  int          id;            /* client private id */
883     OUT int          handle;        /* handle to the device */
884 };
885
886
887 /* Create a snapshot */
888 struct create_snapshot_request
889 {
890     REQUEST_HEADER;                 /* request header */
891     IN  int          inherit;       /* inherit flag */
892     IN  int          flags;         /* snapshot flags (TH32CS_*) */
893     IN  void*        pid;           /* process id */
894     OUT int          handle;        /* handle to the snapshot */
895 };
896
897
898 /* Get the next process from a snapshot */
899 struct next_process_request
900 {
901     REQUEST_HEADER;                 /* request header */
902     IN  int          handle;        /* handle to the snapshot */
903     IN  int          reset;         /* reset snapshot position? */
904     OUT int          count;         /* process usage count */
905     OUT void*        pid;           /* process id */
906     OUT int          threads;       /* number of threads */
907     OUT int          priority;      /* process priority */
908 };
909
910
911 /* Get the next thread from a snapshot */
912 struct next_thread_request
913 {
914     REQUEST_HEADER;                 /* request header */
915     IN  int          handle;        /* handle to the snapshot */
916     IN  int          reset;         /* reset snapshot position? */
917     OUT int          count;         /* thread usage count */
918     OUT void*        pid;           /* process id */
919     OUT void*        tid;           /* thread id */
920     OUT int          base_pri;      /* base priority */
921     OUT int          delta_pri;     /* delta priority */
922 };
923
924
925 /* Get the next module from a snapshot */
926 struct next_module_request
927 {
928     REQUEST_HEADER;                 /* request header */
929     IN  int          handle;        /* handle to the snapshot */
930     IN  int          reset;         /* reset snapshot position? */
931     OUT void*        pid;           /* process id */
932     OUT void*        base;          /* module base address */
933 };
934
935
936 /* Wait for a debug event */
937 struct wait_debug_event_request
938 {
939     REQUEST_HEADER;                /* request header */
940     IN  int           timeout;     /* timeout in ms */
941     OUT void*         pid;         /* process id */
942     OUT void*         tid;         /* thread id */
943     OUT VARARG(event,debug_event); /* debug event data */
944 };
945
946
947 /* Send an exception event */
948 struct exception_event_request
949 {
950     REQUEST_HEADER;                /* request header */
951     IN  int              first;    /* first chance exception? */
952     OUT int              status;   /* event continuation status */
953     IN  VARARG(record,exc_event);  /* thread context followed by exception record */
954     OUT VARARG(context,context);   /* modified thread context */
955 };
956
957
958 /* Send an output string to the debugger */
959 struct output_debug_string_request
960 {
961     REQUEST_HEADER;                /* request header */
962     IN  void*         string;      /* string to display (in debugged process address space) */
963     IN  int           unicode;     /* is it Unicode? */
964     IN  int           length;      /* string length */
965 };
966
967
968 /* Continue a debug event */
969 struct continue_debug_event_request
970 {
971     REQUEST_HEADER;                /* request header */
972     IN  void*        pid;          /* process id to continue */
973     IN  void*        tid;          /* thread id to continue */
974     IN  int          status;       /* continuation status */
975 };
976
977
978 /* Start debugging an existing process */
979 struct debug_process_request
980 {
981     REQUEST_HEADER;                /* request header */
982     IN  void*        pid;          /* id of the process to debug */
983 };
984
985
986 /* Read data from a process address space */
987 struct read_process_memory_request
988 {
989     REQUEST_HEADER;                /* request header */
990     IN  int          handle;       /* process handle */
991     IN  void*        addr;         /* addr to read from (must be int-aligned) */
992     IN  int          len;          /* number of ints to read */
993     OUT unsigned int data[1];      /* result data */
994 };
995
996
997 /* Write data to a process address space */
998 struct write_process_memory_request
999 {
1000     REQUEST_HEADER;                /* request header */
1001     IN  int          handle;       /* process handle */
1002     IN  void*        addr;         /* addr to write to (must be int-aligned) */
1003     IN  int          len;          /* number of ints to write */
1004     IN  unsigned int first_mask;   /* mask for first word */
1005     IN  unsigned int last_mask;    /* mask for last word */
1006     IN  unsigned int data[1];      /* data to write */
1007 };
1008
1009
1010 /* Create a registry key */
1011 struct create_key_request
1012 {
1013     REQUEST_HEADER;                /* request header */
1014     IN  int          parent;       /* handle to the parent key */
1015     IN  unsigned int access;       /* desired access rights */
1016     IN  unsigned int options;      /* creation options */
1017     IN  time_t       modif;        /* last modification time */
1018     OUT int          hkey;         /* handle to the created key */
1019     OUT int          created;      /* has it been newly created? */
1020     IN  path_t       name;         /* key name */
1021     IN  WCHAR        class[1];     /* class name */
1022 };
1023
1024
1025 /* Open a registry key */
1026 struct open_key_request
1027 {
1028     REQUEST_HEADER;                /* request header */
1029     IN  int          parent;       /* handle to the parent key */
1030     IN  unsigned int access;       /* desired access rights */
1031     OUT int          hkey;         /* handle to the open key */
1032     IN  path_t       name;         /* key name */
1033 };
1034
1035
1036 /* Delete a registry key */
1037 struct delete_key_request
1038 {
1039     REQUEST_HEADER;                /* request header */
1040     IN  int          hkey;         /* handle to the parent key */
1041     IN  path_t       name;         /* key name */
1042 };
1043
1044
1045 /* Close a registry key */
1046 struct close_key_request
1047 {
1048     REQUEST_HEADER;                 /* request header */
1049     IN  int          hkey;          /* key to close */
1050 };
1051
1052
1053 /* Enumerate registry subkeys */
1054 struct enum_key_request
1055 {
1056     REQUEST_HEADER;                /* request header */
1057     IN  int          hkey;         /* handle to registry key */
1058     IN  int          index;        /* index of subkey */
1059     OUT time_t       modif;        /* last modification time */
1060     OUT path_t       name;         /* subkey name */
1061     OUT WCHAR        class[1];     /* class name */
1062 };
1063
1064
1065 /* Query information about a registry key */
1066 struct query_key_info_request
1067 {
1068     REQUEST_HEADER;                /* request header */
1069     IN  int          hkey;         /* handle to registry key */
1070     OUT int          subkeys;      /* number of subkeys */
1071     OUT int          max_subkey;   /* longest subkey name */
1072     OUT int          max_class;    /* longest class name */
1073     OUT int          values;       /* number of values */
1074     OUT int          max_value;    /* longest value name */
1075     OUT int          max_data;     /* longest value data */
1076     OUT time_t       modif;        /* last modification time */
1077     OUT path_t       name;         /* key name */
1078     OUT WCHAR        class[1];     /* class name */
1079 };
1080
1081
1082 /* Set a value of a registry key */
1083 struct set_key_value_request
1084 {
1085     REQUEST_HEADER;                /* request header */
1086     IN  int          hkey;         /* handle to registry key */
1087     IN  int          type;         /* value type */
1088     IN  unsigned int total;        /* total value len */
1089     IN  unsigned int offset;       /* offset for setting data */
1090     IN  unsigned int len;          /* value data len */
1091     IN  path_t       name;         /* value name */
1092     IN  unsigned char data[1];     /* value data */
1093 };
1094
1095
1096 /* Retrieve the value of a registry key */
1097 struct get_key_value_request
1098 {
1099     REQUEST_HEADER;                /* request header */
1100     IN  int          hkey;         /* handle to registry key */
1101     IN  unsigned int offset;       /* offset for getting data */
1102     OUT int          type;         /* value type */
1103     OUT int          len;          /* value data len */
1104     IN  WCHAR        name[1];      /* value name */
1105     OUT unsigned char data[1];     /* value data */
1106 };
1107
1108
1109 /* Enumerate a value of a registry key */
1110 struct enum_key_value_request
1111 {
1112     REQUEST_HEADER;                /* request header */
1113     IN  int          hkey;         /* handle to registry key */
1114     IN  int          index;        /* value index */
1115     IN  unsigned int offset;       /* offset for getting data */
1116     OUT int          type;         /* value type */
1117     OUT int          len;          /* value data len */
1118     OUT path_t       name;         /* value name */
1119     OUT unsigned char data[1];     /* value data */
1120 };
1121
1122
1123 /* Delete a value of a registry key */
1124 struct delete_key_value_request
1125 {
1126     REQUEST_HEADER;                /* request header */
1127     IN  int          hkey;         /* handle to registry key */
1128     IN  path_t       name;         /* value name */
1129 };
1130
1131
1132 /* Load a registry branch from a file */
1133 struct load_registry_request
1134 {
1135     REQUEST_HEADER;                /* request header */
1136     IN  int          hkey;         /* root key to load to */
1137     IN  int          file;         /* file to load from */
1138     IN  path_t       name;         /* subkey name */
1139 };
1140
1141
1142 /* Save a registry branch to a file */
1143 struct save_registry_request
1144 {
1145     REQUEST_HEADER;                /* request header */
1146     IN  int          hkey;         /* key to save */
1147     IN  int          file;         /* file to save to */
1148 };
1149
1150
1151 /* Save a registry branch at server exit */
1152 struct save_registry_atexit_request
1153 {
1154     REQUEST_HEADER;                /* request header */
1155     IN  int          hkey;         /* key to save */
1156     IN  char         file[1];      /* file to save to */
1157 };
1158
1159
1160 /* Set the current and saving level for the registry */
1161 struct set_registry_levels_request
1162 {
1163     REQUEST_HEADER;                /* request header */
1164     IN  int          current;      /* new current level */
1165     IN  int          saving;       /* new saving level */
1166     IN  int          period;       /* duration between periodic saves (milliseconds) */
1167 };
1168
1169
1170 /* Create a waitable timer */
1171 struct create_timer_request
1172 {
1173     REQUEST_HEADER;                 /* request header */
1174     IN  int          inherit;       /* inherit flag */
1175     IN  int          manual;        /* manual reset */
1176     OUT int          handle;        /* handle to the timer */
1177     IN  VARARG(name,unicode_str);   /* object name */
1178 };
1179
1180
1181 /* Open a waitable timer */
1182 struct open_timer_request
1183 {
1184     REQUEST_HEADER;                 /* request header */
1185     IN  unsigned int access;        /* wanted access rights */
1186     IN  int          inherit;       /* inherit flag */
1187     OUT int          handle;        /* handle to the timer */
1188     IN  VARARG(name,unicode_str);   /* object name */
1189 };
1190
1191 /* Set a waitable timer */
1192 struct set_timer_request
1193 {
1194     REQUEST_HEADER;                 /* request header */
1195     IN  int          handle;        /* handle to the timer */
1196     IN  int          sec;           /* next expiration absolute time */
1197     IN  int          usec;          /* next expiration absolute time */
1198     IN  int          period;        /* timer period in ms */
1199     IN  void*        callback;      /* callback function */
1200     IN  void*        arg;           /* callback argument */
1201 };
1202
1203 /* Cancel a waitable timer */
1204 struct cancel_timer_request
1205 {
1206     REQUEST_HEADER;                 /* request header */
1207     IN  int          handle;        /* handle to the timer */
1208 };
1209
1210
1211 /* Retrieve the current context of a thread */
1212 struct get_thread_context_request
1213 {
1214     REQUEST_HEADER;                /* request header */
1215     IN  int          handle;       /* thread handle */
1216     IN  unsigned int flags;        /* context flags */
1217     OUT VARARG(context,context);   /* thread context */
1218 };
1219
1220
1221 /* Set the current context of a thread */
1222 struct set_thread_context_request
1223 {
1224     REQUEST_HEADER;                /* request header */
1225     IN  int          handle;       /* thread handle */
1226     IN  unsigned int flags;        /* context flags */
1227     IN  VARARG(context,context);   /* thread context */
1228 };
1229
1230
1231 /* Fetch a selector entry for a thread */
1232 struct get_selector_entry_request
1233 {
1234     REQUEST_HEADER;                /* request header */
1235     IN  int           handle;      /* thread handle */
1236     IN  int           entry;       /* LDT entry */
1237     OUT unsigned int  base;        /* selector base */
1238     OUT unsigned int  limit;       /* selector limit */
1239     OUT unsigned char flags;       /* selector flags */
1240 };
1241
1242
1243 /* Add an atom */
1244 struct add_atom_request
1245 {
1246     REQUEST_HEADER;                /* request header */
1247     IN  int           local;       /* is atom in local process table? */
1248     OUT int           atom;        /* resulting atom */
1249     IN  VARARG(name,unicode_str);  /* atom name */
1250 };
1251
1252
1253 /* Delete an atom */
1254 struct delete_atom_request
1255 {
1256     REQUEST_HEADER;                /* request header */
1257     IN  int           atom;        /* atom handle */
1258     IN  int           local;       /* is atom in local process table? */
1259 };
1260
1261
1262 /* Find an atom */
1263 struct find_atom_request
1264 {
1265     REQUEST_HEADER;                /* request header */
1266     IN  int          local;        /* is atom in local process table? */
1267     OUT int          atom;         /* atom handle */
1268     IN  VARARG(name,unicode_str);  /* atom name */
1269 };
1270
1271
1272 /* Get an atom name */
1273 struct get_atom_name_request
1274 {
1275     REQUEST_HEADER;                /* request header */
1276     IN  int          atom;         /* atom handle */
1277     IN  int          local;        /* is atom in local process table? */
1278     OUT int          count;        /* atom lock count */
1279     OUT VARARG(name,unicode_str);  /* atom name */
1280 };
1281
1282
1283 /* Init the process atom table */
1284 struct init_atom_table_request
1285 {
1286     REQUEST_HEADER;                /* request header */
1287     IN  int          entries;      /* number of entries */
1288 };
1289
1290
1291 /* Get the message queue of the current thread */
1292 struct get_msg_queue_request
1293 {
1294     REQUEST_HEADER;                /* request header */
1295     OUT int          handle;       /* handle to the queue */
1296 };
1297
1298 /* Wake up a message queue */
1299 struct wake_queue_request
1300 {
1301     REQUEST_HEADER;                /* request header */
1302     IN  int          handle;       /* handle to the queue */
1303     IN  unsigned int bits;         /* wake bits */
1304 };
1305
1306 /* Wait for a process to start waiting on input */
1307 struct wait_input_idle_request
1308 {
1309     REQUEST_HEADER;                /* request header */
1310     IN  int          handle;       /* process handle */
1311     IN  int          timeout;      /* timeout */
1312     OUT int          event;        /* handle to idle event */
1313 };
1314
1315
1316 /* Everything below this line is generated automatically by tools/make_requests */
1317 /* ### make_requests begin ### */
1318
1319 enum request
1320 {
1321     REQ_NEW_PROCESS,
1322     REQ_WAIT_PROCESS,
1323     REQ_NEW_THREAD,
1324     REQ_BOOT_DONE,
1325     REQ_INIT_PROCESS,
1326     REQ_INIT_PROCESS_DONE,
1327     REQ_INIT_THREAD,
1328     REQ_GET_THREAD_BUFFER,
1329     REQ_TERMINATE_PROCESS,
1330     REQ_TERMINATE_THREAD,
1331     REQ_GET_PROCESS_INFO,
1332     REQ_SET_PROCESS_INFO,
1333     REQ_GET_THREAD_INFO,
1334     REQ_SET_THREAD_INFO,
1335     REQ_SUSPEND_THREAD,
1336     REQ_RESUME_THREAD,
1337     REQ_LOAD_DLL,
1338     REQ_UNLOAD_DLL,
1339     REQ_QUEUE_APC,
1340     REQ_GET_APC,
1341     REQ_CLOSE_HANDLE,
1342     REQ_GET_HANDLE_INFO,
1343     REQ_SET_HANDLE_INFO,
1344     REQ_DUP_HANDLE,
1345     REQ_OPEN_PROCESS,
1346     REQ_SELECT,
1347     REQ_CREATE_EVENT,
1348     REQ_EVENT_OP,
1349     REQ_OPEN_EVENT,
1350     REQ_CREATE_MUTEX,
1351     REQ_RELEASE_MUTEX,
1352     REQ_OPEN_MUTEX,
1353     REQ_CREATE_SEMAPHORE,
1354     REQ_RELEASE_SEMAPHORE,
1355     REQ_OPEN_SEMAPHORE,
1356     REQ_CREATE_FILE,
1357     REQ_ALLOC_FILE_HANDLE,
1358     REQ_GET_READ_FD,
1359     REQ_GET_WRITE_FD,
1360     REQ_SET_FILE_POINTER,
1361     REQ_TRUNCATE_FILE,
1362     REQ_SET_FILE_TIME,
1363     REQ_FLUSH_FILE,
1364     REQ_GET_FILE_INFO,
1365     REQ_LOCK_FILE,
1366     REQ_UNLOCK_FILE,
1367     REQ_CREATE_PIPE,
1368     REQ_CREATE_SOCKET,
1369     REQ_ACCEPT_SOCKET,
1370     REQ_SET_SOCKET_EVENT,
1371     REQ_GET_SOCKET_EVENT,
1372     REQ_ENABLE_SOCKET_EVENT,
1373     REQ_ALLOC_CONSOLE,
1374     REQ_FREE_CONSOLE,
1375     REQ_OPEN_CONSOLE,
1376     REQ_SET_CONSOLE_FD,
1377     REQ_GET_CONSOLE_MODE,
1378     REQ_SET_CONSOLE_MODE,
1379     REQ_SET_CONSOLE_INFO,
1380     REQ_GET_CONSOLE_INFO,
1381     REQ_WRITE_CONSOLE_INPUT,
1382     REQ_READ_CONSOLE_INPUT,
1383     REQ_CREATE_CHANGE_NOTIFICATION,
1384     REQ_CREATE_MAPPING,
1385     REQ_OPEN_MAPPING,
1386     REQ_GET_MAPPING_INFO,
1387     REQ_CREATE_DEVICE,
1388     REQ_CREATE_SNAPSHOT,
1389     REQ_NEXT_PROCESS,
1390     REQ_NEXT_THREAD,
1391     REQ_NEXT_MODULE,
1392     REQ_WAIT_DEBUG_EVENT,
1393     REQ_EXCEPTION_EVENT,
1394     REQ_OUTPUT_DEBUG_STRING,
1395     REQ_CONTINUE_DEBUG_EVENT,
1396     REQ_DEBUG_PROCESS,
1397     REQ_READ_PROCESS_MEMORY,
1398     REQ_WRITE_PROCESS_MEMORY,
1399     REQ_CREATE_KEY,
1400     REQ_OPEN_KEY,
1401     REQ_DELETE_KEY,
1402     REQ_CLOSE_KEY,
1403     REQ_ENUM_KEY,
1404     REQ_QUERY_KEY_INFO,
1405     REQ_SET_KEY_VALUE,
1406     REQ_GET_KEY_VALUE,
1407     REQ_ENUM_KEY_VALUE,
1408     REQ_DELETE_KEY_VALUE,
1409     REQ_LOAD_REGISTRY,
1410     REQ_SAVE_REGISTRY,
1411     REQ_SAVE_REGISTRY_ATEXIT,
1412     REQ_SET_REGISTRY_LEVELS,
1413     REQ_CREATE_TIMER,
1414     REQ_OPEN_TIMER,
1415     REQ_SET_TIMER,
1416     REQ_CANCEL_TIMER,
1417     REQ_GET_THREAD_CONTEXT,
1418     REQ_SET_THREAD_CONTEXT,
1419     REQ_GET_SELECTOR_ENTRY,
1420     REQ_ADD_ATOM,
1421     REQ_DELETE_ATOM,
1422     REQ_FIND_ATOM,
1423     REQ_GET_ATOM_NAME,
1424     REQ_INIT_ATOM_TABLE,
1425     REQ_GET_MSG_QUEUE,
1426     REQ_WAKE_QUEUE,
1427     REQ_WAIT_INPUT_IDLE,
1428     REQ_NB_REQUESTS
1429 };
1430
1431 union generic_request
1432 {
1433     struct request_max_size max_size;
1434     struct request_header header;
1435     struct new_process_request new_process;
1436     struct wait_process_request wait_process;
1437     struct new_thread_request new_thread;
1438     struct boot_done_request boot_done;
1439     struct init_process_request init_process;
1440     struct init_process_done_request init_process_done;
1441     struct init_thread_request init_thread;
1442     struct get_thread_buffer_request get_thread_buffer;
1443     struct terminate_process_request terminate_process;
1444     struct terminate_thread_request terminate_thread;
1445     struct get_process_info_request get_process_info;
1446     struct set_process_info_request set_process_info;
1447     struct get_thread_info_request get_thread_info;
1448     struct set_thread_info_request set_thread_info;
1449     struct suspend_thread_request suspend_thread;
1450     struct resume_thread_request resume_thread;
1451     struct load_dll_request load_dll;
1452     struct unload_dll_request unload_dll;
1453     struct queue_apc_request queue_apc;
1454     struct get_apc_request get_apc;
1455     struct close_handle_request close_handle;
1456     struct get_handle_info_request get_handle_info;
1457     struct set_handle_info_request set_handle_info;
1458     struct dup_handle_request dup_handle;
1459     struct open_process_request open_process;
1460     struct select_request select;
1461     struct create_event_request create_event;
1462     struct event_op_request event_op;
1463     struct open_event_request open_event;
1464     struct create_mutex_request create_mutex;
1465     struct release_mutex_request release_mutex;
1466     struct open_mutex_request open_mutex;
1467     struct create_semaphore_request create_semaphore;
1468     struct release_semaphore_request release_semaphore;
1469     struct open_semaphore_request open_semaphore;
1470     struct create_file_request create_file;
1471     struct alloc_file_handle_request alloc_file_handle;
1472     struct get_read_fd_request get_read_fd;
1473     struct get_write_fd_request get_write_fd;
1474     struct set_file_pointer_request set_file_pointer;
1475     struct truncate_file_request truncate_file;
1476     struct set_file_time_request set_file_time;
1477     struct flush_file_request flush_file;
1478     struct get_file_info_request get_file_info;
1479     struct lock_file_request lock_file;
1480     struct unlock_file_request unlock_file;
1481     struct create_pipe_request create_pipe;
1482     struct create_socket_request create_socket;
1483     struct accept_socket_request accept_socket;
1484     struct set_socket_event_request set_socket_event;
1485     struct get_socket_event_request get_socket_event;
1486     struct enable_socket_event_request enable_socket_event;
1487     struct alloc_console_request alloc_console;
1488     struct free_console_request free_console;
1489     struct open_console_request open_console;
1490     struct set_console_fd_request set_console_fd;
1491     struct get_console_mode_request get_console_mode;
1492     struct set_console_mode_request set_console_mode;
1493     struct set_console_info_request set_console_info;
1494     struct get_console_info_request get_console_info;
1495     struct write_console_input_request write_console_input;
1496     struct read_console_input_request read_console_input;
1497     struct create_change_notification_request create_change_notification;
1498     struct create_mapping_request create_mapping;
1499     struct open_mapping_request open_mapping;
1500     struct get_mapping_info_request get_mapping_info;
1501     struct create_device_request create_device;
1502     struct create_snapshot_request create_snapshot;
1503     struct next_process_request next_process;
1504     struct next_thread_request next_thread;
1505     struct next_module_request next_module;
1506     struct wait_debug_event_request wait_debug_event;
1507     struct exception_event_request exception_event;
1508     struct output_debug_string_request output_debug_string;
1509     struct continue_debug_event_request continue_debug_event;
1510     struct debug_process_request debug_process;
1511     struct read_process_memory_request read_process_memory;
1512     struct write_process_memory_request write_process_memory;
1513     struct create_key_request create_key;
1514     struct open_key_request open_key;
1515     struct delete_key_request delete_key;
1516     struct close_key_request close_key;
1517     struct enum_key_request enum_key;
1518     struct query_key_info_request query_key_info;
1519     struct set_key_value_request set_key_value;
1520     struct get_key_value_request get_key_value;
1521     struct enum_key_value_request enum_key_value;
1522     struct delete_key_value_request delete_key_value;
1523     struct load_registry_request load_registry;
1524     struct save_registry_request save_registry;
1525     struct save_registry_atexit_request save_registry_atexit;
1526     struct set_registry_levels_request set_registry_levels;
1527     struct create_timer_request create_timer;
1528     struct open_timer_request open_timer;
1529     struct set_timer_request set_timer;
1530     struct cancel_timer_request cancel_timer;
1531     struct get_thread_context_request get_thread_context;
1532     struct set_thread_context_request set_thread_context;
1533     struct get_selector_entry_request get_selector_entry;
1534     struct add_atom_request add_atom;
1535     struct delete_atom_request delete_atom;
1536     struct find_atom_request find_atom;
1537     struct get_atom_name_request get_atom_name;
1538     struct init_atom_table_request init_atom_table;
1539     struct get_msg_queue_request get_msg_queue;
1540     struct wake_queue_request wake_queue;
1541     struct wait_input_idle_request wait_input_idle;
1542 };
1543
1544 #define SERVER_PROTOCOL_VERSION 20
1545
1546 /* ### make_requests end ### */
1547 /* Everything above this line is generated automatically by tools/make_requests */
1548
1549 #undef REQUEST_HEADER
1550 #undef VARARG
1551
1552 /* format of the server buffer */
1553 struct server_buffer_info
1554 {
1555     volatile unsigned int cur_req;    /* offset of the current request */
1556     volatile unsigned int cur_pos;    /* first available position in buffer */
1557 };
1558
1559 /* client-side functions */
1560
1561 #ifndef __WINE_SERVER__
1562
1563 #include "thread.h"
1564 #include "ntddk.h"
1565 #include "wine/exception.h"
1566
1567 /* client communication functions */
1568
1569 extern unsigned int server_call_noerr( enum request req );
1570 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1571 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1572 extern void *server_alloc_req( size_t fixed_size, size_t var_size );
1573 extern const char *get_config_dir(void);
1574
1575 /* get a pointer to the request buffer */
1576 static inline void WINE_UNUSED *get_req_buffer(void)
1577 {
1578     return NtCurrentTeb()->buffer;
1579 }
1580
1581 /* maximum remaining size in the server buffer */
1582 static inline int WINE_UNUSED server_remaining( const void *ptr )
1583 {
1584     return (char *)NtCurrentTeb()->buffer_info - (char *)ptr;
1585 }
1586
1587 /* do a server call and set the last error code */
1588 static inline int server_call( enum request req )
1589 {
1590     unsigned int res = server_call_noerr( req );
1591     if (res) SetLastError( RtlNtStatusToDosError(res) );
1592     return res;
1593 }
1594
1595 /* copy a Unicode string to the server buffer */
1596 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1597 {
1598     if (src)
1599     {
1600         WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1601         while ((dst < end) && *src) *dst++ = *src++;
1602     }
1603     *dst = 0;
1604 }
1605
1606 /* copy and convert an ASCII string to the server buffer */
1607 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1608 {
1609     if (src)
1610     {
1611         WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1612         while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1613     }
1614     *dst = 0;
1615 }
1616
1617 /* get a pointer to the variable part of the request */
1618 inline static void *server_data_ptr( void *req )
1619 {
1620     return (union generic_request *)req + 1;
1621 }
1622
1623 /* get the size of the variable part of the request */
1624 inline static size_t server_data_size( void *req )
1625 {
1626     return ((struct request_header *)req)->var_size;
1627 }
1628
1629
1630 /* exception support for server calls */
1631
1632 extern DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1633                                        CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1634
1635 struct __server_exception_frame
1636 {
1637     EXCEPTION_FRAME           frame;
1638     struct server_buffer_info info;  /* saved buffer information */
1639 };
1640
1641 #define SERVER_START_REQ \
1642     do { \
1643         struct __server_exception_frame __f; \
1644         __f.frame.Handler = server_exception_handler; \
1645         __f.info = *NtCurrentTeb()->buffer_info; \
1646         __wine_push_frame( &__f.frame ); \
1647         do {
1648
1649 #define SERVER_END_REQ \
1650         } while(0); \
1651         *NtCurrentTeb()->buffer_info = __f.info; \
1652         __wine_pop_frame( &__f.frame ); \
1653     } while(0);
1654
1655 extern int CLIENT_InitServer(void);
1656 extern int CLIENT_BootDone( int debug_level );
1657 extern int CLIENT_IsBootThread(void);
1658 extern int CLIENT_InitThread(void);
1659 #endif  /* __WINE_SERVER__ */
1660
1661 #endif  /* __WINE_SERVER_H */