Added registry support to the server.
[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 "windef.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
26
27 /* a path name for server requests (Unicode) */
28 typedef WCHAR path_t[MAX_PATH+1];
29
30 /* Create a new process from the context of the parent */
31 struct new_process_request
32 {
33     IN  int          inherit;      /* inherit flag */
34     IN  int          inherit_all;  /* inherit all handles from parent */
35     IN  int          create_flags; /* creation flags */
36     IN  int          start_flags;  /* flags from startup info */
37     IN  int          hstdin;       /* handle for stdin */
38     IN  int          hstdout;      /* handle for stdout */
39     IN  int          hstderr;      /* handle for stderr */
40     IN  int          event;        /* event to signal startup */
41     IN  int          cmd_show;     /* main window show mode */
42     IN  void*        env_ptr;      /* pointer to environment (FIXME: hack) */
43     OUT void*        pid;          /* process id */
44     OUT int          handle;       /* process handle (in the current process) */
45     IN  char         cmdline[1];   /* command line */
46 };
47
48
49 /* Create a new thread from the context of the parent */
50 struct new_thread_request
51 {
52     IN  void*        pid;          /* process id for the new thread */
53     IN  int          suspend;      /* new thread should be suspended on creation */ 
54     IN  int          inherit;      /* inherit flag */
55     OUT void*        tid;          /* thread id */
56     OUT int          handle;       /* thread handle (in the current process) */
57 };
58
59
60 /* Set the server debug level */
61 struct set_debug_request
62 {
63     IN  int          level;        /* New debug level */
64 };
65
66
67 /* Initialize a process; called from the new process context */
68 struct init_process_request
69 {
70     OUT int          start_flags;  /* flags from startup info */
71     OUT int          hstdin;       /* handle for stdin */
72     OUT int          hstdout;      /* handle for stdout */
73     OUT int          hstderr;      /* handle for stderr */
74     OUT int          cmd_show;     /* main window show mode */
75     OUT void*        env_ptr;      /* pointer to environment (FIXME: hack) */
76     OUT char         cmdline[1];   /* command line */
77 };
78
79
80 /* Signal the end of the process initialization */
81 struct init_process_done_request
82 {
83     IN  int          dummy;
84 };
85
86
87 /* Initialize a thread; called from the child after fork()/clone() */
88 struct init_thread_request
89 {
90     IN  int          unix_pid;     /* Unix pid of new thread */
91     IN  void*        teb;          /* TEB of new thread (in thread address space) */
92     OUT void*        pid;          /* process id of the new thread's process */
93     OUT void*        tid;          /* thread id of the new thread */
94 };
95
96
97 /* Retrieve the thread buffer file descriptor */
98 /* The reply to this request is the first thing a newly */
99 /* created thread gets (without having to request it) */
100 struct get_thread_buffer_request
101 {
102     IN  int          dummy;
103 };
104
105
106 /* Terminate a process */
107 struct terminate_process_request
108 {
109     IN  int          handle;       /* process handle to terminate */
110     IN  int          exit_code;    /* process exit code */
111 };
112
113
114 /* Terminate a thread */
115 struct terminate_thread_request
116 {
117     IN  int          handle;       /* thread handle to terminate */
118     IN  int          exit_code;    /* thread exit code */
119 };
120
121
122 /* Retrieve information about a process */
123 struct get_process_info_request
124 {
125     IN  int          handle;       /* process handle */
126     OUT void*        pid;              /* server process id */
127     OUT int          exit_code;        /* process exit code */
128     OUT int          priority;         /* priority class */
129     OUT int          process_affinity; /* process affinity mask */
130     OUT int          system_affinity;  /* system affinity mask */
131 };
132
133
134 /* Set a process informations */
135 struct set_process_info_request
136 {
137     IN  int          handle;       /* process handle */
138     IN  int          mask;         /* setting mask (see below) */
139     IN  int          priority;     /* priority class */
140     IN  int          affinity;     /* affinity mask */
141 };
142 #define SET_PROCESS_INFO_PRIORITY 0x01
143 #define SET_PROCESS_INFO_AFFINITY 0x02
144
145
146 /* Retrieve information about a thread */
147 struct get_thread_info_request
148 {
149     IN  int          handle;       /* thread handle */
150     OUT void*        tid;          /* server thread id */
151     OUT int          exit_code;    /* thread exit code */
152     OUT int          priority;     /* thread priority level */
153 };
154
155
156 /* Set a thread informations */
157 struct set_thread_info_request
158 {
159     IN  int          handle;       /* thread handle */
160     IN  int          mask;         /* setting mask (see below) */
161     IN  int          priority;     /* priority class */
162     IN  int          affinity;     /* affinity mask */
163 };
164 #define SET_THREAD_INFO_PRIORITY 0x01
165 #define SET_THREAD_INFO_AFFINITY 0x02
166
167
168 /* Suspend a thread */
169 struct suspend_thread_request
170 {
171     IN  int          handle;       /* thread handle */
172     OUT int          count;        /* new suspend count */
173 };
174
175
176 /* Resume a thread */
177 struct resume_thread_request
178 {
179     IN  int          handle;       /* thread handle */
180     OUT int          count;        /* new suspend count */
181 };
182
183
184 /* Debugger support: freeze / unfreeze */
185 struct debugger_request
186 {
187     IN  int          op;           /* operation type */
188 };
189
190 enum debugger_op { DEBUGGER_FREEZE_ALL, DEBUGGER_UNFREEZE_ALL };
191
192
193 /* Queue an APC for a thread */
194 struct queue_apc_request
195 {
196     IN  int          handle;       /* thread handle */
197     IN  void*        func;         /* function to call */
198     IN  void*        param;        /* param for function to call */
199 };
200
201
202 /* Get list of APC to call */
203 struct get_apcs_request
204 {
205     OUT int          count;        /* number of apcs */
206     OUT void*        apcs[1];      /* async procedures to call */
207 };
208
209
210 /* Close a handle for the current process */
211 struct close_handle_request
212 {
213     IN  int          handle;       /* handle to close */
214 };
215
216
217 /* Get information about a handle */
218 struct get_handle_info_request
219 {
220     IN  int          handle;       /* handle we are interested in */
221     OUT int          flags;        /* handle flags */
222 };
223
224
225 /* Set a handle information */
226 struct set_handle_info_request
227 {
228     IN  int          handle;       /* handle we are interested in */
229     IN  int          flags;        /* new handle flags */
230     IN  int          mask;         /* mask for flags to set */
231 };
232
233
234 /* Duplicate a handle */
235 struct dup_handle_request
236 {
237     IN  int          src_process;  /* src process handle */
238     IN  int          src_handle;   /* src handle to duplicate */
239     IN  int          dst_process;  /* dst process handle */
240     IN  unsigned int access;       /* wanted access rights */
241     IN  int          inherit;      /* inherit flag */
242     IN  int          options;      /* duplicate options (see below) */
243     OUT int          handle;       /* duplicated handle in dst process */
244 };
245 #define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
246 #define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
247 #define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */
248
249
250 /* Open a handle to a process */
251 struct open_process_request
252 {
253     IN  void*        pid;          /* process id to open */
254     IN  unsigned int access;       /* wanted access rights */
255     IN  int          inherit;      /* inherit flag */
256     OUT int          handle;       /* handle to the process */
257 };
258
259
260 /* Wait for handles */
261 struct select_request
262 {
263     IN  int          count;        /* handles count */
264     IN  int          flags;        /* wait flags (see below) */
265     IN  int          timeout;      /* timeout in ms */
266     OUT int          signaled;     /* signaled handle */
267     IN  int          handles[1];   /* handles to select on */
268 };
269 #define SELECT_ALL       1
270 #define SELECT_ALERTABLE 2
271 #define SELECT_TIMEOUT   4
272
273
274 /* Create an event */
275 struct create_event_request
276 {
277     IN  int          manual_reset;  /* manual reset event */
278     IN  int          initial_state; /* initial state of the event */
279     IN  int          inherit;       /* inherit flag */
280     OUT int          handle;        /* handle to the event */
281     IN  char         name[1];       /* event name */
282 };
283
284 /* Event operation */
285 struct event_op_request
286 {
287     IN  int           handle;       /* handle to event */
288     IN  int           op;           /* event operation (see below) */
289 };
290 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
291
292
293 /* Open an event */
294 struct open_event_request
295 {
296     IN  unsigned int access;        /* wanted access rights */
297     IN  int          inherit;       /* inherit flag */
298     OUT int          handle;        /* handle to the event */
299     IN  char         name[1];       /* object name */
300 };
301
302
303 /* Create a mutex */
304 struct create_mutex_request
305 {
306     IN  int          owned;         /* initially owned? */
307     IN  int          inherit;       /* inherit flag */
308     OUT int          handle;        /* handle to the mutex */
309     IN  char         name[1];       /* mutex name */
310 };
311
312
313 /* Release a mutex */
314 struct release_mutex_request
315 {
316     IN  int          handle;        /* handle to the mutex */
317 };
318
319
320 /* Open a mutex */
321 struct open_mutex_request
322 {
323     IN  unsigned int access;        /* wanted access rights */
324     IN  int          inherit;       /* inherit flag */
325     OUT int          handle;        /* handle to the mutex */
326     IN  char         name[1];       /* object name */
327 };
328
329
330 /* Create a semaphore */
331 struct create_semaphore_request
332 {
333     IN  unsigned int initial;       /* initial count */
334     IN  unsigned int max;           /* maximum count */
335     IN  int          inherit;       /* inherit flag */
336     OUT int          handle;        /* handle to the semaphore */
337     IN  char         name[1];       /* semaphore name */
338 };
339
340
341 /* Release a semaphore */
342 struct release_semaphore_request
343 {
344     IN  int          handle;        /* handle to the semaphore */
345     IN  unsigned int count;         /* count to add to semaphore */
346     OUT unsigned int prev_count;    /* previous semaphore count */
347 };
348
349
350 /* Open a semaphore */
351 struct open_semaphore_request
352 {
353     IN  unsigned int access;        /* wanted access rights */
354     IN  int          inherit;       /* inherit flag */
355     OUT int          handle;        /* handle to the semaphore */
356     IN  char         name[1];       /* object name */
357 };
358
359
360 /* Create a file */
361 struct create_file_request
362 {
363     IN  unsigned int access;        /* wanted access rights */
364     IN  int          inherit;       /* inherit flag */
365     IN  unsigned int sharing;       /* sharing flags */
366     IN  int          create;        /* file create action */
367     IN  unsigned int attrs;         /* file attributes for creation */
368     OUT int          handle;        /* handle to the file */
369     IN  char         name[1];       /* file name */
370 };
371
372
373 /* Allocate a file handle for a Unix fd */
374 struct alloc_file_handle_request
375 {
376     IN  unsigned int access;        /* wanted access rights */
377     OUT int          handle;        /* handle to the file */
378 };
379
380
381 /* Get a Unix fd to read from a file */
382 struct get_read_fd_request
383 {
384     IN  int          handle;        /* handle to the file */
385 };
386
387
388 /* Get a Unix fd to write to a file */
389 struct get_write_fd_request
390 {
391     IN  int          handle;        /* handle to the file */
392 };
393
394
395 /* Set a file current position */
396 struct set_file_pointer_request
397 {
398     IN  int          handle;        /* handle to the file */
399     IN  int          low;           /* position low word */
400     IN  int          high;          /* position high word */
401     IN  int          whence;        /* whence to seek */
402     OUT int          new_low;       /* new position low word */
403     OUT int          new_high;      /* new position high word */
404 };
405
406
407 /* Truncate (or extend) a file */
408 struct truncate_file_request
409 {
410     IN  int          handle;        /* handle to the file */
411 };
412
413
414 /* Set a file access and modification times */
415 struct set_file_time_request
416 {
417     IN  int          handle;        /* handle to the file */
418     IN  time_t       access_time;   /* last access time */
419     IN  time_t       write_time;    /* last write time */
420 };
421
422
423 /* Flush a file buffers */
424 struct flush_file_request
425 {
426     IN  int          handle;        /* handle to the file */
427 };
428
429
430 /* Get information about a file */
431 struct get_file_info_request
432 {
433     IN  int          handle;        /* handle to the file */
434     OUT int          type;          /* file type */
435     OUT int          attr;          /* file attributes */
436     OUT time_t       access_time;   /* last access time */
437     OUT time_t       write_time;    /* last write time */
438     OUT int          size_high;     /* file size */
439     OUT int          size_low;      /* file size */
440     OUT int          links;         /* number of links */
441     OUT int          index_high;    /* unique index */
442     OUT int          index_low;     /* unique index */
443     OUT unsigned int serial;        /* volume serial number */
444 };
445
446
447 /* Lock a region of a file */
448 struct lock_file_request
449 {
450     IN  int          handle;        /* handle to the file */
451     IN  unsigned int offset_low;    /* offset of start of lock */
452     IN  unsigned int offset_high;   /* offset of start of lock */
453     IN  unsigned int count_low;     /* count of bytes to lock */
454     IN  unsigned int count_high;    /* count of bytes to lock */
455 };
456
457
458 /* Unlock a region of a file */
459 struct unlock_file_request
460 {
461     IN  int          handle;        /* handle to the file */
462     IN  unsigned int offset_low;    /* offset of start of unlock */
463     IN  unsigned int offset_high;   /* offset of start of unlock */
464     IN  unsigned int count_low;     /* count of bytes to unlock */
465     IN  unsigned int count_high;    /* count of bytes to unlock */
466 };
467
468
469 /* Create an anonymous pipe */
470 struct create_pipe_request
471 {
472     IN  int          inherit;       /* inherit flag */
473     OUT int          handle_read;   /* handle to the read-side of the pipe */
474     OUT int          handle_write;  /* handle to the write-side of the pipe */
475 };
476
477
478 /* Create a socket */
479 struct create_socket_request
480 {
481     IN  unsigned int access;        /* wanted access rights */
482     IN  int          inherit;       /* inherit flag */
483     IN  int          family;        /* family, see socket manpage */
484     IN  int          type;          /* type, see socket manpage */
485     IN  int          protocol;      /* protocol, see socket manpage */
486     OUT int          handle;        /* handle to the new socket */
487 };
488
489
490 /* Accept a socket */
491 struct accept_socket_request
492 {
493     IN  int          lhandle;       /* handle to the listening socket */
494     IN  unsigned int access;        /* wanted access rights */
495     IN  int          inherit;       /* inherit flag */
496     OUT int          handle;        /* handle to the new socket */
497 };
498
499
500 /* Set socket event parameters */
501 struct set_socket_event_request
502 {
503     IN  int          handle;        /* handle to the socket */
504     IN  unsigned int mask;          /* event mask */
505     IN  int          event;         /* event object */
506 };
507
508
509 /* Get socket event parameters */
510 struct get_socket_event_request
511 {
512     IN  int          handle;        /* handle to the socket */
513     IN  int          service;       /* clear pending? */
514     IN  int          s_event;       /* "expected" event object */
515     OUT unsigned int mask;          /* event mask */
516     OUT unsigned int pmask;         /* pending events */
517     OUT unsigned int state;         /* status bits */
518     OUT int          errors[1];     /* event errors */
519 };
520
521
522 /* Reenable pending socket events */
523 struct enable_socket_event_request
524 {
525     IN  int          handle;        /* handle to the socket */
526     IN  unsigned int mask;          /* events to re-enable */
527     IN  unsigned int sstate;        /* status bits to set */
528     IN  unsigned int cstate;        /* status bits to clear */
529 };
530
531
532 /* Allocate a console for the current process */
533 struct alloc_console_request
534 {
535     IN  unsigned int access;        /* wanted access rights */
536     IN  int          inherit;       /* inherit flag */
537     OUT int          handle_in;     /* handle to console input */
538     OUT int          handle_out;    /* handle to console output */
539 };
540
541
542 /* Free the console of the current process */
543 struct free_console_request
544 {
545     IN  int dummy;
546 };
547
548
549 /* Open a handle to the process console */
550 struct open_console_request
551 {
552     IN  int          output;        /* input or output? */
553     IN  unsigned int access;        /* wanted access rights */
554     IN  int          inherit;       /* inherit flag */
555     OUT int          handle;        /* handle to the console */
556 };
557
558
559 /* Set a console file descriptor */
560 struct set_console_fd_request
561 {
562     IN  int          handle;        /* handle to the console */
563     IN  int          file_handle;   /* handle of file to use as file descriptor */
564     IN  int          pid;           /* pid of xterm (hack) */
565 };
566
567
568 /* Get a console mode (input or output) */
569 struct get_console_mode_request
570 {
571     IN  int          handle;        /* handle to the console */
572     OUT int          mode;          /* console mode */
573 };
574
575
576 /* Set a console mode (input or output) */
577 struct set_console_mode_request
578 {
579     IN  int          handle;        /* handle to the console */
580     IN  int          mode;          /* console mode */
581 };
582
583
584 /* Set info about a console (output only) */
585 struct set_console_info_request
586 {
587     IN  int          handle;        /* handle to the console */
588     IN  int          mask;          /* setting mask (see below) */
589     IN  int          cursor_size;   /* size of cursor (percentage filled) */
590     IN  int          cursor_visible;/* cursor visibility flag */
591     IN  char         title[1];      /* console title */
592 };
593 #define SET_CONSOLE_INFO_CURSOR 0x01
594 #define SET_CONSOLE_INFO_TITLE  0x02
595
596 /* Get info about a console (output only) */
597 struct get_console_info_request
598 {
599     IN  int          handle;        /* handle to the console */
600     OUT int          cursor_size;   /* size of cursor (percentage filled) */
601     OUT int          cursor_visible;/* cursor visibility flag */
602     OUT int          pid;           /* pid of xterm (hack) */
603     OUT char         title[1];      /* console title */
604 };
605
606
607 /* Add input records to a console input queue */
608 struct write_console_input_request
609 {
610     IN  int          handle;        /* handle to the console input */
611     IN  int          count;         /* number of input records */
612     OUT int          written;       /* number of records written */
613  /* INPUT_RECORD records[0]; */     /* input records */
614 };
615
616 /* Fetch input records from a console input queue */
617 struct read_console_input_request
618 {
619     IN  int          handle;        /* handle to the console input */
620     IN  int          count;         /* max number of records to retrieve */
621     IN  int          flush;         /* flush the retrieved records from the queue? */
622     OUT int          read;          /* number of records read */
623  /* INPUT_RECORD records[0]; */     /* input records */
624 };
625
626
627 /* Create a change notification */
628 struct create_change_notification_request
629 {
630     IN  int          subtree;       /* watch all the subtree */
631     IN  int          filter;        /* notification filter */
632     OUT int          handle;        /* handle to the change notification */
633 };
634
635
636 /* Create a file mapping */
637 struct create_mapping_request
638 {
639     IN  int          size_high;     /* mapping size */
640     IN  int          size_low;      /* mapping size */
641     IN  int          protect;       /* protection flags (see below) */
642     IN  int          inherit;       /* inherit flag */
643     IN  int          file_handle;   /* file handle */
644     OUT int          handle;        /* handle to the mapping */
645     IN  char         name[1];       /* object name */
646 };
647 /* protection flags */
648 #define VPROT_READ       0x01
649 #define VPROT_WRITE      0x02
650 #define VPROT_EXEC       0x04
651 #define VPROT_WRITECOPY  0x08
652 #define VPROT_GUARD      0x10
653 #define VPROT_NOCACHE    0x20
654 #define VPROT_COMMITTED  0x40
655
656
657 /* Open a mapping */
658 struct open_mapping_request
659 {
660     IN  unsigned int access;        /* wanted access rights */
661     IN  int          inherit;       /* inherit flag */
662     OUT int          handle;        /* handle to the mapping */
663     IN  char         name[1];       /* object name */
664 };
665
666
667 /* Get information about a file mapping */
668 struct get_mapping_info_request
669 {
670     IN  int          handle;        /* handle to the mapping */
671     OUT int          size_high;     /* mapping size */
672     OUT int          size_low;      /* mapping size */
673     OUT int          protect;       /* protection flags */
674 };
675
676
677 /* Create a device */
678 struct create_device_request
679 {
680     IN  unsigned int access;        /* wanted access rights */
681     IN  int          inherit;       /* inherit flag */
682     IN  int          id;            /* client private id */
683     OUT int          handle;        /* handle to the device */
684 };
685
686
687 /* Create a snapshot */
688 struct create_snapshot_request
689 {
690     IN  int          inherit;       /* inherit flag */
691     IN  int          flags;         /* snapshot flags (TH32CS_*) */
692     OUT int          handle;        /* handle to the snapshot */
693 };
694
695
696 /* Get the next process from a snapshot */
697 struct next_process_request
698 {
699     IN  int          handle;        /* handle to the snapshot */
700     IN  int          reset;         /* reset snapshot position? */
701     OUT void*        pid;          /* process id */
702     OUT int          threads;      /* number of threads */
703     OUT int          priority;     /* process priority */
704 };
705
706
707 /* Wait for a debug event */
708 struct wait_debug_event_request
709 {
710     IN  int          timeout;      /* timeout in ms */
711     OUT int          code;         /* event code */
712     OUT void*        pid;          /* process id */
713     OUT void*        tid;          /* thread id */
714 /*  OUT union debug_event_data data; */
715 };
716
717
718 /* Send a debug event */
719 struct send_debug_event_request
720 {
721     IN  int          code;         /* event code */
722     OUT int          status;       /* event continuation status */
723 /*  IN  union debug_event_data data; */
724 };
725
726
727 /* definitions of the event data depending on the event code */
728 struct debug_event_exception
729 {
730     int        code;           /* exception code */
731     int        flags;          /* exception flags */
732     void      *record;         /* exception record ptr */
733     void      *addr;           /* exception address */
734     int        nb_params;      /* exceptions parameters */
735     int        params[15];
736     int        first_chance;   /* first chance to handle it? */
737 };
738 struct debug_event_create_thread
739 {
740     int         handle;     /* handle to the new thread */
741     void       *teb;        /* thread teb (in debugged process address space) */
742     void       *start;      /* thread startup routine */
743 };
744 struct debug_event_create_process
745 {
746     int         file;       /* handle to the process exe file */
747     int         process;    /* handle to the new process */
748     int         thread;     /* handle to the new thread */
749     void       *base;       /* base of executable image */
750     int         dbg_offset; /* offset of debug info in file */
751     int         dbg_size;   /* size of debug info */
752     void       *teb;        /* thread teb (in debugged process address space) */
753     void       *start;      /* thread startup routine */
754     void       *name;       /* image name (optional) */
755     int         unicode;    /* is it Unicode? */
756 };
757 struct debug_event_exit
758 {
759     int         exit_code;  /* thread or process exit code */
760 };
761 struct debug_event_load_dll
762 {
763     int         handle;     /* file handle for the dll */
764     void       *base;       /* base address of the dll */
765     int         dbg_offset; /* offset of debug info in file */
766     int         dbg_size;   /* size of debug info */
767     void       *name;       /* image name (optional) */
768     int         unicode;    /* is it Unicode? */
769 };
770 struct debug_event_unload_dll
771 {
772     void       *base;       /* base address of the dll */
773 };
774 struct debug_event_output_string
775 {
776     void       *string;     /* string to display (in debugged process address space) */
777     int         unicode;    /* is it Unicode? */
778     int         length;     /* string length */
779 };
780 struct debug_event_rip_info
781 {
782     int         error;      /* ??? */
783     int         type;       /* ??? */
784 };
785 union debug_event_data
786 {
787     struct debug_event_exception      exception;
788     struct debug_event_create_thread  create_thread;
789     struct debug_event_create_process create_process;
790     struct debug_event_exit           exit;
791     struct debug_event_load_dll       load_dll;
792     struct debug_event_unload_dll     unload_dll;
793     struct debug_event_output_string  output_string;
794     struct debug_event_rip_info       rip_info;
795 };
796
797
798 /* Continue a debug event */
799 struct continue_debug_event_request
800 {
801     IN  void*        pid;          /* process id to continue */
802     IN  void*        tid;          /* thread id to continue */
803     IN  int          status;       /* continuation status */
804 };
805
806
807 /* Start debugging an existing process */
808 struct debug_process_request
809 {
810     IN  void*        pid;          /* id of the process to debug */
811 };
812
813
814 /* Read data from a process address space */
815 struct read_process_memory_request
816 {
817     IN  int          handle;       /* process handle */
818     IN  void*        addr;         /* addr to read from (must be int-aligned) */
819     IN  int          len;          /* number of ints to read */
820     OUT unsigned int data[1];      /* result data */
821 };
822
823
824 /* Write data to a process address space */
825 struct write_process_memory_request
826 {
827     IN  int          handle;       /* process handle */
828     IN  void*        addr;         /* addr to write to (must be int-aligned) */
829     IN  int          len;          /* number of ints to write */
830     IN  unsigned int first_mask;   /* mask for first word */
831     IN  unsigned int last_mask;    /* mask for last word */
832     IN  unsigned int data[1];      /* data to write */
833 };
834
835
836 /* Create a registry key */
837 struct create_key_request
838 {
839     IN  int          parent;       /* handle to the parent key */
840     IN  unsigned int access;       /* desired access rights */
841     IN  unsigned int options;      /* creation options */
842     IN  time_t       modif;        /* last modification time */
843     OUT int          hkey;         /* handle to the created key */
844     OUT int          created;      /* has it been newly created? */
845     IN  path_t       name;         /* key name */
846     IN  WCHAR        class[1];     /* class name */
847 };
848
849
850 /* Open a registry key */
851 struct open_key_request
852 {
853     IN  int          parent;       /* handle to the parent key */
854     IN  unsigned int access;       /* desired access rights */
855     OUT int          hkey;         /* handle to the open key */
856     IN  path_t       name;         /* key name */
857 };
858
859
860 /* Delete a registry key */
861 struct delete_key_request
862 {
863     IN  int          hkey;         /* handle to the parent key */
864     IN  path_t       name;         /* key name */
865 };
866
867
868 /* Close a registry key */
869 struct close_key_request
870 {
871     IN  int          hkey;          /* key to close */
872 };
873
874
875 /* Enumerate registry subkeys */
876 struct enum_key_request
877 {
878     IN  int          hkey;         /* handle to registry key */
879     IN  int          index;        /* index of subkey */
880     OUT time_t       modif;        /* last modification time */
881     OUT path_t       name;         /* subkey name */
882     OUT WCHAR        class[1];     /* class name */
883 };
884
885
886 /* Query information about a registry key */
887 struct query_key_info_request
888 {
889     IN  int          hkey;         /* handle to registry key */
890     OUT int          subkeys;      /* number of subkeys */
891     OUT int          max_subkey;   /* longest subkey name */
892     OUT int          max_class;    /* longest class name */
893     OUT int          values;       /* number of values */
894     OUT int          max_value;    /* longest value name */
895     OUT int          max_data;     /* longest value data */
896     OUT time_t       modif;        /* last modification time */
897     OUT WCHAR        class[1];     /* class name */
898 };
899
900
901 /* Set a value of a registry key */
902 struct set_key_value_request
903 {
904     IN  int          hkey;         /* handle to registry key */
905     IN  int          type;         /* value type */
906     IN  int          len;          /* value data len */
907     IN  path_t       name;         /* value name */
908     IN  unsigned char data[1];     /* value data */
909 };
910
911
912 /* Retrieve the value of a registry key */
913 struct get_key_value_request
914 {
915     IN  int          hkey;         /* handle to registry key */
916     OUT int          type;         /* value type */
917     OUT int          len;          /* value data len */
918     IN  WCHAR        name[1];      /* value name */
919     OUT unsigned char data[1];     /* value data */
920 };
921
922
923 /* Enumerate a value of a registry key */
924 struct enum_key_value_request
925 {
926     IN  int          hkey;         /* handle to registry key */
927     IN  int          index;        /* value index */
928     OUT int          type;         /* value type */
929     OUT int          len;          /* value data len */
930     OUT path_t       name;         /* value name */
931     OUT unsigned char data[1];     /* value data */
932 };
933
934
935 /* Delete a value of a registry key */
936 struct delete_key_value_request
937 {
938     IN  int          hkey;         /* handle to registry key */
939     IN  path_t       name;         /* value name */
940 };
941
942
943 /* Load a registry branch from a file */
944 struct load_registry_request
945 {
946     IN  int          hkey;         /* root key to load to */
947     IN  int          file;         /* file to load from */
948     IN  path_t       name;         /* subkey name */
949 };
950
951
952 /* Save a registry branch to a file */
953 struct save_registry_request
954 {
955     IN  int          hkey;         /* key to save */
956     IN  int          file;         /* file to save to */
957 };
958
959
960 /* Set the current and saving level for the registry */
961 struct set_registry_levels_request
962 {
963     IN  int          current;      /* new current level */
964     IN  int          saving;       /* new saving level */
965 };
966
967
968 /* Everything below this line is generated automatically by tools/make_requests */
969 /* ### make_requests begin ### */
970
971 enum request
972 {
973     REQ_NEW_PROCESS,
974     REQ_NEW_THREAD,
975     REQ_SET_DEBUG,
976     REQ_INIT_PROCESS,
977     REQ_INIT_PROCESS_DONE,
978     REQ_INIT_THREAD,
979     REQ_GET_THREAD_BUFFER,
980     REQ_TERMINATE_PROCESS,
981     REQ_TERMINATE_THREAD,
982     REQ_GET_PROCESS_INFO,
983     REQ_SET_PROCESS_INFO,
984     REQ_GET_THREAD_INFO,
985     REQ_SET_THREAD_INFO,
986     REQ_SUSPEND_THREAD,
987     REQ_RESUME_THREAD,
988     REQ_DEBUGGER,
989     REQ_QUEUE_APC,
990     REQ_GET_APCS,
991     REQ_CLOSE_HANDLE,
992     REQ_GET_HANDLE_INFO,
993     REQ_SET_HANDLE_INFO,
994     REQ_DUP_HANDLE,
995     REQ_OPEN_PROCESS,
996     REQ_SELECT,
997     REQ_CREATE_EVENT,
998     REQ_EVENT_OP,
999     REQ_OPEN_EVENT,
1000     REQ_CREATE_MUTEX,
1001     REQ_RELEASE_MUTEX,
1002     REQ_OPEN_MUTEX,
1003     REQ_CREATE_SEMAPHORE,
1004     REQ_RELEASE_SEMAPHORE,
1005     REQ_OPEN_SEMAPHORE,
1006     REQ_CREATE_FILE,
1007     REQ_ALLOC_FILE_HANDLE,
1008     REQ_GET_READ_FD,
1009     REQ_GET_WRITE_FD,
1010     REQ_SET_FILE_POINTER,
1011     REQ_TRUNCATE_FILE,
1012     REQ_SET_FILE_TIME,
1013     REQ_FLUSH_FILE,
1014     REQ_GET_FILE_INFO,
1015     REQ_LOCK_FILE,
1016     REQ_UNLOCK_FILE,
1017     REQ_CREATE_PIPE,
1018     REQ_CREATE_SOCKET,
1019     REQ_ACCEPT_SOCKET,
1020     REQ_SET_SOCKET_EVENT,
1021     REQ_GET_SOCKET_EVENT,
1022     REQ_ENABLE_SOCKET_EVENT,
1023     REQ_ALLOC_CONSOLE,
1024     REQ_FREE_CONSOLE,
1025     REQ_OPEN_CONSOLE,
1026     REQ_SET_CONSOLE_FD,
1027     REQ_GET_CONSOLE_MODE,
1028     REQ_SET_CONSOLE_MODE,
1029     REQ_SET_CONSOLE_INFO,
1030     REQ_GET_CONSOLE_INFO,
1031     REQ_WRITE_CONSOLE_INPUT,
1032     REQ_READ_CONSOLE_INPUT,
1033     REQ_CREATE_CHANGE_NOTIFICATION,
1034     REQ_CREATE_MAPPING,
1035     REQ_OPEN_MAPPING,
1036     REQ_GET_MAPPING_INFO,
1037     REQ_CREATE_DEVICE,
1038     REQ_CREATE_SNAPSHOT,
1039     REQ_NEXT_PROCESS,
1040     REQ_WAIT_DEBUG_EVENT,
1041     REQ_SEND_DEBUG_EVENT,
1042     REQ_CONTINUE_DEBUG_EVENT,
1043     REQ_DEBUG_PROCESS,
1044     REQ_READ_PROCESS_MEMORY,
1045     REQ_WRITE_PROCESS_MEMORY,
1046     REQ_CREATE_KEY,
1047     REQ_OPEN_KEY,
1048     REQ_DELETE_KEY,
1049     REQ_CLOSE_KEY,
1050     REQ_ENUM_KEY,
1051     REQ_QUERY_KEY_INFO,
1052     REQ_SET_KEY_VALUE,
1053     REQ_GET_KEY_VALUE,
1054     REQ_ENUM_KEY_VALUE,
1055     REQ_DELETE_KEY_VALUE,
1056     REQ_LOAD_REGISTRY,
1057     REQ_SAVE_REGISTRY,
1058     REQ_SET_REGISTRY_LEVELS,
1059     REQ_NB_REQUESTS
1060 };
1061
1062 /* ### make_requests end ### */
1063 /* Everything above this line is generated automatically by tools/make_requests */
1064
1065
1066 /* client-side functions */
1067
1068 #ifndef __WINE_SERVER__
1069
1070 #include "thread.h"
1071
1072 /* client communication functions */
1073
1074 extern unsigned int server_call_noerr( enum request req );
1075 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1076 extern void server_protocol_error( const char *err, ... );
1077
1078 /* get a pointer to the request buffer */
1079 static inline void * WINE_UNUSED get_req_buffer(void)
1080 {
1081     return NtCurrentTeb()->buffer;
1082 }
1083
1084 /* maximum remaining size in the server buffer */
1085 static inline int WINE_UNUSED server_remaining( const void *ptr )
1086 {
1087     return (char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size - (char *)ptr;
1088 }
1089
1090 /* do a server call and set the last error code */
1091 static inline int server_call( enum request req )
1092 {
1093     unsigned int res = server_call_noerr( req );
1094     if (res) SetLastError( res );
1095     return res;
1096 }
1097
1098 extern int CLIENT_InitServer(void);
1099 extern int CLIENT_SetDebug( int level );
1100 extern int CLIENT_DebuggerRequest( int op );
1101 extern int CLIENT_InitThread(void);
1102 #endif  /* __WINE_SERVER__ */
1103
1104 #endif  /* __WINE_SERVER_H */