Add refcounting to the thread member of the pipe user.
[wine] / server / protocol.def
1 /* -*- C -*-
2  *
3  * Wine server protocol definition
4  *
5  * Copyright (C) 2001 Alexandre Julliard
6  *
7  * This file is used by tools/make_requests to build the
8  * protocol structures in include/wine/server_protocol.h
9  */
10
11 @HEADER  /* start of C declarations */
12
13 #include <stdlib.h>
14 #include <time.h>
15 #include "winbase.h"
16
17 struct request_header
18 {
19     int          req;          /* request code */
20     size_t       request_size; /* request variable part size */
21     size_t       reply_size;   /* reply variable part maximum size */
22 };
23
24 struct reply_header
25 {
26     unsigned int error;        /* error result */
27     size_t       reply_size;   /* reply variable part size */
28 };
29
30 /* placeholder structure for the maximum allowed request size */
31 /* this is used to construct the generic_request union */
32 struct request_max_size
33 {
34     int pad[16]; /* the max request size is 16 ints */
35 };
36
37 /* max size of the variable part of a request */
38 #define REQUEST_MAX_VAR_SIZE  1024
39
40 typedef int handle_t;
41 typedef unsigned short atom_t;
42 typedef unsigned int user_handle_t;
43
44 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
45 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
46
47
48 /* definitions of the event data depending on the event code */
49 struct debug_event_exception
50 {
51     EXCEPTION_RECORD record;   /* exception record */
52     int              first;    /* first chance exception? */
53 };
54 struct debug_event_create_thread
55 {
56     handle_t    handle;     /* handle to the new thread */
57     void       *teb;        /* thread teb (in debugged process address space) */
58     void       *start;      /* thread startup routine */
59 };
60 struct debug_event_create_process
61 {
62     handle_t    file;       /* handle to the process exe file */
63     handle_t    process;    /* handle to the new process */
64     handle_t    thread;     /* handle to the new thread */
65     void       *base;       /* base of executable image */
66     int         dbg_offset; /* offset of debug info in file */
67     int         dbg_size;   /* size of debug info */
68     void       *teb;        /* thread teb (in debugged process address space) */
69     void       *start;      /* thread startup routine */
70     void       *name;       /* image name (optional) */
71     int         unicode;    /* is it Unicode? */
72 };
73 struct debug_event_exit
74 {
75     int         exit_code;  /* thread or process exit code */
76 };
77 struct debug_event_load_dll
78 {
79     handle_t    handle;     /* file handle for the dll */
80     void       *base;       /* base address of the dll */
81     int         dbg_offset; /* offset of debug info in file */
82     int         dbg_size;   /* size of debug info */
83     void       *name;       /* image name (optional) */
84     int         unicode;    /* is it Unicode? */
85 };
86 struct debug_event_unload_dll
87 {
88     void       *base;       /* base address of the dll */
89 };
90 struct debug_event_output_string
91 {
92     void       *string;     /* string to display (in debugged process address space) */
93     int         unicode;    /* is it Unicode? */
94     int         length;     /* string length */
95 };
96 struct debug_event_rip_info
97 {
98     int         error;      /* ??? */
99     int         type;       /* ??? */
100 };
101 union debug_event_data
102 {
103     struct debug_event_exception      exception;
104     struct debug_event_create_thread  create_thread;
105     struct debug_event_create_process create_process;
106     struct debug_event_exit           exit;
107     struct debug_event_load_dll       load_dll;
108     struct debug_event_unload_dll     unload_dll;
109     struct debug_event_output_string  output_string;
110     struct debug_event_rip_info       rip_info;
111 };
112
113 /* debug event data */
114 typedef struct
115 {
116     int                      code;   /* event code */
117     union debug_event_data   info;   /* event information */
118 } debug_event_t;
119
120 /* structure used in sending an fd from client to server */
121 struct send_fd
122 {
123     void  *tid;  /* thread id */
124     int    fd;   /* file descriptor on client-side */
125 };
126
127 /* structure sent by the server on the wait fifo */
128 struct wake_up_reply
129 {
130     void *cookie;    /* magic cookie that was passed in select_request */
131     int   signaled;  /* wait result */
132 };
133
134 /* structure returned in the list of window properties */
135 typedef struct
136 {
137     atom_t         atom;     /* property atom */
138     short          string;   /* was atom a string originally? */
139     handle_t       handle;   /* handle stored in property */
140 } property_data_t;
141
142 /* structure to specify window rectangles */
143 typedef struct
144 {
145     int  left;
146     int  top;
147     int  right;
148     int  bottom;
149 } rectangle_t;
150
151 /* structure for console char/attribute info */
152 typedef struct
153 {
154     WCHAR          ch;
155     unsigned short attr;
156 } char_info_t;
157
158 /****************************************************************/
159 /* Request declarations */
160
161 /* Create a new process from the context of the parent */
162 @REQ(new_process)
163     int          inherit_all;  /* inherit all handles from parent */
164     int          create_flags; /* creation flags */
165     int          start_flags;  /* flags from startup info */
166     handle_t     exe_file;     /* file handle for main exe */
167     handle_t     hstdin;       /* handle for stdin */
168     handle_t     hstdout;      /* handle for stdout */
169     handle_t     hstderr;      /* handle for stderr */
170     int          cmd_show;     /* main window show mode */
171     VARARG(filename,string);   /* file name of main exe */
172 @REPLY
173     handle_t     info;         /* new process info handle */
174 @END
175
176
177 /* Retrieve information about a newly started process */
178 @REQ(get_new_process_info)
179     handle_t     info;         /* info handle returned from new_process_request */
180     int          pinherit;     /* process handle inherit flag */
181     int          tinherit;     /* thread handle inherit flag */
182 @REPLY
183     void*        pid;          /* process id */
184     handle_t     phandle;      /* process handle (in the current process) */
185     void*        tid;          /* thread id */
186     handle_t     thandle;      /* thread handle (in the current process) */
187     handle_t     event;        /* event handle to signal startup */
188 @END
189
190
191 /* Create a new thread from the context of the parent */
192 @REQ(new_thread)
193     int          suspend;      /* new thread should be suspended on creation */
194     int          inherit;      /* inherit flag */
195     int          request_fd;   /* fd for request pipe */
196 @REPLY
197     void*        tid;          /* thread id */
198     handle_t     handle;       /* thread handle (in the current process) */
199 @END
200
201
202 /* Signal that we are finished booting on the client side */
203 @REQ(boot_done)
204     int          debug_level;  /* new debug level */
205 @END
206
207
208 /* Initialize a process; called from the new process context */
209 @REQ(init_process)
210     void*        ldt_copy;     /* addr of LDT copy */
211     int          ppid;         /* parent Unix pid */
212 @REPLY
213     int          create_flags; /* creation flags */
214     int          start_flags;  /* flags from startup info */
215     unsigned int server_start; /* server start time (GetTickCount) */
216     handle_t     exe_file;     /* file handle for main exe */
217     handle_t     hstdin;       /* handle for stdin */
218     handle_t     hstdout;      /* handle for stdout */
219     handle_t     hstderr;      /* handle for stderr */
220     int          cmd_show;     /* main window show mode */
221     VARARG(filename,string);   /* file name of main exe */
222 @END
223
224
225 /* Signal the end of the process initialization */
226 @REQ(init_process_done)
227     void*        module;       /* main module base address */
228     void*        entry;        /* process entry point */
229     void*        name;         /* ptr to ptr to name (in process addr space) */
230     handle_t     exe_file;     /* file handle for main exe */
231     int          gui;          /* is it a GUI process? */
232 @REPLY
233     int          debugged;     /* being debugged? */
234 @END
235
236
237 /* Initialize a thread; called from the child after fork()/clone() */
238 @REQ(init_thread)
239     int          unix_pid;     /* Unix pid of new thread */
240     void*        teb;          /* TEB of new thread (in thread address space) */
241     void*        entry;        /* thread entry point (in thread address space) */
242     int          reply_fd;     /* fd for reply pipe */
243     int          wait_fd;      /* fd for blocking calls pipe */
244 @REPLY
245     void*        pid;          /* process id of the new thread's process */
246     void*        tid;          /* thread id of the new thread */
247     int          boot;         /* is this the boot thread? */
248     int          version;      /* protocol version */
249 @END
250
251
252 /* Terminate a process */
253 @REQ(terminate_process)
254     handle_t     handle;       /* process handle to terminate */
255     int          exit_code;    /* process exit code */
256 @REPLY
257     int          self;         /* suicide? */
258 @END
259
260
261 /* Terminate a thread */
262 @REQ(terminate_thread)
263     handle_t     handle;       /* thread handle to terminate */
264     int          exit_code;    /* thread exit code */
265 @REPLY
266     int          self;         /* suicide? */
267     int          last;         /* last thread in this process? */
268 @END
269
270
271 /* Retrieve information about a process */
272 @REQ(get_process_info)
273     handle_t     handle;           /* process handle */
274 @REPLY
275     void*        pid;              /* server process id */
276     int          debugged;         /* debugged? */
277     int          exit_code;        /* process exit code */
278     int          priority;         /* priority class */
279     int          process_affinity; /* process affinity mask */
280     int          system_affinity;  /* system affinity mask */
281 @END
282
283
284 /* Set a process informations */
285 @REQ(set_process_info)
286     handle_t     handle;       /* process handle */
287     int          mask;         /* setting mask (see below) */
288     int          priority;     /* priority class */
289     int          affinity;     /* affinity mask */
290 @END
291 #define SET_PROCESS_INFO_PRIORITY 0x01
292 #define SET_PROCESS_INFO_AFFINITY 0x02
293
294
295 /* Retrieve information about a thread */
296 @REQ(get_thread_info)
297     handle_t     handle;       /* thread handle */
298     void*        tid_in;       /* thread id (optional) */
299 @REPLY
300     void*        tid;          /* server thread id */
301     void*        teb;          /* thread teb pointer */
302     int          exit_code;    /* thread exit code */
303     int          priority;     /* thread priority level */
304 @END
305
306
307 /* Set a thread informations */
308 @REQ(set_thread_info)
309     handle_t     handle;       /* thread handle */
310     int          mask;         /* setting mask (see below) */
311     int          priority;     /* priority class */
312     int          affinity;     /* affinity mask */
313 @END
314 #define SET_THREAD_INFO_PRIORITY 0x01
315 #define SET_THREAD_INFO_AFFINITY 0x02
316
317
318 /* Suspend a thread */
319 @REQ(suspend_thread)
320     handle_t     handle;       /* thread handle */
321 @REPLY
322     int          count;        /* new suspend count */
323 @END
324
325
326 /* Resume a thread */
327 @REQ(resume_thread)
328     handle_t     handle;       /* thread handle */
329 @REPLY
330     int          count;        /* new suspend count */
331 @END
332
333
334 /* Notify the server that a dll has been loaded */
335 @REQ(load_dll)
336     handle_t     handle;       /* file handle */
337     void*        base;         /* base address */
338     int          dbg_offset;   /* debug info offset */
339     int          dbg_size;     /* debug info size */
340     void*        name;         /* ptr to ptr to name (in process addr space) */
341 @END
342
343
344 /* Notify the server that a dll is being unloaded */
345 @REQ(unload_dll)
346     void*        base;         /* base address */
347 @END
348
349
350 /* Queue an APC for a thread */
351 @REQ(queue_apc)
352     handle_t     handle;       /* thread handle */
353     int          user;         /* user or system apc? */
354     void*        func;         /* function to call */
355     void*        param;        /* param for function to call */
356 @END
357
358
359 /* Get next APC to call */
360 @REQ(get_apc)
361     int          alertable;    /* is thread alertable? */
362 @REPLY
363     void*        func;         /* function to call */
364     int          type;         /* function type */
365     VARARG(args,ptrs);         /* function arguments */
366 @END
367 enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC };
368
369
370 /* Close a handle for the current process */
371 @REQ(close_handle)
372     handle_t     handle;       /* handle to close */
373 @REPLY
374     int          fd;           /* associated fd to close */
375 @END
376
377
378 /* Set a handle information */
379 @REQ(set_handle_info)
380     handle_t     handle;       /* handle we are interested in */
381     int          flags;        /* new handle flags */
382     int          mask;         /* mask for flags to set */
383     int          fd;           /* file descriptor or -1 */
384 @REPLY
385     int          old_flags;    /* old flag value */
386     int          cur_fd;       /* current file descriptor */
387 @END
388
389
390 /* Duplicate a handle */
391 @REQ(dup_handle)
392     handle_t     src_process;  /* src process handle */
393     handle_t     src_handle;   /* src handle to duplicate */
394     handle_t     dst_process;  /* dst process handle */
395     unsigned int access;       /* wanted access rights */
396     int          inherit;      /* inherit flag */
397     int          options;      /* duplicate options (see below) */
398 @REPLY
399     handle_t     handle;       /* duplicated handle in dst process */
400     int          fd;           /* associated fd to close */
401 @END
402 #define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
403 #define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
404 #define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */
405
406
407 /* Open a handle to a process */
408 @REQ(open_process)
409     void*        pid;          /* process id to open */
410     unsigned int access;       /* wanted access rights */
411     int          inherit;      /* inherit flag */
412 @REPLY
413     handle_t     handle;       /* handle to the process */
414 @END
415
416
417 /* Wait for handles */
418 @REQ(select)
419     int          flags;        /* wait flags (see below) */
420     void*        cookie;       /* magic cookie to return to client */
421     int          sec;          /* absolute timeout */
422     int          usec;         /* absolute timeout */
423     VARARG(handles,handles);   /* handles to select on */
424 @END
425 #define SELECT_ALL           1
426 #define SELECT_ALERTABLE     2
427 #define SELECT_INTERRUPTIBLE 4
428 #define SELECT_TIMEOUT       8
429
430
431 /* Create an event */
432 @REQ(create_event)
433     int          manual_reset;  /* manual reset event */
434     int          initial_state; /* initial state of the event */
435     int          inherit;       /* inherit flag */
436     VARARG(name,unicode_str);   /* object name */
437 @REPLY
438     handle_t     handle;        /* handle to the event */
439 @END
440
441 /* Event operation */
442 @REQ(event_op)
443     handle_t      handle;       /* handle to event */
444     int           op;           /* event operation (see below) */
445 @END
446 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
447
448
449 /* Open an event */
450 @REQ(open_event)
451     unsigned int access;        /* wanted access rights */
452     int          inherit;       /* inherit flag */
453     VARARG(name,unicode_str);   /* object name */
454 @REPLY
455     handle_t     handle;        /* handle to the event */
456 @END
457
458
459 /* Create a mutex */
460 @REQ(create_mutex)
461     int          owned;         /* initially owned? */
462     int          inherit;       /* inherit flag */
463     VARARG(name,unicode_str);   /* object name */
464 @REPLY
465     handle_t     handle;        /* handle to the mutex */
466 @END
467
468
469 /* Release a mutex */
470 @REQ(release_mutex)
471     handle_t     handle;        /* handle to the mutex */
472 @END
473
474
475 /* Open a mutex */
476 @REQ(open_mutex)
477     unsigned int access;        /* wanted access rights */
478     int          inherit;       /* inherit flag */
479     VARARG(name,unicode_str);   /* object name */
480 @REPLY
481     handle_t     handle;        /* handle to the mutex */
482 @END
483
484
485 /* Create a semaphore */
486 @REQ(create_semaphore)
487     unsigned int initial;       /* initial count */
488     unsigned int max;           /* maximum count */
489     int          inherit;       /* inherit flag */
490     VARARG(name,unicode_str);   /* object name */
491 @REPLY
492     handle_t     handle;        /* handle to the semaphore */
493 @END
494
495
496 /* Release a semaphore */
497 @REQ(release_semaphore)
498     handle_t     handle;        /* handle to the semaphore */
499     unsigned int count;         /* count to add to semaphore */
500 @REPLY
501     unsigned int prev_count;    /* previous semaphore count */
502 @END
503
504
505 /* Open a semaphore */
506 @REQ(open_semaphore)
507     unsigned int access;        /* wanted access rights */
508     int          inherit;       /* inherit flag */
509     VARARG(name,unicode_str);   /* object name */
510 @REPLY
511     handle_t     handle;        /* handle to the semaphore */
512 @END
513
514
515 /* Create a file */
516 @REQ(create_file)
517     unsigned int access;        /* wanted access rights */
518     int          inherit;       /* inherit flag */
519     unsigned int sharing;       /* sharing flags */
520     int          create;        /* file create action */
521     unsigned int attrs;         /* file attributes for creation */
522     int          drive_type;    /* type of drive the file is on */
523     VARARG(filename,string);    /* file name */
524 @REPLY
525     handle_t     handle;        /* handle to the file */
526 @END
527
528
529 /* Allocate a file handle for a Unix fd */
530 @REQ(alloc_file_handle)
531     unsigned int access;        /* wanted access rights */
532     int          inherit;       /* inherit flag */
533     int          fd;            /* file descriptor on the client side */
534 @REPLY
535     handle_t     handle;        /* handle to the file */
536 @END
537
538
539 /* Get a Unix fd to access a file */
540 @REQ(get_handle_fd)
541     handle_t     handle;        /* handle to the file */
542     unsigned int access;        /* wanted access rights */
543 @REPLY
544     int          fd;            /* file descriptor */
545     int          type;          /* the type of file (see below) */
546     int          flags;         /* file read/write flags (see below) */
547 @END
548 enum fd_type
549 {
550     FD_TYPE_INVALID,
551     FD_TYPE_DEFAULT,
552     FD_TYPE_CONSOLE
553 };
554 #define FD_FLAG_OVERLAPPED 0x01
555 #define FD_FLAG_TIMEOUT    0x02
556
557
558 /* Set a file current position */
559 @REQ(set_file_pointer)
560     handle_t     handle;        /* handle to the file */
561     int          low;           /* position low word */
562     int          high;          /* position high word */
563     int          whence;        /* whence to seek */
564 @REPLY
565     int          new_low;       /* new position low word */
566     int          new_high;      /* new position high word */
567 @END
568
569
570 /* Truncate (or extend) a file */
571 @REQ(truncate_file)
572     handle_t     handle;        /* handle to the file */
573 @END
574
575
576 /* Set a file access and modification times */
577 @REQ(set_file_time)
578     handle_t     handle;        /* handle to the file */
579     time_t       access_time;   /* last access time */
580     time_t       write_time;    /* last write time */
581 @END
582
583
584 /* Flush a file buffers */
585 @REQ(flush_file)
586     handle_t     handle;        /* handle to the file */
587 @END
588
589
590 /* Get information about a file */
591 @REQ(get_file_info)
592     handle_t     handle;        /* handle to the file */
593 @REPLY
594     int          type;          /* file type */
595     int          attr;          /* file attributes */
596     time_t       access_time;   /* last access time */
597     time_t       write_time;    /* last write time */
598     int          size_high;     /* file size */
599     int          size_low;      /* file size */
600     int          links;         /* number of links */
601     int          index_high;    /* unique index */
602     int          index_low;     /* unique index */
603     unsigned int serial;        /* volume serial number */
604 @END
605
606
607 /* Lock a region of a file */
608 @REQ(lock_file)
609     handle_t     handle;        /* handle to the file */
610     unsigned int offset_low;    /* offset of start of lock */
611     unsigned int offset_high;   /* offset of start of lock */
612     unsigned int count_low;     /* count of bytes to lock */
613     unsigned int count_high;    /* count of bytes to lock */
614 @END
615
616
617 /* Unlock a region of a file */
618 @REQ(unlock_file)
619     handle_t     handle;        /* handle to the file */
620     unsigned int offset_low;    /* offset of start of unlock */
621     unsigned int offset_high;   /* offset of start of unlock */
622     unsigned int count_low;     /* count of bytes to unlock */
623     unsigned int count_high;    /* count of bytes to unlock */
624 @END
625
626
627 /* Create an anonymous pipe */
628 @REQ(create_pipe)
629     int          inherit;       /* inherit flag */
630 @REPLY
631     handle_t     handle_read;   /* handle to the read-side of the pipe */
632     handle_t     handle_write;  /* handle to the write-side of the pipe */
633 @END
634
635
636 /* Create a socket */
637 @REQ(create_socket)
638     unsigned int access;        /* wanted access rights */
639     int          inherit;       /* inherit flag */
640     int          family;        /* family, see socket manpage */
641     int          type;          /* type, see socket manpage */
642     int          protocol;      /* protocol, see socket manpage */
643     unsigned int flags;         /* socket flags */
644 @REPLY
645     handle_t     handle;        /* handle to the new socket */
646 @END
647
648
649 /* Accept a socket */
650 @REQ(accept_socket)
651     handle_t     lhandle;       /* handle to the listening socket */
652     unsigned int access;        /* wanted access rights */
653     int          inherit;       /* inherit flag */
654 @REPLY
655     handle_t     handle;        /* handle to the new socket */
656 @END
657
658
659 /* Set socket event parameters */
660 @REQ(set_socket_event)
661     handle_t     handle;        /* handle to the socket */
662     unsigned int mask;          /* event mask */
663     handle_t     event;         /* event object */
664 @END
665
666
667 /* Get socket event parameters */
668 @REQ(get_socket_event)
669     handle_t     handle;        /* handle to the socket */
670     int          service;       /* clear pending? */
671     handle_t     s_event;       /* "expected" event object */
672     handle_t     c_event;       /* event to clear */
673 @REPLY
674     unsigned int mask;          /* event mask */
675     unsigned int pmask;         /* pending events */
676     unsigned int state;         /* status bits */
677     VARARG(errors,ints);        /* event errors */
678 @END
679
680
681 /* Reenable pending socket events */
682 @REQ(enable_socket_event)
683     handle_t     handle;        /* handle to the socket */
684     unsigned int mask;          /* events to re-enable */
685     unsigned int sstate;        /* status bits to set */
686     unsigned int cstate;        /* status bits to clear */
687 @END
688
689
690 /* Allocate a console (only used by a console renderer) */
691 @REQ(alloc_console)
692     unsigned int access;        /* wanted access rights */
693     int          inherit;       /* inherit flag */
694     void*        pid;           /* pid of process which shall be attached to the console */
695 @REPLY
696     handle_t     handle_in;     /* handle to console input */
697     handle_t     event;         /* handle to renderer events change notification */
698 @END
699
700
701 /* Free the console of the current process */
702 @REQ(free_console)
703 @END
704
705
706 #define CONSOLE_RENDERER_NONE_EVENT        0x00
707 #define CONSOLE_RENDERER_TITLE_EVENT       0x01
708 #define CONSOLE_RENDERER_ACTIVE_SB_EVENT   0x02
709 #define CONSOLE_RENDERER_SB_RESIZE_EVENT   0x03
710 #define CONSOLE_RENDERER_UPDATE_EVENT      0x04
711 #define CONSOLE_RENDERER_CURSOR_POS_EVENT  0x05
712 #define CONSOLE_RENDERER_CURSOR_GEOM_EVENT 0x06
713 #define CONSOLE_RENDERER_DISPLAY_EVENT     0x07
714 #define CONSOLE_RENDERER_EXIT_EVENT        0x08
715 struct console_renderer_event
716 {
717     short event;
718     union
719     {
720         struct update
721         {
722             short top;
723             short bottom;
724         } update;
725         struct resize
726         {
727             short width;
728             short height;
729         } resize;
730         struct cursor_pos
731         {
732             short x;
733             short y;
734         } cursor_pos;
735         struct cursor_geom
736         {
737             short visible;
738             short size;
739         } cursor_geom;
740         struct display
741         {
742             short left;
743             short top;
744             short width;
745             short height;
746         } display;
747     } u;
748 };
749
750 /* retrieve console events for the renderer */
751 @REQ(get_console_renderer_events)
752     handle_t     handle;        /* handle to console input events */
753 @REPLY
754     VARARG(data,bytes);         /* the various console_renderer_events */
755 @END
756
757
758 /* Open a handle to the process console */
759 @REQ(open_console)
760     int          from;          /* 0 (resp 1) input (resp output) of current process console */
761                                 /* otherwise console_in handle to get active screen buffer? */
762     unsigned int access;        /* wanted access rights */
763     int          inherit;       /* inherit flag */
764     int          share;         /* share mask (only for output handles) */
765 @REPLY
766     handle_t     handle;        /* handle to the console */
767 @END
768
769
770 /* Get a console mode (input or output) */
771 @REQ(get_console_mode)
772     handle_t     handle;        /* handle to the console */
773 @REPLY
774     int          mode;          /* console mode */
775 @END
776
777
778 /* Set a console mode (input or output) */
779 @REQ(set_console_mode)
780     handle_t     handle;        /* handle to the console */
781     int          mode;          /* console mode */
782 @END
783
784
785 /* Set info about a console (input only) */
786 @REQ(set_console_input_info)
787     handle_t     handle;        /* handle to console input, or 0 for process' console */
788     int          mask;          /* setting mask (see below) */
789     handle_t     active_sb;     /* active screen buffer */
790     int          history_mode;  /* whether we duplicate lines in history */
791     int          history_size;  /* number of lines in history */
792     VARARG(title,unicode_str);  /* console title */
793 @END
794 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
795 #define SET_CONSOLE_INPUT_INFO_TITLE            0x02
796 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
797 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
798
799
800 /* Get info about a console (input only) */
801 @REQ(get_console_input_info)
802     handle_t     handle;        /* handle to console input, or 0 for process' console */
803 @REPLY
804     int          history_mode;  /* whether we duplicate lines in history */
805     int          history_size;  /* number of lines in history */
806     int          history_index; /* number of used lines in history */
807     VARARG(title,unicode_str);  /* console title */
808 @END
809
810
811 /* appends a string to console's history */
812 @REQ(append_console_input_history)
813     handle_t     handle;        /* handle to console input, or 0 for process' console */
814     VARARG(line,unicode_str);   /* line to add */
815 @END
816
817
818 /* appends a string to console's history */
819 @REQ(get_console_input_history)
820     handle_t     handle;        /* handle to console input, or 0 for process' console */
821     int          index;         /* index to get line from */
822 @REPLY
823     int          total;         /* total length of line in Unicode chars */
824     VARARG(line,unicode_str);   /* line to add */
825 @END
826
827
828 /* creates a new screen buffer on process' console */
829 @REQ(create_console_output)
830     handle_t     handle_in;     /* handle to console input, or 0 for process' console */
831     int          access;        /* wanted access rights */
832     int          share;         /* sharing credentials */
833     int          inherit;       /* inherit flag */
834 @REPLY
835     handle_t     handle_out;    /* handle to the screen buffer */
836 @END
837
838
839 /* Set info about a console (output only) */
840 @REQ(set_console_output_info)
841     handle_t     handle;        /* handle to the console */
842     int          mask;          /* setting mask (see below) */
843     short int    cursor_size;   /* size of cursor (percentage filled) */
844     short int    cursor_visible;/* cursor visibility flag */
845     short int    cursor_x;      /* position of cursor (x, y) */
846     short int    cursor_y;
847     short int    width;         /* width of the screen buffer */
848     short int    height;        /* height of the screen buffer */
849     short int    attr;          /* default attribute */
850     short int    win_left;      /* window actually displayed by renderer */
851     short int    win_top;       /* the rect area is expressed withing the */
852     short int    win_right;     /* boundaries of the screen buffer */
853     short int    win_bottom;
854     short int    max_width;     /* maximum size (width x height) for the window */
855     short int    max_height;
856 @END
857 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
858 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
859 #define SET_CONSOLE_OUTPUT_INFO_SIZE            0x04
860 #define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
861 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
862 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20
863
864
865 /* Get info about a console (output only) */
866 @REQ(get_console_output_info)
867     handle_t     handle;        /* handle to the console */
868 @REPLY
869     short int    cursor_size;   /* size of cursor (percentage filled) */
870     short int    cursor_visible;/* cursor visibility flag */
871     short int    cursor_x;      /* position of cursor (x, y) */
872     short int    cursor_y;
873     short int    width;         /* width of the screen buffer */
874     short int    height;        /* height of the screen buffer */
875     short int    attr;          /* default attribute */
876     short int    win_left;      /* window actually displayed by renderer */
877     short int    win_top;       /* the rect area is expressed withing the */
878     short int    win_right;     /* boundaries of the screen buffer */
879     short int    win_bottom;
880     short int    max_width;     /* maximum size (width x height) for the window */
881     short int    max_height;
882 @END
883
884 /* Add input records to a console input queue */
885 @REQ(write_console_input)
886     handle_t     handle;        /* handle to the console input */
887     VARARG(rec,input_records);  /* input records */
888 @REPLY
889     int          written;       /* number of records written */
890 @END
891
892
893 /* Fetch input records from a console input queue */
894 @REQ(read_console_input)
895     handle_t     handle;        /* handle to the console input */
896     int          flush;         /* flush the retrieved records from the queue? */
897 @REPLY
898     int          read;          /* number of records read */
899     VARARG(rec,input_records);  /* input records */
900 @END
901
902
903 /* write data (chars and/or attributes) in a screen buffer */
904 @REQ(write_console_output)
905     handle_t     handle;        /* handle to the console output */
906     int          x;             /* position where to start writing */
907     int          y;
908     int          mode;          /* char info (see below) */
909     int          wrap;          /* wrap around at end of line? */
910     VARARG(data,bytes);         /* info to write */
911 @REPLY
912     int          written;       /* number of char infos actually written */
913     int          width;         /* width of screen buffer */
914     int          height;        /* height of screen buffer */
915 @END
916 enum char_info_mode
917 {
918     CHAR_INFO_MODE_TEXT,        /* characters only */
919     CHAR_INFO_MODE_ATTR,        /* attributes only */
920     CHAR_INFO_MODE_TEXTATTR,    /* both characters and attributes */
921     CHAR_INFO_MODE_TEXTSTDATTR  /* characters but use standard attributes */
922 };
923
924
925 /* fill a screen buffer with constant data (chars and/or attributes) */
926 @REQ(fill_console_output)
927     handle_t     handle;        /* handle to the console output */
928     int          x;             /* position where to start writing */
929     int          y;
930     int          mode;          /* char info mode */
931     int          count;         /* number to write */
932     int          wrap;          /* wrap around at end of line? */
933     char_info_t  data;          /* data to write */
934 @REPLY
935     int          written;       /* number of char infos actually written */
936 @END
937
938
939 /* read data (chars and/or attributes) from a screen buffer */
940 @REQ(read_console_output)
941     handle_t     handle;        /* handle to the console output */
942     int          x;             /* position (x,y) where to start reading */
943     int          y;
944     int          mode;          /* char info mode */
945     int          wrap;          /* wrap around at end of line? */
946 @REPLY
947     int          width;         /* width of screen buffer */
948     int          height;        /* height of screen buffer */
949     VARARG(data,bytes);
950 @END
951
952 /* move a rect (of data) in screen buffer content */
953 @REQ(move_console_output)
954     handle_t     handle;        /* handle to the console output */
955     short int    x_src;         /* position (x, y) of rect to start moving from */
956     short int    y_src;
957     short int    x_dst;         /* position (x, y) of rect to move to */
958     short int    y_dst;
959     short int    w;             /* size of the rect (width, height) to move */
960     short int    h;
961 @END
962
963
964 /* Create a change notification */
965 @REQ(create_change_notification)
966     int          subtree;       /* watch all the subtree */
967     int          filter;        /* notification filter */
968 @REPLY
969     handle_t     handle;        /* handle to the change notification */
970 @END
971
972
973 /* Create a file mapping */
974 @REQ(create_mapping)
975     int          size_high;     /* mapping size */
976     int          size_low;      /* mapping size */
977     int          protect;       /* protection flags (see below) */
978     int          inherit;       /* inherit flag */
979     handle_t     file_handle;   /* file handle */
980     VARARG(name,unicode_str);   /* object name */
981 @REPLY
982     handle_t     handle;        /* handle to the mapping */
983 @END
984 /* protection flags */
985 #define VPROT_READ       0x01
986 #define VPROT_WRITE      0x02
987 #define VPROT_EXEC       0x04
988 #define VPROT_WRITECOPY  0x08
989 #define VPROT_GUARD      0x10
990 #define VPROT_NOCACHE    0x20
991 #define VPROT_COMMITTED  0x40
992 #define VPROT_IMAGE      0x80
993
994
995 /* Open a mapping */
996 @REQ(open_mapping)
997     unsigned int access;        /* wanted access rights */
998     int          inherit;       /* inherit flag */
999     VARARG(name,unicode_str);   /* object name */
1000 @REPLY
1001     handle_t     handle;        /* handle to the mapping */
1002 @END
1003
1004
1005 /* Get information about a file mapping */
1006 @REQ(get_mapping_info)
1007     handle_t     handle;        /* handle to the mapping */
1008 @REPLY
1009     int          size_high;     /* mapping size */
1010     int          size_low;      /* mapping size */
1011     int          protect;       /* protection flags */
1012     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1013     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1014     handle_t     shared_file;   /* shared mapping file handle */
1015     int          shared_size;   /* shared mapping size */
1016     int          drive_type;    /* type of drive the file is on */
1017 @END
1018
1019
1020 /* Create a device */
1021 @REQ(create_device)
1022     unsigned int access;        /* wanted access rights */
1023     int          inherit;       /* inherit flag */
1024     int          id;            /* client private id */
1025 @REPLY
1026     handle_t     handle;        /* handle to the device */
1027 @END
1028
1029
1030 /* Create a snapshot */
1031 @REQ(create_snapshot)
1032     int          inherit;       /* inherit flag */
1033     int          flags;         /* snapshot flags (TH32CS_*) */
1034     void*        pid;           /* process id */
1035 @REPLY
1036     handle_t     handle;        /* handle to the snapshot */
1037 @END
1038
1039
1040 /* Get the next process from a snapshot */
1041 @REQ(next_process)
1042     handle_t     handle;        /* handle to the snapshot */
1043     int          reset;         /* reset snapshot position? */
1044 @REPLY
1045     int          count;         /* process usage count */
1046     void*        pid;           /* process id */
1047     int          threads;       /* number of threads */
1048     int          priority;      /* process priority */
1049 @END
1050
1051
1052 /* Get the next thread from a snapshot */
1053 @REQ(next_thread)
1054     handle_t     handle;        /* handle to the snapshot */
1055     int          reset;         /* reset snapshot position? */
1056 @REPLY
1057     int          count;         /* thread usage count */
1058     void*        pid;           /* process id */
1059     void*        tid;           /* thread id */
1060     int          base_pri;      /* base priority */
1061     int          delta_pri;     /* delta priority */
1062 @END
1063
1064
1065 /* Get the next module from a snapshot */
1066 @REQ(next_module)
1067     handle_t     handle;        /* handle to the snapshot */
1068     int          reset;         /* reset snapshot position? */
1069 @REPLY
1070     void*        pid;           /* process id */
1071     void*        base;          /* module base address */
1072 @END
1073
1074
1075 /* Wait for a debug event */
1076 @REQ(wait_debug_event)
1077     int           get_handle;  /* should we alloc a handle for waiting? */
1078 @REPLY
1079     void*         pid;         /* process id */
1080     void*         tid;         /* thread id */
1081     handle_t      wait;        /* wait handle if no event ready */
1082     VARARG(event,debug_event); /* debug event data */
1083 @END
1084
1085
1086 /* Queue an exception event */
1087 @REQ(queue_exception_event)
1088     int              first;    /* first chance exception? */
1089     VARARG(record,exc_event);  /* thread context followed by exception record */
1090 @REPLY
1091     handle_t         handle;   /* handle to the queued event */
1092 @END
1093
1094
1095 /* Retrieve the status of an exception event */
1096 @REQ(get_exception_status)
1097     handle_t         handle;   /* handle to the queued event */
1098 @REPLY
1099     int              status;   /* event continuation status */
1100     VARARG(context,context);   /* modified thread context */
1101 @END
1102
1103
1104 /* Send an output string to the debugger */
1105 @REQ(output_debug_string)
1106     void*         string;      /* string to display (in debugged process address space) */
1107     int           unicode;     /* is it Unicode? */
1108     int           length;      /* string length */
1109 @END
1110
1111
1112 /* Continue a debug event */
1113 @REQ(continue_debug_event)
1114     void*        pid;          /* process id to continue */
1115     void*        tid;          /* thread id to continue */
1116     int          status;       /* continuation status */
1117 @END
1118
1119
1120 /* Start debugging an existing process */
1121 @REQ(debug_process)
1122     void*        pid;          /* id of the process to debug */
1123 @END
1124
1125
1126 /* Read data from a process address space */
1127 @REQ(read_process_memory)
1128     handle_t     handle;       /* process handle */
1129     void*        addr;         /* addr to read from */
1130 @REPLY
1131     VARARG(data,bytes);        /* result data */
1132 @END
1133
1134
1135 /* Write data to a process address space */
1136 @REQ(write_process_memory)
1137     handle_t     handle;       /* process handle */
1138     void*        addr;         /* addr to write to (must be int-aligned) */
1139     unsigned int first_mask;   /* mask for first word */
1140     unsigned int last_mask;    /* mask for last word */
1141     VARARG(data,bytes);        /* data to write */
1142 @END
1143
1144
1145 /* Create a registry key */
1146 @REQ(create_key)
1147     handle_t     parent;       /* handle to the parent key */
1148     unsigned int access;       /* desired access rights */
1149     unsigned int options;      /* creation options */
1150     time_t       modif;        /* last modification time */
1151     size_t       namelen;      /* length of key name in bytes */
1152     VARARG(name,unicode_str,namelen);  /* key name */
1153     VARARG(class,unicode_str);         /* class name */
1154 @REPLY
1155     handle_t     hkey;         /* handle to the created key */
1156     int          created;      /* has it been newly created? */
1157 @END
1158
1159 /* Open a registry key */
1160 @REQ(open_key)
1161     handle_t     parent;       /* handle to the parent key */
1162     unsigned int access;       /* desired access rights */
1163     VARARG(name,unicode_str);  /* key name */
1164 @REPLY
1165     handle_t     hkey;         /* handle to the open key */
1166 @END
1167
1168
1169 /* Delete a registry key */
1170 @REQ(delete_key)
1171     handle_t     hkey;         /* handle to the key */
1172 @END
1173
1174
1175 /* Enumerate registry subkeys */
1176 @REQ(enum_key)
1177     handle_t     hkey;         /* handle to registry key */
1178     int          index;        /* index of subkey (or -1 for current key) */
1179     int          info_class;   /* requested information class */
1180 @REPLY
1181     int          subkeys;      /* number of subkeys */
1182     int          max_subkey;   /* longest subkey name */
1183     int          max_class;    /* longest class name */
1184     int          values;       /* number of values */
1185     int          max_value;    /* longest value name */
1186     int          max_data;     /* longest value data */
1187     time_t       modif;        /* last modification time */
1188     size_t       total;        /* total length needed for full name and class */
1189     size_t       namelen;      /* length of key name in bytes */
1190     VARARG(name,unicode_str,namelen);  /* key name */
1191     VARARG(class,unicode_str);         /* class name */
1192 @END
1193
1194
1195 /* Set a value of a registry key */
1196 @REQ(set_key_value)
1197     handle_t     hkey;         /* handle to registry key */
1198     int          type;         /* value type */
1199     size_t       namelen;      /* length of value name in bytes */
1200     VARARG(name,unicode_str,namelen);  /* value name */
1201     VARARG(data,bytes);                /* value data */
1202 @END
1203
1204
1205 /* Retrieve the value of a registry key */
1206 @REQ(get_key_value)
1207     handle_t     hkey;         /* handle to registry key */
1208     VARARG(name,unicode_str);  /* value name */
1209 @REPLY
1210     int          type;         /* value type */
1211     size_t       total;        /* total length needed for data */
1212     VARARG(data,bytes);        /* value data */
1213 @END
1214
1215
1216 /* Enumerate a value of a registry key */
1217 @REQ(enum_key_value)
1218     handle_t     hkey;         /* handle to registry key */
1219     int          index;        /* value index */
1220     int          info_class;   /* requested information class */
1221 @REPLY
1222     int          type;         /* value type */
1223     size_t       total;        /* total length needed for full name and data */
1224     size_t       namelen;      /* length of value name in bytes */
1225     VARARG(name,unicode_str,namelen);  /* value name */
1226     VARARG(data,bytes);                /* value data */
1227 @END
1228
1229
1230 /* Delete a value of a registry key */
1231 @REQ(delete_key_value)
1232     handle_t     hkey;         /* handle to registry key */
1233     VARARG(name,unicode_str);  /* value name */
1234 @END
1235
1236
1237 /* Load a registry branch from a file */
1238 @REQ(load_registry)
1239     handle_t     hkey;         /* root key to load to */
1240     handle_t     file;         /* file to load from */
1241     VARARG(name,unicode_str);  /* subkey name */
1242 @END
1243
1244
1245 /* Save a registry branch to a file */
1246 @REQ(save_registry)
1247     handle_t     hkey;         /* key to save */
1248     handle_t     file;         /* file to save to */
1249 @END
1250
1251
1252 /* Save a registry branch at server exit */
1253 @REQ(save_registry_atexit)
1254     handle_t     hkey;         /* key to save */
1255     VARARG(file,string);       /* file to save to */
1256 @END
1257
1258
1259 /* Set the current and saving level for the registry */
1260 @REQ(set_registry_levels)
1261     int          current;      /* new current level */
1262     int          saving;       /* new saving level */
1263     int          period;       /* duration between periodic saves (milliseconds) */
1264 @END
1265
1266
1267 /* Create a waitable timer */
1268 @REQ(create_timer)
1269     int          inherit;       /* inherit flag */
1270     int          manual;        /* manual reset */
1271     VARARG(name,unicode_str);   /* object name */
1272 @REPLY
1273     handle_t     handle;        /* handle to the timer */
1274 @END
1275
1276
1277 /* Open a waitable timer */
1278 @REQ(open_timer)
1279     unsigned int access;        /* wanted access rights */
1280     int          inherit;       /* inherit flag */
1281     VARARG(name,unicode_str);   /* object name */
1282 @REPLY
1283     handle_t     handle;        /* handle to the timer */
1284 @END
1285
1286 /* Set a waitable timer */
1287 @REQ(set_timer)
1288     handle_t     handle;        /* handle to the timer */
1289     int          sec;           /* next expiration absolute time */
1290     int          usec;          /* next expiration absolute time */
1291     int          period;        /* timer period in ms */
1292     void*        callback;      /* callback function */
1293     void*        arg;           /* callback argument */
1294 @END
1295
1296 /* Cancel a waitable timer */
1297 @REQ(cancel_timer)
1298     handle_t     handle;        /* handle to the timer */
1299 @END
1300
1301
1302 /* Retrieve the current context of a thread */
1303 @REQ(get_thread_context)
1304     handle_t     handle;       /* thread handle */
1305     unsigned int flags;        /* context flags */
1306 @REPLY
1307     VARARG(context,context);   /* thread context */
1308 @END
1309
1310
1311 /* Set the current context of a thread */
1312 @REQ(set_thread_context)
1313     handle_t     handle;       /* thread handle */
1314     unsigned int flags;        /* context flags */
1315     VARARG(context,context);   /* thread context */
1316 @END
1317
1318
1319 /* Fetch a selector entry for a thread */
1320 @REQ(get_selector_entry)
1321     handle_t      handle;      /* thread handle */
1322     int           entry;       /* LDT entry */
1323 @REPLY
1324     unsigned int  base;        /* selector base */
1325     unsigned int  limit;       /* selector limit */
1326     unsigned char flags;       /* selector flags */
1327 @END
1328
1329
1330 /* Add an atom */
1331 @REQ(add_atom)
1332     int           local;       /* is atom in local process table? */
1333     VARARG(name,unicode_str);  /* atom name */
1334 @REPLY
1335     atom_t        atom;        /* resulting atom */
1336 @END
1337
1338
1339 /* Delete an atom */
1340 @REQ(delete_atom)
1341     atom_t        atom;        /* atom handle */
1342     int           local;       /* is atom in local process table? */
1343 @END
1344
1345
1346 /* Find an atom */
1347 @REQ(find_atom)
1348     int          local;        /* is atom in local process table? */
1349     VARARG(name,unicode_str);  /* atom name */
1350 @REPLY
1351     atom_t       atom;         /* atom handle */
1352 @END
1353
1354
1355 /* Get an atom name */
1356 @REQ(get_atom_name)
1357     atom_t       atom;         /* atom handle */
1358     int          local;        /* is atom in local process table? */
1359 @REPLY
1360     int          count;        /* atom lock count */
1361     VARARG(name,unicode_str);  /* atom name */
1362 @END
1363
1364
1365 /* Init the process atom table */
1366 @REQ(init_atom_table)
1367     int          entries;      /* number of entries */
1368 @END
1369
1370
1371 /* Get the message queue of the current thread */
1372 @REQ(get_msg_queue)
1373 @REPLY
1374     handle_t     handle;       /* handle to the queue */
1375 @END
1376
1377
1378 /* Set the current message queue wakeup mask */
1379 @REQ(set_queue_mask)
1380     unsigned int wake_mask;    /* wakeup bits mask */
1381     unsigned int changed_mask; /* changed bits mask */
1382     int          skip_wait;    /* will we skip waiting if signaled? */
1383 @REPLY
1384     unsigned int wake_bits;    /* current wake bits */
1385     unsigned int changed_bits; /* current changed bits */
1386 @END
1387
1388
1389 /* Get the current message queue status */
1390 @REQ(get_queue_status)
1391     int          clear;        /* should we clear the change bits? */
1392 @REPLY
1393     unsigned int wake_bits;    /* wake bits */
1394     unsigned int changed_bits; /* changed bits since last time */
1395 @END
1396
1397
1398 /* Wait for a process to start waiting on input */
1399 @REQ(wait_input_idle)
1400     handle_t     handle;       /* process handle */
1401     int          timeout;      /* timeout */
1402 @REPLY
1403     handle_t     event;        /* handle to idle event */
1404 @END
1405
1406
1407 /* Send a message to a thread queue */
1408 @REQ(send_message)
1409     void*           id;        /* thread id */
1410     int             type;      /* message type (see below) */
1411     user_handle_t   win;       /* window handle */
1412     unsigned int    msg;       /* message code */
1413     unsigned int    wparam;    /* parameters */
1414     unsigned int    lparam;    /* parameters */
1415     int             x;         /* x position */
1416     int             y;         /* y position */
1417     unsigned int    time;      /* message time */
1418     unsigned int    info;      /* extra info */
1419     int             timeout;   /* timeout for reply */
1420     VARARG(data,bytes);        /* message data for sent messages */
1421 @END
1422
1423 enum message_type
1424 {
1425     MSG_ASCII,          /* Ascii message (from SendMessageA) */
1426     MSG_UNICODE,        /* Unicode message (from SendMessageW) */
1427     MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
1428     MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
1429     MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
1430     MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
1431     MSG_HARDWARE_RAW,   /* raw hardware message */
1432     MSG_HARDWARE_COOKED /* cooked hardware message */
1433 };
1434
1435
1436 /* Get a message from the current queue */
1437 @REQ(get_message)
1438     int             flags;     /* see below */
1439     user_handle_t   get_win;   /* window handle to get */
1440     unsigned int    get_first; /* first message code to get */
1441     unsigned int    get_last;  /* last message code to get */
1442 @REPLY
1443     int             type;      /* message type */
1444     user_handle_t   win;       /* window handle */
1445     unsigned int    msg;       /* message code */
1446     unsigned int    wparam;    /* parameters */
1447     unsigned int    lparam;    /* parameters */
1448     int             x;         /* x position */
1449     int             y;         /* y position */
1450     unsigned int    time;      /* message time */
1451     unsigned int    info;      /* extra info */
1452     size_t          total;     /* total size of extra data */
1453     VARARG(data,bytes);        /* message data for sent messages */
1454 @END
1455 #define GET_MSG_REMOVE      1  /* remove the message */
1456 #define GET_MSG_SENT_ONLY   2  /* only get sent messages */
1457 #define GET_MSG_REMOVE_LAST 4  /* remove last message returned before checking for a new one */
1458
1459 /* Reply to a sent message */
1460 @REQ(reply_message)
1461     unsigned int    result;    /* message result */
1462     int             remove;    /* should we remove the message? */
1463     VARARG(data,bytes);        /* message data for sent messages */
1464 @END
1465
1466
1467 /* Retrieve the reply for the last message sent */
1468 @REQ(get_message_reply)
1469     int             cancel;    /* cancel message if not ready? */
1470 @REPLY
1471     unsigned int    result;    /* message result */
1472     VARARG(data,bytes);        /* message data for sent messages */
1473 @END
1474
1475
1476 /* Set a window timer */
1477 @REQ(set_win_timer)
1478     user_handle_t   win;       /* window handle */
1479     unsigned int    msg;       /* message to post */
1480     unsigned int    id;        /* timer id */
1481     unsigned int    rate;      /* timer rate in ms */
1482     unsigned int    lparam;    /* message lparam (callback proc) */
1483 @END
1484
1485
1486 /* Kill a window timer */
1487 @REQ(kill_win_timer)
1488     user_handle_t   win;       /* window handle */
1489     unsigned int    msg;       /* message to post */
1490     unsigned int    id;        /* timer id */
1491 @END
1492
1493
1494 /* Open a serial port */
1495 @REQ(create_serial)
1496     unsigned int access;       /* wanted access rights */
1497     int          inherit;      /* inherit flag */
1498     unsigned int attributes;   /* eg. FILE_FLAG_OVERLAPPED */
1499     unsigned int sharing;      /* sharing flags */
1500     VARARG(name,string);       /* file name */
1501 @REPLY
1502     handle_t     handle;       /* handle to the port */
1503 @END
1504
1505
1506 /* Retrieve info about a serial port */
1507 @REQ(get_serial_info)
1508     handle_t     handle;       /* handle to comm port */
1509 @REPLY
1510     unsigned int readinterval;
1511     unsigned int readconst;
1512     unsigned int readmult;
1513     unsigned int writeconst;
1514     unsigned int writemult;
1515     unsigned int eventmask;
1516     unsigned int commerror;
1517 @END
1518
1519
1520 /* Set info about a serial port */
1521 @REQ(set_serial_info)
1522     handle_t     handle;       /* handle to comm port */
1523     int          flags;        /* bitmask to set values (see below) */
1524     unsigned int readinterval;
1525     unsigned int readconst;
1526     unsigned int readmult;
1527     unsigned int writeconst;
1528     unsigned int writemult;
1529     unsigned int eventmask;
1530     unsigned int commerror;
1531 @END
1532 #define SERIALINFO_SET_TIMEOUTS  0x01
1533 #define SERIALINFO_SET_MASK      0x02
1534 #define SERIALINFO_SET_ERROR     0x04
1535
1536
1537 /* Create/Destroy an async I/O */
1538 @REQ(register_async)
1539     handle_t     handle;  /* handle to comm port, socket or file */
1540     void*        func;
1541     int          type;
1542     void*        overlapped;
1543     int          count;
1544     unsigned int status;
1545 @END
1546 #define ASYNC_TYPE_NONE  0x00
1547 #define ASYNC_TYPE_READ  0x01
1548 #define ASYNC_TYPE_WRITE 0x02
1549 #define ASYNC_TYPE_WAIT  0x03
1550
1551
1552 /* Create a named pipe */
1553 @REQ(create_named_pipe)
1554     unsigned int   openmode;
1555     unsigned int   pipemode;
1556     unsigned int   maxinstances;
1557     unsigned int   outsize;
1558     unsigned int   insize;
1559     unsigned int   timeout;
1560     VARARG(name,unicode_str);    /* pipe name */
1561 @REPLY
1562     handle_t       handle;       /* handle to the pipe */
1563 @END
1564
1565
1566 /* Open an existing named pipe */
1567 @REQ(open_named_pipe)
1568     unsigned int   access;
1569     VARARG(name,unicode_str);    /* pipe name */
1570 @REPLY
1571     handle_t       handle;       /* handle to the pipe */
1572 @END
1573
1574
1575 /* Connect to a named pipe */
1576 @REQ(connect_named_pipe)
1577     handle_t       handle;
1578     void*          overlapped;
1579     void*          func;
1580 @END
1581
1582
1583 /* Wait for a named pipe */
1584 @REQ(wait_named_pipe)
1585     unsigned int   timeout;
1586     void*          overlapped;
1587     void*          func;
1588     VARARG(name,unicode_str);    /* pipe name */
1589 @END
1590
1591
1592 /* Disconnect a named pipe */
1593 @REQ(disconnect_named_pipe)
1594     handle_t       handle;
1595 @END
1596
1597
1598 @REQ(get_named_pipe_info)
1599     handle_t       handle;
1600 @REPLY
1601     unsigned int   flags;
1602     unsigned int   maxinstances;
1603     unsigned int   outsize;
1604     unsigned int   insize;
1605 @END
1606
1607
1608 /* Create a window */
1609 @REQ(create_window)
1610     user_handle_t  parent;      /* parent window */
1611     user_handle_t  owner;       /* owner window */
1612     atom_t         atom;        /* class atom */
1613 @REPLY
1614     user_handle_t  handle;      /* created window */
1615 @END
1616
1617
1618 /* Link a window into the tree */
1619 @REQ(link_window)
1620     user_handle_t  handle;      /* handle to the window */
1621     user_handle_t  parent;      /* handle to the parent */
1622     user_handle_t  previous;    /* previous child in Z-order */
1623 @REPLY
1624     user_handle_t  full_parent; /* full handle of new parent */
1625 @END
1626
1627
1628 /* Destroy a window */
1629 @REQ(destroy_window)
1630     user_handle_t  handle;      /* handle to the window */
1631 @END
1632
1633
1634 /* Set a window owner */
1635 @REQ(set_window_owner)
1636     user_handle_t  handle;      /* handle to the window */
1637     user_handle_t  owner;       /* new owner */
1638 @REPLY
1639     user_handle_t  full_owner;  /* full handle of new owner */
1640 @END
1641
1642
1643 /* Get information from a window handle */
1644 @REQ(get_window_info)
1645     user_handle_t  handle;      /* handle to the window */
1646 @REPLY
1647     user_handle_t  full_handle; /* full 32-bit handle */
1648     void*          pid;         /* process owning the window */
1649     void*          tid;         /* thread owning the window */
1650     atom_t         atom;        /* class atom */
1651 @END
1652
1653
1654 /* Set some information in a window */
1655 @REQ(set_window_info)
1656     user_handle_t  handle;        /* handle to the window */
1657     unsigned int   flags;         /* flags for fields to set (see below) */
1658     unsigned int   style;         /* window style */
1659     unsigned int   ex_style;      /* window extended style */
1660     unsigned int   id;            /* window id */
1661     void*          instance;      /* creator instance */
1662     void*          user_data;     /* user-specific data */
1663 @REPLY
1664     unsigned int   old_style;     /* old window style */
1665     unsigned int   old_ex_style;  /* old window extended style */
1666     unsigned int   old_id;        /* old window id */
1667     void*          old_instance;  /* old creator instance */
1668     void*          old_user_data; /* old user-specific data */
1669 @END
1670 #define SET_WIN_STYLE     0x01
1671 #define SET_WIN_EXSTYLE   0x02
1672 #define SET_WIN_ID        0x04
1673 #define SET_WIN_INSTANCE  0x08
1674 #define SET_WIN_USERDATA  0x10
1675
1676
1677 /* Get a list of the window parents, up to the root of the tree */
1678 @REQ(get_window_parents)
1679     user_handle_t  handle;        /* handle to the window */
1680 @REPLY
1681     int            count;         /* total count of parents */
1682     VARARG(parents,user_handles); /* parent handles */
1683 @END
1684
1685
1686 /* Get a list of the window children */
1687 @REQ(get_window_children)
1688     user_handle_t  parent;        /* parent window */
1689     atom_t         atom;          /* class atom for the listed children */
1690     void*          tid;           /* thread owning the listed children */
1691 @REPLY
1692     int            count;         /* total count of children */
1693     VARARG(children,user_handles); /* children handles */
1694 @END
1695
1696
1697 /* Get window tree information from a window handle */
1698 @REQ(get_window_tree)
1699     user_handle_t  handle;        /* handle to the window */
1700 @REPLY
1701     user_handle_t  parent;        /* parent window */
1702     user_handle_t  owner;         /* owner window */
1703     user_handle_t  next_sibling;  /* next sibling in Z-order */
1704     user_handle_t  prev_sibling;  /* prev sibling in Z-order */
1705     user_handle_t  first_sibling; /* first sibling in Z-order */
1706     user_handle_t  last_sibling;  /* last sibling in Z-order */
1707     user_handle_t  first_child;   /* first child */
1708     user_handle_t  last_child;    /* last child */
1709 @END
1710
1711 /* Set the window and client rectangles of a window */
1712 @REQ(set_window_rectangles)
1713     user_handle_t  handle;        /* handle to the window */
1714     rectangle_t    window;        /* window rectangle */
1715     rectangle_t    client;        /* client rectangle */
1716 @END
1717
1718
1719 /* Get the window and client rectangles of a window */
1720 @REQ(get_window_rectangles)
1721     user_handle_t  handle;        /* handle to the window */
1722 @REPLY
1723     rectangle_t    window;        /* window rectangle */
1724     rectangle_t    client;        /* client rectangle */
1725 @END
1726
1727
1728 /* Get the window text */
1729 @REQ(get_window_text)
1730     user_handle_t  handle;        /* handle to the window */
1731 @REPLY
1732     VARARG(text,unicode_str);     /* window text */
1733 @END
1734
1735
1736 /* Set the window text */
1737 @REQ(set_window_text)
1738     user_handle_t  handle;        /* handle to the window */
1739     VARARG(text,unicode_str);     /* window text */
1740 @END
1741
1742
1743 /* Increment the window paint count */
1744 @REQ(inc_window_paint_count)
1745     user_handle_t  handle;        /* handle to the window */
1746     int             incr;         /* increment (can be negative) */
1747 @END
1748
1749
1750 /* Get the coordinates offset between two windows */
1751 @REQ(get_windows_offset)
1752     user_handle_t  from;          /* handle to the first window */
1753     user_handle_t  to;            /* handle to the second window */
1754 @REPLY
1755     int            x;             /* x coordinate offset */
1756     int            y;             /* y coordinate offset */
1757 @END
1758
1759
1760 /* Set a window property */
1761 @REQ(set_window_property)
1762     user_handle_t  window;        /* handle to the window */
1763     atom_t         atom;          /* property atom (high-word set if it was a string) */
1764     int            string;        /* was atom a string originally? */
1765     handle_t       handle;        /* handle to store */
1766 @END
1767
1768
1769 /* Remove a window property */
1770 @REQ(remove_window_property)
1771     user_handle_t  window;        /* handle to the window */
1772     atom_t         atom;          /* property atom */
1773 @REPLY
1774     handle_t       handle;        /* handle stored in property */
1775 @END
1776
1777
1778 /* Get a window property */
1779 @REQ(get_window_property)
1780     user_handle_t  window;        /* handle to the window */
1781     atom_t         atom;          /* property atom */
1782 @REPLY
1783     handle_t       handle;        /* handle stored in property */
1784 @END
1785
1786
1787 /* Get the list of properties of a window */
1788 @REQ(get_window_properties)
1789     user_handle_t  window;        /* handle to the window */
1790 @REPLY
1791     int            total;         /* total number of properties */
1792     VARARG(props,properties);     /* list of properties */
1793 @END