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