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