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