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