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