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