- separate cleanly between async scheduling and file IO related issues.
[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, APC_ASYNC_IO };
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 /* Open a handle to a thread */
466 @REQ(open_thread)
467     void*        tid;          /* thread id to open */
468     unsigned int access;       /* wanted access rights */
469     int          inherit;      /* inherit flag */
470 @REPLY
471     handle_t     handle;       /* handle to the thread */
472 @END
473
474
475 /* Wait for handles */
476 @REQ(select)
477     int          flags;        /* wait flags (see below) */
478     void*        cookie;       /* magic cookie to return to client */
479     int          sec;          /* absolute timeout */
480     int          usec;         /* absolute timeout */
481     VARARG(handles,handles);   /* handles to select on */
482 @END
483 #define SELECT_ALL           1
484 #define SELECT_ALERTABLE     2
485 #define SELECT_INTERRUPTIBLE 4
486 #define SELECT_TIMEOUT       8
487
488
489 /* Create an event */
490 @REQ(create_event)
491     int          manual_reset;  /* manual reset event */
492     int          initial_state; /* initial state of the event */
493     int          inherit;       /* inherit flag */
494     VARARG(name,unicode_str);   /* object name */
495 @REPLY
496     handle_t     handle;        /* handle to the event */
497 @END
498
499 /* Event operation */
500 @REQ(event_op)
501     handle_t      handle;       /* handle to event */
502     int           op;           /* event operation (see below) */
503 @END
504 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
505
506
507 /* Open an event */
508 @REQ(open_event)
509     unsigned int access;        /* wanted access rights */
510     int          inherit;       /* inherit flag */
511     VARARG(name,unicode_str);   /* object name */
512 @REPLY
513     handle_t     handle;        /* handle to the event */
514 @END
515
516
517 /* Create a mutex */
518 @REQ(create_mutex)
519     int          owned;         /* initially owned? */
520     int          inherit;       /* inherit flag */
521     VARARG(name,unicode_str);   /* object name */
522 @REPLY
523     handle_t     handle;        /* handle to the mutex */
524 @END
525
526
527 /* Release a mutex */
528 @REQ(release_mutex)
529     handle_t     handle;        /* handle to the mutex */
530 @END
531
532
533 /* Open a mutex */
534 @REQ(open_mutex)
535     unsigned int access;        /* wanted access rights */
536     int          inherit;       /* inherit flag */
537     VARARG(name,unicode_str);   /* object name */
538 @REPLY
539     handle_t     handle;        /* handle to the mutex */
540 @END
541
542
543 /* Create a semaphore */
544 @REQ(create_semaphore)
545     unsigned int initial;       /* initial count */
546     unsigned int max;           /* maximum count */
547     int          inherit;       /* inherit flag */
548     VARARG(name,unicode_str);   /* object name */
549 @REPLY
550     handle_t     handle;        /* handle to the semaphore */
551 @END
552
553
554 /* Release a semaphore */
555 @REQ(release_semaphore)
556     handle_t     handle;        /* handle to the semaphore */
557     unsigned int count;         /* count to add to semaphore */
558 @REPLY
559     unsigned int prev_count;    /* previous semaphore count */
560 @END
561
562
563 /* Open a semaphore */
564 @REQ(open_semaphore)
565     unsigned int access;        /* wanted access rights */
566     int          inherit;       /* inherit flag */
567     VARARG(name,unicode_str);   /* object name */
568 @REPLY
569     handle_t     handle;        /* handle to the semaphore */
570 @END
571
572
573 /* Create a file */
574 @REQ(create_file)
575     unsigned int access;        /* wanted access rights */
576     int          inherit;       /* inherit flag */
577     unsigned int sharing;       /* sharing flags */
578     int          create;        /* file create action */
579     unsigned int attrs;         /* file attributes for creation */
580     int          drive_type;    /* type of drive the file is on */
581     VARARG(filename,string);    /* file name */
582 @REPLY
583     handle_t     handle;        /* handle to the file */
584 @END
585
586
587 /* Allocate a file handle for a Unix fd */
588 @REQ(alloc_file_handle)
589     unsigned int access;        /* wanted access rights */
590     int          inherit;       /* inherit flag */
591     int          fd;            /* file descriptor on the client side */
592 @REPLY
593     handle_t     handle;        /* handle to the file */
594 @END
595
596
597 /* Get a Unix fd to access a file */
598 @REQ(get_handle_fd)
599     handle_t     handle;        /* handle to the file */
600     unsigned int access;        /* wanted access rights */
601 @REPLY
602     int          fd;            /* file descriptor */
603     int          type;          /* the type of file (see below) */
604     int          flags;         /* file read/write flags (see below) */
605 @END
606 enum fd_type
607 {
608     FD_TYPE_INVALID,
609     FD_TYPE_DEFAULT,
610     FD_TYPE_CONSOLE,
611     FD_TYPE_SMB
612 };
613 #define FD_FLAG_OVERLAPPED 0x01
614 #define FD_FLAG_TIMEOUT    0x02
615
616
617 /* Set a file current position */
618 @REQ(set_file_pointer)
619     handle_t     handle;        /* handle to the file */
620     int          low;           /* position low word */
621     int          high;          /* position high word */
622     int          whence;        /* whence to seek */
623 @REPLY
624     int          new_low;       /* new position low word */
625     int          new_high;      /* new position high word */
626 @END
627
628
629 /* Truncate (or extend) a file */
630 @REQ(truncate_file)
631     handle_t     handle;        /* handle to the file */
632 @END
633
634
635 /* Set a file access and modification times */
636 @REQ(set_file_time)
637     handle_t     handle;        /* handle to the file */
638     time_t       access_time;   /* last access time */
639     time_t       write_time;    /* last write time */
640 @END
641
642
643 /* Flush a file buffers */
644 @REQ(flush_file)
645     handle_t     handle;        /* handle to the file */
646 @END
647
648
649 /* Get information about a file */
650 @REQ(get_file_info)
651     handle_t     handle;        /* handle to the file */
652 @REPLY
653     int          type;          /* file type */
654     int          attr;          /* file attributes */
655     time_t       access_time;   /* last access time */
656     time_t       write_time;    /* last write time */
657     int          size_high;     /* file size */
658     int          size_low;      /* file size */
659     int          links;         /* number of links */
660     int          index_high;    /* unique index */
661     int          index_low;     /* unique index */
662     unsigned int serial;        /* volume serial number */
663 @END
664
665
666 /* Lock a region of a file */
667 @REQ(lock_file)
668     handle_t     handle;        /* handle to the file */
669     unsigned int offset_low;    /* offset of start of lock */
670     unsigned int offset_high;   /* offset of start of lock */
671     unsigned int count_low;     /* count of bytes to lock */
672     unsigned int count_high;    /* count of bytes to lock */
673 @END
674
675
676 /* Unlock a region of a file */
677 @REQ(unlock_file)
678     handle_t     handle;        /* handle to the file */
679     unsigned int offset_low;    /* offset of start of unlock */
680     unsigned int offset_high;   /* offset of start of unlock */
681     unsigned int count_low;     /* count of bytes to unlock */
682     unsigned int count_high;    /* count of bytes to unlock */
683 @END
684
685
686 /* Create an anonymous pipe */
687 @REQ(create_pipe)
688     int          inherit;       /* inherit flag */
689 @REPLY
690     handle_t     handle_read;   /* handle to the read-side of the pipe */
691     handle_t     handle_write;  /* handle to the write-side of the pipe */
692 @END
693
694
695 /* Create a socket */
696 @REQ(create_socket)
697     unsigned int access;        /* wanted access rights */
698     int          inherit;       /* inherit flag */
699     int          family;        /* family, see socket manpage */
700     int          type;          /* type, see socket manpage */
701     int          protocol;      /* protocol, see socket manpage */
702     unsigned int flags;         /* socket flags */
703 @REPLY
704     handle_t     handle;        /* handle to the new socket */
705 @END
706
707
708 /* Accept a socket */
709 @REQ(accept_socket)
710     handle_t     lhandle;       /* handle to the listening socket */
711     unsigned int access;        /* wanted access rights */
712     int          inherit;       /* inherit flag */
713 @REPLY
714     handle_t     handle;        /* handle to the new socket */
715 @END
716
717
718 /* Set socket event parameters */
719 @REQ(set_socket_event)
720     handle_t      handle;        /* handle to the socket */
721     unsigned int  mask;          /* event mask */
722     handle_t      event;         /* event object */
723     user_handle_t window;        /* window to send the message to */
724     unsigned int  msg;           /* message to send */
725 @END
726
727
728 /* Get socket event parameters */
729 @REQ(get_socket_event)
730     handle_t     handle;        /* handle to the socket */
731     int          service;       /* clear pending? */
732     handle_t     c_event;       /* event to clear */
733 @REPLY
734     unsigned int mask;          /* event mask */
735     unsigned int pmask;         /* pending events */
736     unsigned int state;         /* status bits */
737     VARARG(errors,ints);        /* event errors */
738 @END
739
740
741 /* Reenable pending socket events */
742 @REQ(enable_socket_event)
743     handle_t     handle;        /* handle to the socket */
744     unsigned int mask;          /* events to re-enable */
745     unsigned int sstate;        /* status bits to set */
746     unsigned int cstate;        /* status bits to clear */
747 @END
748
749
750 /* Allocate a console (only used by a console renderer) */
751 @REQ(alloc_console)
752     unsigned int access;        /* wanted access rights */
753     int          inherit;       /* inherit flag */
754     void*        pid;           /* pid of process which shall be attached to the console */
755 @REPLY
756     handle_t     handle_in;     /* handle to console input */
757     handle_t     event;         /* handle to renderer events change notification */
758 @END
759
760
761 /* Free the console of the current process */
762 @REQ(free_console)
763 @END
764
765
766 #define CONSOLE_RENDERER_NONE_EVENT        0x00
767 #define CONSOLE_RENDERER_TITLE_EVENT       0x01
768 #define CONSOLE_RENDERER_ACTIVE_SB_EVENT   0x02
769 #define CONSOLE_RENDERER_SB_RESIZE_EVENT   0x03
770 #define CONSOLE_RENDERER_UPDATE_EVENT      0x04
771 #define CONSOLE_RENDERER_CURSOR_POS_EVENT  0x05
772 #define CONSOLE_RENDERER_CURSOR_GEOM_EVENT 0x06
773 #define CONSOLE_RENDERER_DISPLAY_EVENT     0x07
774 #define CONSOLE_RENDERER_EXIT_EVENT        0x08
775 struct console_renderer_event
776 {
777     short event;
778     union
779     {
780         struct update
781         {
782             short top;
783             short bottom;
784         } update;
785         struct resize
786         {
787             short width;
788             short height;
789         } resize;
790         struct cursor_pos
791         {
792             short x;
793             short y;
794         } cursor_pos;
795         struct cursor_geom
796         {
797             short visible;
798             short size;
799         } cursor_geom;
800         struct display
801         {
802             short left;
803             short top;
804             short width;
805             short height;
806         } display;
807     } u;
808 };
809
810 /* retrieve console events for the renderer */
811 @REQ(get_console_renderer_events)
812     handle_t     handle;        /* handle to console input events */
813 @REPLY
814     VARARG(data,bytes);         /* the various console_renderer_events */
815 @END
816
817
818 /* Open a handle to the process console */
819 @REQ(open_console)
820     int          from;          /* 0 (resp 1) input (resp output) of current process console */
821                                 /* otherwise console_in handle to get active screen buffer? */
822     unsigned int access;        /* wanted access rights */
823     int          inherit;       /* inherit flag */
824     int          share;         /* share mask (only for output handles) */
825 @REPLY
826     handle_t     handle;        /* handle to the console */
827 @END
828
829
830 /* Get a console mode (input or output) */
831 @REQ(get_console_mode)
832     handle_t     handle;        /* handle to the console */
833 @REPLY
834     int          mode;          /* console mode */
835 @END
836
837
838 /* Set a console mode (input or output) */
839 @REQ(set_console_mode)
840     handle_t     handle;        /* handle to the console */
841     int          mode;          /* console mode */
842 @END
843
844
845 /* Set info about a console (input only) */
846 @REQ(set_console_input_info)
847     handle_t     handle;        /* handle to console input, or 0 for process' console */
848     int          mask;          /* setting mask (see below) */
849     handle_t     active_sb;     /* active screen buffer */
850     int          history_mode;  /* whether we duplicate lines in history */
851     int          history_size;  /* number of lines in history */
852     VARARG(title,unicode_str);  /* console title */
853 @END
854 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
855 #define SET_CONSOLE_INPUT_INFO_TITLE            0x02
856 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
857 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
858
859
860 /* Get info about a console (input only) */
861 @REQ(get_console_input_info)
862     handle_t     handle;        /* handle to console input, or 0 for process' console */
863 @REPLY
864     int          history_mode;  /* whether we duplicate lines in history */
865     int          history_size;  /* number of lines in history */
866     int          history_index; /* number of used lines in history */
867     VARARG(title,unicode_str);  /* console title */
868 @END
869
870
871 /* appends a string to console's history */
872 @REQ(append_console_input_history)
873     handle_t     handle;        /* handle to console input, or 0 for process' console */
874     VARARG(line,unicode_str);   /* line to add */
875 @END
876
877
878 /* appends a string to console's history */
879 @REQ(get_console_input_history)
880     handle_t     handle;        /* handle to console input, or 0 for process' console */
881     int          index;         /* index to get line from */
882 @REPLY
883     int          total;         /* total length of line in Unicode chars */
884     VARARG(line,unicode_str);   /* line to add */
885 @END
886
887
888 /* creates a new screen buffer on process' console */
889 @REQ(create_console_output)
890     handle_t     handle_in;     /* handle to console input, or 0 for process' console */
891     int          access;        /* wanted access rights */
892     int          share;         /* sharing credentials */
893     int          inherit;       /* inherit flag */
894 @REPLY
895     handle_t     handle_out;    /* handle to the screen buffer */
896 @END
897
898
899 /* Set info about a console (output only) */
900 @REQ(set_console_output_info)
901     handle_t     handle;        /* handle to the console */
902     int          mask;          /* setting mask (see below) */
903     short int    cursor_size;   /* size of cursor (percentage filled) */
904     short int    cursor_visible;/* cursor visibility flag */
905     short int    cursor_x;      /* position of cursor (x, y) */
906     short int    cursor_y;
907     short int    width;         /* width of the screen buffer */
908     short int    height;        /* height of the screen buffer */
909     short int    attr;          /* default attribute */
910     short int    win_left;      /* window actually displayed by renderer */
911     short int    win_top;       /* the rect area is expressed withing the */
912     short int    win_right;     /* boundaries of the screen buffer */
913     short int    win_bottom;
914     short int    max_width;     /* maximum size (width x height) for the window */
915     short int    max_height;
916 @END
917 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
918 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
919 #define SET_CONSOLE_OUTPUT_INFO_SIZE            0x04
920 #define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
921 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
922 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20
923
924
925 /* Get info about a console (output only) */
926 @REQ(get_console_output_info)
927     handle_t     handle;        /* handle to the console */
928 @REPLY
929     short int    cursor_size;   /* size of cursor (percentage filled) */
930     short int    cursor_visible;/* cursor visibility flag */
931     short int    cursor_x;      /* position of cursor (x, y) */
932     short int    cursor_y;
933     short int    width;         /* width of the screen buffer */
934     short int    height;        /* height of the screen buffer */
935     short int    attr;          /* default attribute */
936     short int    win_left;      /* window actually displayed by renderer */
937     short int    win_top;       /* the rect area is expressed withing the */
938     short int    win_right;     /* boundaries of the screen buffer */
939     short int    win_bottom;
940     short int    max_width;     /* maximum size (width x height) for the window */
941     short int    max_height;
942 @END
943
944 /* Add input records to a console input queue */
945 @REQ(write_console_input)
946     handle_t     handle;        /* handle to the console input */
947     VARARG(rec,input_records);  /* input records */
948 @REPLY
949     int          written;       /* number of records written */
950 @END
951
952
953 /* Fetch input records from a console input queue */
954 @REQ(read_console_input)
955     handle_t     handle;        /* handle to the console input */
956     int          flush;         /* flush the retrieved records from the queue? */
957 @REPLY
958     int          read;          /* number of records read */
959     VARARG(rec,input_records);  /* input records */
960 @END
961
962
963 /* write data (chars and/or attributes) in a screen buffer */
964 @REQ(write_console_output)
965     handle_t     handle;        /* handle to the console output */
966     int          x;             /* position where to start writing */
967     int          y;
968     int          mode;          /* char info (see below) */
969     int          wrap;          /* wrap around at end of line? */
970     VARARG(data,bytes);         /* info to write */
971 @REPLY
972     int          written;       /* number of char infos actually written */
973     int          width;         /* width of screen buffer */
974     int          height;        /* height of screen buffer */
975 @END
976 enum char_info_mode
977 {
978     CHAR_INFO_MODE_TEXT,        /* characters only */
979     CHAR_INFO_MODE_ATTR,        /* attributes only */
980     CHAR_INFO_MODE_TEXTATTR,    /* both characters and attributes */
981     CHAR_INFO_MODE_TEXTSTDATTR  /* characters but use standard attributes */
982 };
983
984
985 /* fill a screen buffer with constant data (chars and/or attributes) */
986 @REQ(fill_console_output)
987     handle_t     handle;        /* handle to the console output */
988     int          x;             /* position where to start writing */
989     int          y;
990     int          mode;          /* char info mode */
991     int          count;         /* number to write */
992     int          wrap;          /* wrap around at end of line? */
993     char_info_t  data;          /* data to write */
994 @REPLY
995     int          written;       /* number of char infos actually written */
996 @END
997
998
999 /* read data (chars and/or attributes) from a screen buffer */
1000 @REQ(read_console_output)
1001     handle_t     handle;        /* handle to the console output */
1002     int          x;             /* position (x,y) where to start reading */
1003     int          y;
1004     int          mode;          /* char info mode */
1005     int          wrap;          /* wrap around at end of line? */
1006 @REPLY
1007     int          width;         /* width of screen buffer */
1008     int          height;        /* height of screen buffer */
1009     VARARG(data,bytes);
1010 @END
1011
1012 /* move a rect (of data) in screen buffer content */
1013 @REQ(move_console_output)
1014     handle_t     handle;        /* handle to the console output */
1015     short int    x_src;         /* position (x, y) of rect to start moving from */
1016     short int    y_src;
1017     short int    x_dst;         /* position (x, y) of rect to move to */
1018     short int    y_dst;
1019     short int    w;             /* size of the rect (width, height) to move */
1020     short int    h;
1021 @END
1022
1023
1024 /* Create a change notification */
1025 @REQ(create_change_notification)
1026     int          subtree;       /* watch all the subtree */
1027     int          filter;        /* notification filter */
1028 @REPLY
1029     handle_t     handle;        /* handle to the change notification */
1030 @END
1031
1032
1033 /* Create a file mapping */
1034 @REQ(create_mapping)
1035     int          size_high;     /* mapping size */
1036     int          size_low;      /* mapping size */
1037     int          protect;       /* protection flags (see below) */
1038     int          inherit;       /* inherit flag */
1039     handle_t     file_handle;   /* file handle */
1040     VARARG(name,unicode_str);   /* object name */
1041 @REPLY
1042     handle_t     handle;        /* handle to the mapping */
1043 @END
1044 /* protection flags */
1045 #define VPROT_READ       0x01
1046 #define VPROT_WRITE      0x02
1047 #define VPROT_EXEC       0x04
1048 #define VPROT_WRITECOPY  0x08
1049 #define VPROT_GUARD      0x10
1050 #define VPROT_NOCACHE    0x20
1051 #define VPROT_COMMITTED  0x40
1052 #define VPROT_IMAGE      0x80
1053
1054
1055 /* Open a mapping */
1056 @REQ(open_mapping)
1057     unsigned int access;        /* wanted access rights */
1058     int          inherit;       /* inherit flag */
1059     VARARG(name,unicode_str);   /* object name */
1060 @REPLY
1061     handle_t     handle;        /* handle to the mapping */
1062 @END
1063
1064
1065 /* Get information about a file mapping */
1066 @REQ(get_mapping_info)
1067     handle_t     handle;        /* handle to the mapping */
1068 @REPLY
1069     int          size_high;     /* mapping size */
1070     int          size_low;      /* mapping size */
1071     int          protect;       /* protection flags */
1072     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1073     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1074     handle_t     shared_file;   /* shared mapping file handle */
1075     int          shared_size;   /* shared mapping size */
1076     int          drive_type;    /* type of drive the file is on */
1077 @END
1078
1079
1080 /* Create a device */
1081 @REQ(create_device)
1082     unsigned int access;        /* wanted access rights */
1083     int          inherit;       /* inherit flag */
1084     int          id;            /* client private id */
1085 @REPLY
1086     handle_t     handle;        /* handle to the device */
1087 @END
1088
1089
1090 /* Create a snapshot */
1091 @REQ(create_snapshot)
1092     int          inherit;       /* inherit flag */
1093     int          flags;         /* snapshot flags (TH32CS_*) */
1094     void*        pid;           /* process id */
1095 @REPLY
1096     handle_t     handle;        /* handle to the snapshot */
1097 @END
1098
1099
1100 /* Get the next process from a snapshot */
1101 @REQ(next_process)
1102     handle_t     handle;        /* handle to the snapshot */
1103     int          reset;         /* reset snapshot position? */
1104 @REPLY
1105     int          count;         /* process usage count */
1106     void*        pid;           /* process id */
1107     void*        ppid;          /* parent process id */
1108     void*        heap;          /* heap base */
1109     void*        module;        /* main module */
1110     int          threads;       /* number of threads */
1111     int          priority;      /* process priority */
1112     VARARG(filename,string);    /* file name of main exe */
1113 @END
1114
1115
1116 /* Get the next thread from a snapshot */
1117 @REQ(next_thread)
1118     handle_t     handle;        /* handle to the snapshot */
1119     int          reset;         /* reset snapshot position? */
1120 @REPLY
1121     int          count;         /* thread usage count */
1122     void*        pid;           /* process id */
1123     void*        tid;           /* thread id */
1124     int          base_pri;      /* base priority */
1125     int          delta_pri;     /* delta priority */
1126 @END
1127
1128
1129 /* Get the next module from a snapshot */
1130 @REQ(next_module)
1131     handle_t     handle;        /* handle to the snapshot */
1132     int          reset;         /* reset snapshot position? */
1133 @REPLY
1134     void*        pid;           /* process id */
1135     void*        base;          /* module base address */
1136     size_t       size;          /* module size */
1137     VARARG(filename,string);    /* file name of module */
1138 @END
1139
1140
1141 /* Wait for a debug event */
1142 @REQ(wait_debug_event)
1143     int           get_handle;  /* should we alloc a handle for waiting? */
1144 @REPLY
1145     void*         pid;         /* process id */
1146     void*         tid;         /* thread id */
1147     handle_t      wait;        /* wait handle if no event ready */
1148     VARARG(event,debug_event); /* debug event data */
1149 @END
1150
1151
1152 /* Queue an exception event */
1153 @REQ(queue_exception_event)
1154     int              first;    /* first chance exception? */
1155     VARARG(record,exc_event);  /* thread context followed by exception record */
1156 @REPLY
1157     handle_t         handle;   /* handle to the queued event */
1158 @END
1159
1160
1161 /* Retrieve the status of an exception event */
1162 @REQ(get_exception_status)
1163     handle_t         handle;   /* handle to the queued event */
1164 @REPLY
1165     int              status;   /* event continuation status */
1166     VARARG(context,context);   /* modified thread context */
1167 @END
1168
1169
1170 /* Send an output string to the debugger */
1171 @REQ(output_debug_string)
1172     void*         string;      /* string to display (in debugged process address space) */
1173     int           unicode;     /* is it Unicode? */
1174     int           length;      /* string length */
1175 @END
1176
1177
1178 /* Continue a debug event */
1179 @REQ(continue_debug_event)
1180     void*        pid;          /* process id to continue */
1181     void*        tid;          /* thread id to continue */
1182     int          status;       /* continuation status */
1183 @END
1184
1185
1186 /* Start/stop debugging an existing process */
1187 @REQ(debug_process)
1188     void*        pid;          /* id of the process to debug */
1189     int          attach;       /* 1=attaching / 0=detaching from the process */
1190 @END
1191
1192
1193 /* Simulate a breakpoint in a process */
1194 @REQ(debug_break)
1195     handle_t     handle;       /* process handle */
1196 @REPLY
1197     int          self;         /* was it the caller itself? */
1198 @END
1199
1200
1201 /* Set debugger kill on exit flag */
1202 @REQ(set_debugger_kill_on_exit)
1203     int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1204 @END
1205
1206
1207 /* Read data from a process address space */
1208 @REQ(read_process_memory)
1209     handle_t     handle;       /* process handle */
1210     void*        addr;         /* addr to read from */
1211 @REPLY
1212     VARARG(data,bytes);        /* result data */
1213 @END
1214
1215
1216 /* Write data to a process address space */
1217 @REQ(write_process_memory)
1218     handle_t     handle;       /* process handle */
1219     void*        addr;         /* addr to write to (must be int-aligned) */
1220     unsigned int first_mask;   /* mask for first word */
1221     unsigned int last_mask;    /* mask for last word */
1222     VARARG(data,bytes);        /* data to write */
1223 @END
1224
1225
1226 /* Create a registry key */
1227 @REQ(create_key)
1228     handle_t     parent;       /* handle to the parent key */
1229     unsigned int access;       /* desired access rights */
1230     unsigned int options;      /* creation options */
1231     time_t       modif;        /* last modification time */
1232     size_t       namelen;      /* length of key name in bytes */
1233     VARARG(name,unicode_str,namelen);  /* key name */
1234     VARARG(class,unicode_str);         /* class name */
1235 @REPLY
1236     handle_t     hkey;         /* handle to the created key */
1237     int          created;      /* has it been newly created? */
1238 @END
1239
1240 /* Open a registry key */
1241 @REQ(open_key)
1242     handle_t     parent;       /* handle to the parent key */
1243     unsigned int access;       /* desired access rights */
1244     VARARG(name,unicode_str);  /* key name */
1245 @REPLY
1246     handle_t     hkey;         /* handle to the open key */
1247 @END
1248
1249
1250 /* Delete a registry key */
1251 @REQ(delete_key)
1252     handle_t     hkey;         /* handle to the key */
1253 @END
1254
1255
1256 /* Enumerate registry subkeys */
1257 @REQ(enum_key)
1258     handle_t     hkey;         /* handle to registry key */
1259     int          index;        /* index of subkey (or -1 for current key) */
1260     int          info_class;   /* requested information class */
1261 @REPLY
1262     int          subkeys;      /* number of subkeys */
1263     int          max_subkey;   /* longest subkey name */
1264     int          max_class;    /* longest class name */
1265     int          values;       /* number of values */
1266     int          max_value;    /* longest value name */
1267     int          max_data;     /* longest value data */
1268     time_t       modif;        /* last modification time */
1269     size_t       total;        /* total length needed for full name and class */
1270     size_t       namelen;      /* length of key name in bytes */
1271     VARARG(name,unicode_str,namelen);  /* key name */
1272     VARARG(class,unicode_str);         /* class name */
1273 @END
1274
1275
1276 /* Set a value of a registry key */
1277 @REQ(set_key_value)
1278     handle_t     hkey;         /* handle to registry key */
1279     int          type;         /* value type */
1280     size_t       namelen;      /* length of value name in bytes */
1281     VARARG(name,unicode_str,namelen);  /* value name */
1282     VARARG(data,bytes);                /* value data */
1283 @END
1284
1285
1286 /* Retrieve the value of a registry key */
1287 @REQ(get_key_value)
1288     handle_t     hkey;         /* handle to registry key */
1289     VARARG(name,unicode_str);  /* value name */
1290 @REPLY
1291     int          type;         /* value type */
1292     size_t       total;        /* total length needed for data */
1293     VARARG(data,bytes);        /* value data */
1294 @END
1295
1296
1297 /* Enumerate a value of a registry key */
1298 @REQ(enum_key_value)
1299     handle_t     hkey;         /* handle to registry key */
1300     int          index;        /* value index */
1301     int          info_class;   /* requested information class */
1302 @REPLY
1303     int          type;         /* value type */
1304     size_t       total;        /* total length needed for full name and data */
1305     size_t       namelen;      /* length of value name in bytes */
1306     VARARG(name,unicode_str,namelen);  /* value name */
1307     VARARG(data,bytes);                /* value data */
1308 @END
1309
1310
1311 /* Delete a value of a registry key */
1312 @REQ(delete_key_value)
1313     handle_t     hkey;         /* handle to registry key */
1314     VARARG(name,unicode_str);  /* value name */
1315 @END
1316
1317
1318 /* Load a registry branch from a file */
1319 @REQ(load_registry)
1320     handle_t     hkey;         /* root key to load to */
1321     handle_t     file;         /* file to load from */
1322     VARARG(name,unicode_str);  /* subkey name */
1323 @END
1324
1325
1326 /* Save a registry branch to a file */
1327 @REQ(save_registry)
1328     handle_t     hkey;         /* key to save */
1329     handle_t     file;         /* file to save to */
1330 @END
1331
1332
1333 /* Save a registry branch at server exit */
1334 @REQ(save_registry_atexit)
1335     handle_t     hkey;         /* key to save */
1336     VARARG(file,string);       /* file to save to */
1337 @END
1338
1339
1340 /* Set the current and saving level for the registry */
1341 @REQ(set_registry_levels)
1342     int          current;      /* new current level */
1343     int          saving;       /* new saving level */
1344     int          period;       /* duration between periodic saves (milliseconds) */
1345 @END
1346
1347
1348 /* Create a waitable timer */
1349 @REQ(create_timer)
1350     int          inherit;       /* inherit flag */
1351     int          manual;        /* manual reset */
1352     VARARG(name,unicode_str);   /* object name */
1353 @REPLY
1354     handle_t     handle;        /* handle to the timer */
1355 @END
1356
1357
1358 /* Open a waitable timer */
1359 @REQ(open_timer)
1360     unsigned int access;        /* wanted access rights */
1361     int          inherit;       /* inherit flag */
1362     VARARG(name,unicode_str);   /* object name */
1363 @REPLY
1364     handle_t     handle;        /* handle to the timer */
1365 @END
1366
1367 /* Set a waitable timer */
1368 @REQ(set_timer)
1369     handle_t     handle;        /* handle to the timer */
1370     int          sec;           /* next expiration absolute time */
1371     int          usec;          /* next expiration absolute time */
1372     int          period;        /* timer period in ms */
1373     void*        callback;      /* callback function */
1374     void*        arg;           /* callback argument */
1375 @END
1376
1377 /* Cancel a waitable timer */
1378 @REQ(cancel_timer)
1379     handle_t     handle;        /* handle to the timer */
1380 @END
1381
1382
1383 /* Retrieve the current context of a thread */
1384 @REQ(get_thread_context)
1385     handle_t     handle;       /* thread handle */
1386     unsigned int flags;        /* context flags */
1387 @REPLY
1388     VARARG(context,context);   /* thread context */
1389 @END
1390
1391
1392 /* Set the current context of a thread */
1393 @REQ(set_thread_context)
1394     handle_t     handle;       /* thread handle */
1395     unsigned int flags;        /* context flags */
1396     VARARG(context,context);   /* thread context */
1397 @END
1398
1399
1400 /* Fetch a selector entry for a thread */
1401 @REQ(get_selector_entry)
1402     handle_t      handle;      /* thread handle */
1403     int           entry;       /* LDT entry */
1404 @REPLY
1405     unsigned int  base;        /* selector base */
1406     unsigned int  limit;       /* selector limit */
1407     unsigned char flags;       /* selector flags */
1408 @END
1409
1410
1411 /* Add an atom */
1412 @REQ(add_atom)
1413     int           local;       /* is atom in local process table? */
1414     VARARG(name,unicode_str);  /* atom name */
1415 @REPLY
1416     atom_t        atom;        /* resulting atom */
1417 @END
1418
1419
1420 /* Delete an atom */
1421 @REQ(delete_atom)
1422     atom_t        atom;        /* atom handle */
1423     int           local;       /* is atom in local process table? */
1424 @END
1425
1426
1427 /* Find an atom */
1428 @REQ(find_atom)
1429     int          local;        /* is atom in local process table? */
1430     VARARG(name,unicode_str);  /* atom name */
1431 @REPLY
1432     atom_t       atom;         /* atom handle */
1433 @END
1434
1435
1436 /* Get an atom name */
1437 @REQ(get_atom_name)
1438     atom_t       atom;         /* atom handle */
1439     int          local;        /* is atom in local process table? */
1440 @REPLY
1441     int          count;        /* atom lock count */
1442     VARARG(name,unicode_str);  /* atom name */
1443 @END
1444
1445
1446 /* Init the process atom table */
1447 @REQ(init_atom_table)
1448     int          entries;      /* number of entries */
1449 @END
1450
1451
1452 /* Get the message queue of the current thread */
1453 @REQ(get_msg_queue)
1454 @REPLY
1455     handle_t     handle;       /* handle to the queue */
1456 @END
1457
1458
1459 /* Set the current message queue wakeup mask */
1460 @REQ(set_queue_mask)
1461     unsigned int wake_mask;    /* wakeup bits mask */
1462     unsigned int changed_mask; /* changed bits mask */
1463     int          skip_wait;    /* will we skip waiting if signaled? */
1464 @REPLY
1465     unsigned int wake_bits;    /* current wake bits */
1466     unsigned int changed_bits; /* current changed bits */
1467 @END
1468
1469
1470 /* Get the current message queue status */
1471 @REQ(get_queue_status)
1472     int          clear;        /* should we clear the change bits? */
1473 @REPLY
1474     unsigned int wake_bits;    /* wake bits */
1475     unsigned int changed_bits; /* changed bits since last time */
1476 @END
1477
1478
1479 /* Wait for a process to start waiting on input */
1480 @REQ(wait_input_idle)
1481     handle_t     handle;       /* process handle */
1482     int          timeout;      /* timeout */
1483 @REPLY
1484     handle_t     event;        /* handle to idle event */
1485 @END
1486
1487
1488 /* Send a message to a thread queue */
1489 @REQ(send_message)
1490     void*           id;        /* thread id */
1491     int             type;      /* message type (see below) */
1492     user_handle_t   win;       /* window handle */
1493     unsigned int    msg;       /* message code */
1494     unsigned int    wparam;    /* parameters */
1495     unsigned int    lparam;    /* parameters */
1496     int             x;         /* x position */
1497     int             y;         /* y position */
1498     unsigned int    time;      /* message time */
1499     unsigned int    info;      /* extra info */
1500     int             timeout;   /* timeout for reply */
1501     VARARG(data,bytes);        /* message data for sent messages */
1502 @END
1503
1504 enum message_type
1505 {
1506     MSG_ASCII,          /* Ascii message (from SendMessageA) */
1507     MSG_UNICODE,        /* Unicode message (from SendMessageW) */
1508     MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
1509     MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
1510     MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
1511     MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
1512     MSG_HARDWARE_RAW,   /* raw hardware message */
1513     MSG_HARDWARE_COOKED /* cooked hardware message */
1514 };
1515
1516
1517 /* Get a message from the current queue */
1518 @REQ(get_message)
1519     int             flags;     /* see below */
1520     user_handle_t   get_win;   /* window handle to get */
1521     unsigned int    get_first; /* first message code to get */
1522     unsigned int    get_last;  /* last message code to get */
1523 @REPLY
1524     int             type;      /* message type */
1525     user_handle_t   win;       /* window handle */
1526     unsigned int    msg;       /* message code */
1527     unsigned int    wparam;    /* parameters */
1528     unsigned int    lparam;    /* parameters */
1529     int             x;         /* x position */
1530     int             y;         /* y position */
1531     unsigned int    time;      /* message time */
1532     unsigned int    info;      /* extra info */
1533     size_t          total;     /* total size of extra data */
1534     VARARG(data,bytes);        /* message data for sent messages */
1535 @END
1536 #define GET_MSG_REMOVE      1  /* remove the message */
1537 #define GET_MSG_SENT_ONLY   2  /* only get sent messages */
1538 #define GET_MSG_REMOVE_LAST 4  /* remove last message returned before checking for a new one */
1539
1540 /* Reply to a sent message */
1541 @REQ(reply_message)
1542     unsigned int    result;    /* message result */
1543     int             remove;    /* should we remove the message? */
1544     VARARG(data,bytes);        /* message data for sent messages */
1545 @END
1546
1547
1548 /* Retrieve the reply for the last message sent */
1549 @REQ(get_message_reply)
1550     int             cancel;    /* cancel message if not ready? */
1551 @REPLY
1552     unsigned int    result;    /* message result */
1553     VARARG(data,bytes);        /* message data for sent messages */
1554 @END
1555
1556
1557 /* Set a window timer */
1558 @REQ(set_win_timer)
1559     user_handle_t   win;       /* window handle */
1560     unsigned int    msg;       /* message to post */
1561     unsigned int    id;        /* timer id */
1562     unsigned int    rate;      /* timer rate in ms */
1563     unsigned int    lparam;    /* message lparam (callback proc) */
1564 @END
1565
1566
1567 /* Kill a window timer */
1568 @REQ(kill_win_timer)
1569     user_handle_t   win;       /* window handle */
1570     unsigned int    msg;       /* message to post */
1571     unsigned int    id;        /* timer id */
1572 @END
1573
1574
1575 /* Open a serial port */
1576 @REQ(create_serial)
1577     unsigned int access;       /* wanted access rights */
1578     int          inherit;      /* inherit flag */
1579     unsigned int attributes;   /* eg. FILE_FLAG_OVERLAPPED */
1580     unsigned int sharing;      /* sharing flags */
1581     VARARG(name,string);       /* file name */
1582 @REPLY
1583     handle_t     handle;       /* handle to the port */
1584 @END
1585
1586
1587 /* Retrieve info about a serial port */
1588 @REQ(get_serial_info)
1589     handle_t     handle;       /* handle to comm port */
1590 @REPLY
1591     unsigned int readinterval;
1592     unsigned int readconst;
1593     unsigned int readmult;
1594     unsigned int writeconst;
1595     unsigned int writemult;
1596     unsigned int eventmask;
1597     unsigned int commerror;
1598 @END
1599
1600
1601 /* Set info about a serial port */
1602 @REQ(set_serial_info)
1603     handle_t     handle;       /* handle to comm port */
1604     int          flags;        /* bitmask to set values (see below) */
1605     unsigned int readinterval;
1606     unsigned int readconst;
1607     unsigned int readmult;
1608     unsigned int writeconst;
1609     unsigned int writemult;
1610     unsigned int eventmask;
1611     unsigned int commerror;
1612 @END
1613 #define SERIALINFO_SET_TIMEOUTS  0x01
1614 #define SERIALINFO_SET_MASK      0x02
1615 #define SERIALINFO_SET_ERROR     0x04
1616
1617
1618 /* Create / reschedule an async I/O */
1619 @REQ(register_async)
1620     handle_t     handle;  /* handle to comm port, socket or file */
1621     int          type;
1622     void*        overlapped;
1623     int          count;
1624     unsigned int status;
1625 @END
1626 #define ASYNC_TYPE_NONE  0x00
1627 #define ASYNC_TYPE_READ  0x01
1628 #define ASYNC_TYPE_WRITE 0x02
1629 #define ASYNC_TYPE_WAIT  0x03
1630
1631
1632 /* Create a named pipe */
1633 @REQ(create_named_pipe)
1634     unsigned int   openmode;
1635     unsigned int   pipemode;
1636     unsigned int   maxinstances;
1637     unsigned int   outsize;
1638     unsigned int   insize;
1639     unsigned int   timeout;
1640     VARARG(name,unicode_str);    /* pipe name */
1641 @REPLY
1642     handle_t       handle;       /* handle to the pipe */
1643 @END
1644
1645
1646 /* Open an existing named pipe */
1647 @REQ(open_named_pipe)
1648     unsigned int   access;
1649     VARARG(name,unicode_str);    /* pipe name */
1650 @REPLY
1651     handle_t       handle;       /* handle to the pipe */
1652 @END
1653
1654
1655 /* Connect to a named pipe */
1656 @REQ(connect_named_pipe)
1657     handle_t       handle;
1658     void*          overlapped;
1659     void*          func;
1660 @END
1661
1662
1663 /* Wait for a named pipe */
1664 @REQ(wait_named_pipe)
1665     unsigned int   timeout;
1666     void*          overlapped;
1667     void*          func;
1668     VARARG(name,unicode_str);    /* pipe name */
1669 @END
1670
1671
1672 /* Disconnect a named pipe */
1673 @REQ(disconnect_named_pipe)
1674     handle_t       handle;
1675 @END
1676
1677
1678 @REQ(get_named_pipe_info)
1679     handle_t       handle;
1680 @REPLY
1681     unsigned int   flags;
1682     unsigned int   maxinstances;
1683     unsigned int   outsize;
1684     unsigned int   insize;
1685 @END
1686
1687
1688 @REQ(create_smb)
1689     int            fd;
1690     unsigned int   tree_id;
1691     unsigned int   user_id;
1692     unsigned int   file_id;
1693     unsigned int   dialect;
1694 @REPLY
1695     handle_t       handle;
1696 @END
1697
1698
1699 @REQ(get_smb_info)
1700     handle_t       handle;
1701     unsigned int   flags;
1702     unsigned int   offset;
1703 @REPLY
1704     unsigned int   tree_id;
1705     unsigned int   user_id;
1706     unsigned int   dialect;
1707     unsigned int   file_id;
1708     unsigned int   offset;
1709 @END
1710 #define SMBINFO_SET_OFFSET    0x01
1711
1712
1713 /* Create a window */
1714 @REQ(create_window)
1715     user_handle_t  parent;      /* parent window */
1716     user_handle_t  owner;       /* owner window */
1717     atom_t         atom;        /* class atom */
1718 @REPLY
1719     user_handle_t  handle;      /* created window */
1720 @END
1721
1722
1723 /* Link a window into the tree */
1724 @REQ(link_window)
1725     user_handle_t  handle;      /* handle to the window */
1726     user_handle_t  parent;      /* handle to the parent */
1727     user_handle_t  previous;    /* previous child in Z-order */
1728 @REPLY
1729     user_handle_t  full_parent; /* full handle of new parent */
1730 @END
1731
1732
1733 /* Destroy a window */
1734 @REQ(destroy_window)
1735     user_handle_t  handle;      /* handle to the window */
1736 @END
1737
1738
1739 /* Set a window owner */
1740 @REQ(set_window_owner)
1741     user_handle_t  handle;      /* handle to the window */
1742     user_handle_t  owner;       /* new owner */
1743 @REPLY
1744     user_handle_t  full_owner;  /* full handle of new owner */
1745 @END
1746
1747
1748 /* Get information from a window handle */
1749 @REQ(get_window_info)
1750     user_handle_t  handle;      /* handle to the window */
1751 @REPLY
1752     user_handle_t  full_handle; /* full 32-bit handle */
1753     void*          pid;         /* process owning the window */
1754     void*          tid;         /* thread owning the window */
1755     atom_t         atom;        /* class atom */
1756 @END
1757
1758
1759 /* Set some information in a window */
1760 @REQ(set_window_info)
1761     user_handle_t  handle;        /* handle to the window */
1762     unsigned int   flags;         /* flags for fields to set (see below) */
1763     unsigned int   style;         /* window style */
1764     unsigned int   ex_style;      /* window extended style */
1765     unsigned int   id;            /* window id */
1766     void*          instance;      /* creator instance */
1767     void*          user_data;     /* user-specific data */
1768 @REPLY
1769     unsigned int   old_style;     /* old window style */
1770     unsigned int   old_ex_style;  /* old window extended style */
1771     unsigned int   old_id;        /* old window id */
1772     void*          old_instance;  /* old creator instance */
1773     void*          old_user_data; /* old user-specific data */
1774 @END
1775 #define SET_WIN_STYLE     0x01
1776 #define SET_WIN_EXSTYLE   0x02
1777 #define SET_WIN_ID        0x04
1778 #define SET_WIN_INSTANCE  0x08
1779 #define SET_WIN_USERDATA  0x10
1780
1781
1782 /* Get a list of the window parents, up to the root of the tree */
1783 @REQ(get_window_parents)
1784     user_handle_t  handle;        /* handle to the window */
1785 @REPLY
1786     int            count;         /* total count of parents */
1787     VARARG(parents,user_handles); /* parent handles */
1788 @END
1789
1790
1791 /* Get a list of the window children */
1792 @REQ(get_window_children)
1793     user_handle_t  parent;        /* parent window */
1794     atom_t         atom;          /* class atom for the listed children */
1795     void*          tid;           /* thread owning the listed children */
1796 @REPLY
1797     int            count;         /* total count of children */
1798     VARARG(children,user_handles); /* children handles */
1799 @END
1800
1801
1802 /* Get window tree information from a window handle */
1803 @REQ(get_window_tree)
1804     user_handle_t  handle;        /* handle to the window */
1805 @REPLY
1806     user_handle_t  parent;        /* parent window */
1807     user_handle_t  owner;         /* owner window */
1808     user_handle_t  next_sibling;  /* next sibling in Z-order */
1809     user_handle_t  prev_sibling;  /* prev sibling in Z-order */
1810     user_handle_t  first_sibling; /* first sibling in Z-order */
1811     user_handle_t  last_sibling;  /* last sibling in Z-order */
1812     user_handle_t  first_child;   /* first child */
1813     user_handle_t  last_child;    /* last child */
1814 @END
1815
1816 /* Set the window and client rectangles of a window */
1817 @REQ(set_window_rectangles)
1818     user_handle_t  handle;        /* handle to the window */
1819     rectangle_t    window;        /* window rectangle */
1820     rectangle_t    client;        /* client rectangle */
1821 @END
1822
1823
1824 /* Get the window and client rectangles of a window */
1825 @REQ(get_window_rectangles)
1826     user_handle_t  handle;        /* handle to the window */
1827 @REPLY
1828     rectangle_t    window;        /* window rectangle */
1829     rectangle_t    client;        /* client rectangle */
1830 @END
1831
1832
1833 /* Get the window text */
1834 @REQ(get_window_text)
1835     user_handle_t  handle;        /* handle to the window */
1836 @REPLY
1837     VARARG(text,unicode_str);     /* window text */
1838 @END
1839
1840
1841 /* Set the window text */
1842 @REQ(set_window_text)
1843     user_handle_t  handle;        /* handle to the window */
1844     VARARG(text,unicode_str);     /* window text */
1845 @END
1846
1847
1848 /* Increment the window paint count */
1849 @REQ(inc_window_paint_count)
1850     user_handle_t  handle;        /* handle to the window */
1851     int             incr;         /* increment (can be negative) */
1852 @END
1853
1854
1855 /* Get the coordinates offset between two windows */
1856 @REQ(get_windows_offset)
1857     user_handle_t  from;          /* handle to the first window */
1858     user_handle_t  to;            /* handle to the second window */
1859 @REPLY
1860     int            x;             /* x coordinate offset */
1861     int            y;             /* y coordinate offset */
1862 @END
1863
1864
1865 /* Set a window property */
1866 @REQ(set_window_property)
1867     user_handle_t  window;        /* handle to the window */
1868     atom_t         atom;          /* property atom (high-word set if it was a string) */
1869     int            string;        /* was atom a string originally? */
1870     handle_t       handle;        /* handle to store */
1871 @END
1872
1873
1874 /* Remove a window property */
1875 @REQ(remove_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 a window property */
1884 @REQ(get_window_property)
1885     user_handle_t  window;        /* handle to the window */
1886     atom_t         atom;          /* property atom */
1887 @REPLY
1888     handle_t       handle;        /* handle stored in property */
1889 @END
1890
1891
1892 /* Get the list of properties of a window */
1893 @REQ(get_window_properties)
1894     user_handle_t  window;        /* handle to the window */
1895 @REPLY
1896     int            total;         /* total number of properties */
1897     VARARG(props,properties);     /* list of properties */
1898 @END