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