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