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