Implemented file change notifications, based on a patch by Mike
[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     obj_handle_t handle;        /* handle to the directory */
1059     int          subtree;       /* watch all the subtree */
1060     unsigned int filter;        /* notification filter */
1061 @REPLY
1062     obj_handle_t handle;        /* handle to the change notification */
1063 @END
1064
1065
1066 /* Move to the next change notification */
1067 @REQ(next_change_notification)
1068     obj_handle_t handle;        /* handle to the change notification */
1069 @END
1070
1071 /* Create a file mapping */
1072 @REQ(create_mapping)
1073     int          size_high;     /* mapping size */
1074     int          size_low;      /* mapping size */
1075     int          protect;       /* protection flags (see below) */
1076     unsigned int access;        /* wanted access rights */
1077     int          inherit;       /* inherit flag */
1078     obj_handle_t file_handle;   /* file handle */
1079     VARARG(name,unicode_str);   /* object name */
1080 @REPLY
1081     obj_handle_t handle;        /* handle to the mapping */
1082 @END
1083 /* protection flags */
1084 #define VPROT_READ       0x01
1085 #define VPROT_WRITE      0x02
1086 #define VPROT_EXEC       0x04
1087 #define VPROT_WRITECOPY  0x08
1088 #define VPROT_GUARD      0x10
1089 #define VPROT_NOCACHE    0x20
1090 #define VPROT_COMMITTED  0x40
1091 #define VPROT_IMAGE      0x80
1092
1093
1094 /* Open a mapping */
1095 @REQ(open_mapping)
1096     unsigned int access;        /* wanted access rights */
1097     int          inherit;       /* inherit flag */
1098     VARARG(name,unicode_str);   /* object name */
1099 @REPLY
1100     obj_handle_t handle;        /* handle to the mapping */
1101 @END
1102
1103
1104 /* Get information about a file mapping */
1105 @REQ(get_mapping_info)
1106     obj_handle_t handle;        /* handle to the mapping */
1107 @REPLY
1108     int          size_high;     /* mapping size */
1109     int          size_low;      /* mapping size */
1110     int          protect;       /* protection flags */
1111     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1112     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1113     obj_handle_t shared_file;   /* shared mapping file handle */
1114     int          shared_size;   /* shared mapping size */
1115     int          drive_type;    /* type of drive the file is on */
1116 @END
1117
1118
1119 /* Create a device */
1120 @REQ(create_device)
1121     unsigned int access;        /* wanted access rights */
1122     int          inherit;       /* inherit flag */
1123     int          id;            /* client private id */
1124 @REPLY
1125     obj_handle_t handle;        /* handle to the device */
1126 @END
1127
1128
1129 /* Retrieve the client private id for a device */
1130 @REQ(get_device_id)
1131     obj_handle_t handle;        /* handle to the device */
1132 @REPLY
1133     int          id;            /* client private id */
1134 @END
1135
1136
1137 #define SNAP_HEAPLIST   0x00000001
1138 #define SNAP_PROCESS    0x00000002
1139 #define SNAP_THREAD     0x00000004
1140 #define SNAP_MODULE     0x00000008
1141 /* Create a snapshot */
1142 @REQ(create_snapshot)
1143     int          inherit;       /* inherit flag */
1144     int          flags;         /* snapshot flags (SNAP_*) */
1145     process_id_t pid;           /* process id */
1146 @REPLY
1147     obj_handle_t handle;        /* handle to the snapshot */
1148 @END
1149
1150
1151 /* Get the next process from a snapshot */
1152 @REQ(next_process)
1153     obj_handle_t handle;        /* handle to the snapshot */
1154     int          reset;         /* reset snapshot position? */
1155 @REPLY
1156     int          count;         /* process usage count */
1157     process_id_t pid;           /* process id */
1158     process_id_t ppid;          /* parent process id */
1159     void*        heap;          /* heap base */
1160     void*        module;        /* main module */
1161     int          threads;       /* number of threads */
1162     int          priority;      /* process priority */
1163     VARARG(filename,string);    /* file name of main exe */
1164 @END
1165
1166
1167 /* Get the next thread from a snapshot */
1168 @REQ(next_thread)
1169     obj_handle_t handle;        /* handle to the snapshot */
1170     int          reset;         /* reset snapshot position? */
1171 @REPLY
1172     int          count;         /* thread usage count */
1173     process_id_t pid;           /* process id */
1174     thread_id_t  tid;           /* thread id */
1175     int          base_pri;      /* base priority */
1176     int          delta_pri;     /* delta priority */
1177 @END
1178
1179
1180 /* Get the next module from a snapshot */
1181 @REQ(next_module)
1182     obj_handle_t handle;        /* handle to the snapshot */
1183     int          reset;         /* reset snapshot position? */
1184 @REPLY
1185     process_id_t pid;           /* process id */
1186     void*        base;          /* module base address */
1187     size_t       size;          /* module size */
1188     VARARG(filename,string);    /* file name of module */
1189 @END
1190
1191
1192 /* Wait for a debug event */
1193 @REQ(wait_debug_event)
1194     int           get_handle;  /* should we alloc a handle for waiting? */
1195 @REPLY
1196     process_id_t  pid;         /* process id */
1197     thread_id_t   tid;         /* thread id */
1198     obj_handle_t  wait;        /* wait handle if no event ready */
1199     VARARG(event,debug_event); /* debug event data */
1200 @END
1201
1202
1203 /* Queue an exception event */
1204 @REQ(queue_exception_event)
1205     int              first;    /* first chance exception? */
1206     VARARG(record,exc_event);  /* thread context followed by exception record */
1207 @REPLY
1208     obj_handle_t     handle;   /* handle to the queued event */
1209 @END
1210
1211
1212 /* Retrieve the status of an exception event */
1213 @REQ(get_exception_status)
1214     obj_handle_t     handle;   /* handle to the queued event */
1215 @REPLY
1216     int              status;   /* event continuation status */
1217     VARARG(context,context);   /* modified thread context */
1218 @END
1219
1220
1221 /* Send an output string to the debugger */
1222 @REQ(output_debug_string)
1223     void*         string;      /* string to display (in debugged process address space) */
1224     int           unicode;     /* is it Unicode? */
1225     int           length;      /* string length */
1226 @END
1227
1228
1229 /* Continue a debug event */
1230 @REQ(continue_debug_event)
1231     process_id_t pid;          /* process id to continue */
1232     thread_id_t  tid;          /* thread id to continue */
1233     int          status;       /* continuation status */
1234 @END
1235
1236
1237 /* Start/stop debugging an existing process */
1238 @REQ(debug_process)
1239     process_id_t pid;          /* id of the process to debug */
1240     int          attach;       /* 1=attaching / 0=detaching from the process */
1241 @END
1242
1243
1244 /* Simulate a breakpoint in a process */
1245 @REQ(debug_break)
1246     obj_handle_t handle;       /* process handle */
1247 @REPLY
1248     int          self;         /* was it the caller itself? */
1249 @END
1250
1251
1252 /* Set debugger kill on exit flag */
1253 @REQ(set_debugger_kill_on_exit)
1254     int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1255 @END
1256
1257
1258 /* Read data from a process address space */
1259 @REQ(read_process_memory)
1260     obj_handle_t handle;       /* process handle */
1261     void*        addr;         /* addr to read from */
1262 @REPLY
1263     VARARG(data,bytes);        /* result data */
1264 @END
1265
1266
1267 /* Write data to a process address space */
1268 @REQ(write_process_memory)
1269     obj_handle_t handle;       /* process handle */
1270     void*        addr;         /* addr to write to (must be int-aligned) */
1271     unsigned int first_mask;   /* mask for first word */
1272     unsigned int last_mask;    /* mask for last word */
1273     VARARG(data,bytes);        /* data to write */
1274 @END
1275
1276
1277 /* Create a registry key */
1278 @REQ(create_key)
1279     obj_handle_t parent;       /* handle to the parent key */
1280     unsigned int access;       /* desired access rights */
1281     unsigned int options;      /* creation options */
1282     time_t       modif;        /* last modification time */
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 @REPLY
1287     obj_handle_t hkey;         /* handle to the created key */
1288     int          created;      /* has it been newly created? */
1289 @END
1290
1291 /* Open a registry key */
1292 @REQ(open_key)
1293     obj_handle_t parent;       /* handle to the parent key */
1294     unsigned int access;       /* desired access rights */
1295     VARARG(name,unicode_str);  /* key name */
1296 @REPLY
1297     obj_handle_t hkey;         /* handle to the open key */
1298 @END
1299
1300
1301 /* Delete a registry key */
1302 @REQ(delete_key)
1303     obj_handle_t hkey;         /* handle to the key */
1304 @END
1305
1306
1307 /* Enumerate registry subkeys */
1308 @REQ(enum_key)
1309     obj_handle_t hkey;         /* handle to registry key */
1310     int          index;        /* index of subkey (or -1 for current key) */
1311     int          info_class;   /* requested information class */
1312 @REPLY
1313     int          subkeys;      /* number of subkeys */
1314     int          max_subkey;   /* longest subkey name */
1315     int          max_class;    /* longest class name */
1316     int          values;       /* number of values */
1317     int          max_value;    /* longest value name */
1318     int          max_data;     /* longest value data */
1319     time_t       modif;        /* last modification time */
1320     size_t       total;        /* total length needed for full name and class */
1321     size_t       namelen;      /* length of key name in bytes */
1322     VARARG(name,unicode_str,namelen);  /* key name */
1323     VARARG(class,unicode_str);         /* class name */
1324 @END
1325
1326
1327 /* Set a value of a registry key */
1328 @REQ(set_key_value)
1329     obj_handle_t hkey;         /* handle to registry key */
1330     int          type;         /* value type */
1331     size_t       namelen;      /* length of value name in bytes */
1332     VARARG(name,unicode_str,namelen);  /* value name */
1333     VARARG(data,bytes);                /* value data */
1334 @END
1335
1336
1337 /* Retrieve the value of a registry key */
1338 @REQ(get_key_value)
1339     obj_handle_t hkey;         /* handle to registry key */
1340     VARARG(name,unicode_str);  /* value name */
1341 @REPLY
1342     int          type;         /* value type */
1343     size_t       total;        /* total length needed for data */
1344     VARARG(data,bytes);        /* value data */
1345 @END
1346
1347
1348 /* Enumerate a value of a registry key */
1349 @REQ(enum_key_value)
1350     obj_handle_t hkey;         /* handle to registry key */
1351     int          index;        /* value index */
1352     int          info_class;   /* requested information class */
1353 @REPLY
1354     int          type;         /* value type */
1355     size_t       total;        /* total length needed for full name and data */
1356     size_t       namelen;      /* length of value name in bytes */
1357     VARARG(name,unicode_str,namelen);  /* value name */
1358     VARARG(data,bytes);                /* value data */
1359 @END
1360
1361
1362 /* Delete a value of a registry key */
1363 @REQ(delete_key_value)
1364     obj_handle_t hkey;         /* handle to registry key */
1365     VARARG(name,unicode_str);  /* value name */
1366 @END
1367
1368
1369 /* Load a registry branch from a file */
1370 @REQ(load_registry)
1371     obj_handle_t hkey;         /* root key to load to */
1372     obj_handle_t file;         /* file to load from */
1373     VARARG(name,unicode_str);  /* subkey name */
1374 @END
1375
1376
1377 /* Save a registry branch to a file */
1378 @REQ(save_registry)
1379     obj_handle_t hkey;         /* key to save */
1380     obj_handle_t file;         /* file to save to */
1381 @END
1382
1383
1384 /* Save a registry branch at server exit */
1385 @REQ(save_registry_atexit)
1386     obj_handle_t hkey;         /* key to save */
1387     VARARG(file,string);       /* file to save to */
1388 @END
1389
1390
1391 /* Set the current and saving level for the registry */
1392 @REQ(set_registry_levels)
1393     int          current;      /* new current level */
1394     int          saving;       /* new saving level */
1395     int          period;       /* duration between periodic saves (milliseconds) */
1396 @END
1397
1398
1399 @REQ(set_registry_notification)
1400     obj_handle_t hkey;         /* key to watch for changes */
1401     obj_handle_t event;        /* event to set */
1402     int          subtree;      /* should we watch the whole subtree? */
1403     unsigned int filter;       /* things to watch */
1404 @END
1405
1406
1407 /* Create a waitable timer */
1408 @REQ(create_timer)
1409     int          inherit;       /* inherit flag */
1410     int          manual;        /* manual reset */
1411     VARARG(name,unicode_str);   /* object name */
1412 @REPLY
1413     obj_handle_t handle;        /* handle to the timer */
1414 @END
1415
1416
1417 /* Open a waitable timer */
1418 @REQ(open_timer)
1419     unsigned int access;        /* wanted access rights */
1420     int          inherit;       /* inherit flag */
1421     VARARG(name,unicode_str);   /* object name */
1422 @REPLY
1423     obj_handle_t handle;        /* handle to the timer */
1424 @END
1425
1426 /* Set a waitable timer */
1427 @REQ(set_timer)
1428     obj_handle_t handle;        /* handle to the timer */
1429     int          sec;           /* next expiration absolute time */
1430     int          usec;          /* next expiration absolute time */
1431     int          period;        /* timer period in ms */
1432     void*        callback;      /* callback function */
1433     void*        arg;           /* callback argument */
1434 @END
1435
1436 /* Cancel a waitable timer */
1437 @REQ(cancel_timer)
1438     obj_handle_t handle;        /* handle to the timer */
1439 @END
1440
1441
1442 /* Retrieve the current context of a thread */
1443 @REQ(get_thread_context)
1444     obj_handle_t handle;       /* thread handle */
1445     unsigned int flags;        /* context flags */
1446 @REPLY
1447     VARARG(context,context);   /* thread context */
1448 @END
1449
1450
1451 /* Set the current context of a thread */
1452 @REQ(set_thread_context)
1453     obj_handle_t handle;       /* thread handle */
1454     unsigned int flags;        /* context flags */
1455     VARARG(context,context);   /* thread context */
1456 @END
1457
1458
1459 /* Fetch a selector entry for a thread */
1460 @REQ(get_selector_entry)
1461     obj_handle_t  handle;      /* thread handle */
1462     int           entry;       /* LDT entry */
1463 @REPLY
1464     unsigned int  base;        /* selector base */
1465     unsigned int  limit;       /* selector limit */
1466     unsigned char flags;       /* selector flags */
1467 @END
1468
1469
1470 /* Add an atom */
1471 @REQ(add_atom)
1472     int           local;       /* is atom in local process table? */
1473     VARARG(name,unicode_str);  /* atom name */
1474 @REPLY
1475     atom_t        atom;        /* resulting atom */
1476 @END
1477
1478
1479 /* Delete an atom */
1480 @REQ(delete_atom)
1481     atom_t        atom;        /* atom handle */
1482     int           local;       /* is atom in local process table? */
1483 @END
1484
1485
1486 /* Find an atom */
1487 @REQ(find_atom)
1488     int          local;        /* is atom in local process table? */
1489     VARARG(name,unicode_str);  /* atom name */
1490 @REPLY
1491     atom_t       atom;         /* atom handle */
1492 @END
1493
1494
1495 /* Get an atom name */
1496 @REQ(get_atom_name)
1497     atom_t       atom;         /* atom handle */
1498     int          local;        /* is atom in local process table? */
1499 @REPLY
1500     int          count;        /* atom lock count */
1501     VARARG(name,unicode_str);  /* atom name */
1502 @END
1503
1504
1505 /* Init the process atom table */
1506 @REQ(init_atom_table)
1507     int          entries;      /* number of entries */
1508 @END
1509
1510
1511 /* Get the message queue of the current thread */
1512 @REQ(get_msg_queue)
1513 @REPLY
1514     obj_handle_t handle;       /* handle to the queue */
1515 @END
1516
1517
1518 /* Set the current message queue wakeup mask */
1519 @REQ(set_queue_mask)
1520     unsigned int wake_mask;    /* wakeup bits mask */
1521     unsigned int changed_mask; /* changed bits mask */
1522     int          skip_wait;    /* will we skip waiting if signaled? */
1523 @REPLY
1524     unsigned int wake_bits;    /* current wake bits */
1525     unsigned int changed_bits; /* current changed bits */
1526 @END
1527
1528
1529 /* Get the current message queue status */
1530 @REQ(get_queue_status)
1531     int          clear;        /* should we clear the change bits? */
1532 @REPLY
1533     unsigned int wake_bits;    /* wake bits */
1534     unsigned int changed_bits; /* changed bits since last time */
1535 @END
1536
1537
1538 /* Wait for a process to start waiting on input */
1539 @REQ(wait_input_idle)
1540     obj_handle_t handle;       /* process handle */
1541     int          timeout;      /* timeout */
1542 @REPLY
1543     obj_handle_t event;        /* handle to idle event */
1544 @END
1545
1546
1547 /* Send a message to a thread queue */
1548 @REQ(send_message)
1549     thread_id_t     id;        /* thread id */
1550     int             type;      /* message type (see below) */
1551     user_handle_t   win;       /* window handle */
1552     unsigned int    msg;       /* message code */
1553     unsigned int    wparam;    /* parameters */
1554     unsigned int    lparam;    /* parameters */
1555     int             x;         /* x position */
1556     int             y;         /* y position */
1557     unsigned int    time;      /* message time */
1558     unsigned int    info;      /* extra info */
1559     int             timeout;   /* timeout for reply */
1560     VARARG(data,bytes);        /* message data for sent messages */
1561 @END
1562
1563 enum message_type
1564 {
1565     MSG_ASCII,          /* Ascii message (from SendMessageA) */
1566     MSG_UNICODE,        /* Unicode message (from SendMessageW) */
1567     MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
1568     MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
1569     MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
1570     MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
1571     MSG_HARDWARE        /* hardware message */
1572 };
1573
1574
1575 /* Get a message from the current queue */
1576 @REQ(get_message)
1577     int             flags;     /* see below */
1578     user_handle_t   get_win;   /* window handle to get */
1579     unsigned int    get_first; /* first message code to get */
1580     unsigned int    get_last;  /* last message code to get */
1581 @REPLY
1582     int             type;      /* message type */
1583     user_handle_t   win;       /* window handle */
1584     unsigned int    msg;       /* message code */
1585     unsigned int    wparam;    /* parameters */
1586     unsigned int    lparam;    /* parameters */
1587     int             x;         /* x position */
1588     int             y;         /* y position */
1589     unsigned int    time;      /* message time */
1590     unsigned int    info;      /* extra info */
1591     size_t          total;     /* total size of extra data */
1592     VARARG(data,bytes);        /* message data for sent messages */
1593 @END
1594 #define GET_MSG_REMOVE      1  /* remove the message */
1595 #define GET_MSG_SENT_ONLY   2  /* only get sent messages */
1596
1597 /* Reply to a sent message */
1598 @REQ(reply_message)
1599     int             type;      /* type of original message */
1600     unsigned int    result;    /* message result */
1601     int             remove;    /* should we remove the message? */
1602     VARARG(data,bytes);        /* message data for sent messages */
1603 @END
1604
1605
1606 /* Retrieve the reply for the last message sent */
1607 @REQ(get_message_reply)
1608     int             cancel;    /* cancel message if not ready? */
1609 @REPLY
1610     unsigned int    result;    /* message result */
1611     VARARG(data,bytes);        /* message data for sent messages */
1612 @END
1613
1614
1615 /* Set a window timer */
1616 @REQ(set_win_timer)
1617     user_handle_t   win;       /* window handle */
1618     unsigned int    msg;       /* message to post */
1619     unsigned int    id;        /* timer id */
1620     unsigned int    rate;      /* timer rate in ms */
1621     unsigned int    lparam;    /* message lparam (callback proc) */
1622 @END
1623
1624
1625 /* Kill a window timer */
1626 @REQ(kill_win_timer)
1627     user_handle_t   win;       /* window handle */
1628     unsigned int    msg;       /* message to post */
1629     unsigned int    id;        /* timer id */
1630 @END
1631
1632
1633 /* Open a serial port */
1634 @REQ(create_serial)
1635     unsigned int access;       /* wanted access rights */
1636     int          inherit;      /* inherit flag */
1637     unsigned int attributes;   /* eg. FILE_FLAG_OVERLAPPED */
1638     unsigned int sharing;      /* sharing flags */
1639     VARARG(name,string);       /* file name */
1640 @REPLY
1641     obj_handle_t handle;       /* handle to the port */
1642 @END
1643
1644
1645 /* Retrieve info about a serial port */
1646 @REQ(get_serial_info)
1647     obj_handle_t handle;       /* handle to comm port */
1648 @REPLY
1649     unsigned int readinterval;
1650     unsigned int readconst;
1651     unsigned int readmult;
1652     unsigned int writeconst;
1653     unsigned int writemult;
1654     unsigned int eventmask;
1655     unsigned int commerror;
1656 @END
1657
1658
1659 /* Set info about a serial port */
1660 @REQ(set_serial_info)
1661     obj_handle_t handle;       /* handle to comm port */
1662     int          flags;        /* bitmask to set values (see below) */
1663     unsigned int readinterval;
1664     unsigned int readconst;
1665     unsigned int readmult;
1666     unsigned int writeconst;
1667     unsigned int writemult;
1668     unsigned int eventmask;
1669     unsigned int commerror;
1670 @END
1671 #define SERIALINFO_SET_TIMEOUTS  0x01
1672 #define SERIALINFO_SET_MASK      0x02
1673 #define SERIALINFO_SET_ERROR     0x04
1674
1675
1676 /* Create / reschedule an async I/O */
1677 @REQ(register_async)
1678     obj_handle_t handle;  /* handle to comm port, socket or file */
1679     int          type;
1680     void*        overlapped;
1681     int          count;
1682     unsigned int status;
1683 @END
1684 #define ASYNC_TYPE_NONE  0x00
1685 #define ASYNC_TYPE_READ  0x01
1686 #define ASYNC_TYPE_WRITE 0x02
1687 #define ASYNC_TYPE_WAIT  0x03
1688
1689
1690 /* Create a named pipe */
1691 @REQ(create_named_pipe)
1692     unsigned int   openmode;
1693     unsigned int   pipemode;
1694     unsigned int   maxinstances;
1695     unsigned int   outsize;
1696     unsigned int   insize;
1697     unsigned int   timeout;
1698     VARARG(name,unicode_str);    /* pipe name */
1699 @REPLY
1700     obj_handle_t   handle;       /* handle to the pipe */
1701 @END
1702
1703
1704 /* Open an existing named pipe */
1705 @REQ(open_named_pipe)
1706     unsigned int   access;
1707     VARARG(name,unicode_str);    /* pipe name */
1708 @REPLY
1709     obj_handle_t   handle;       /* handle to the pipe */
1710 @END
1711
1712
1713 /* Connect to a named pipe */
1714 @REQ(connect_named_pipe)
1715     obj_handle_t   handle;
1716     void*          overlapped;
1717     void*          func;
1718 @END
1719
1720
1721 /* Wait for a named pipe */
1722 @REQ(wait_named_pipe)
1723     unsigned int   timeout;
1724     void*          overlapped;
1725     void*          func;
1726     VARARG(name,unicode_str);    /* pipe name */
1727 @END
1728
1729
1730 /* Disconnect a named pipe */
1731 @REQ(disconnect_named_pipe)
1732     obj_handle_t   handle;
1733 @END
1734
1735
1736 @REQ(get_named_pipe_info)
1737     obj_handle_t   handle;
1738 @REPLY
1739     unsigned int   flags;
1740     unsigned int   maxinstances;
1741     unsigned int   outsize;
1742     unsigned int   insize;
1743 @END
1744
1745
1746 @REQ(create_smb)
1747     int            fd;
1748     unsigned int   tree_id;
1749     unsigned int   user_id;
1750     unsigned int   file_id;
1751     unsigned int   dialect;
1752 @REPLY
1753     obj_handle_t   handle;
1754 @END
1755
1756
1757 @REQ(get_smb_info)
1758     obj_handle_t   handle;
1759     unsigned int   flags;
1760     unsigned int   offset;
1761 @REPLY
1762     unsigned int   tree_id;
1763     unsigned int   user_id;
1764     unsigned int   dialect;
1765     unsigned int   file_id;
1766     unsigned int   offset;
1767 @END
1768 #define SMBINFO_SET_OFFSET    0x01
1769
1770
1771 /* Create a window */
1772 @REQ(create_window)
1773     user_handle_t  parent;      /* parent window */
1774     user_handle_t  owner;       /* owner window */
1775     atom_t         atom;        /* class atom */
1776 @REPLY
1777     user_handle_t  handle;      /* created window */
1778 @END
1779
1780
1781 /* Link a window into the tree */
1782 @REQ(link_window)
1783     user_handle_t  handle;      /* handle to the window */
1784     user_handle_t  parent;      /* handle to the parent */
1785     user_handle_t  previous;    /* previous child in Z-order */
1786 @REPLY
1787     user_handle_t  full_parent; /* full handle of new parent */
1788 @END
1789
1790
1791 /* Destroy a window */
1792 @REQ(destroy_window)
1793     user_handle_t  handle;      /* handle to the window */
1794 @END
1795
1796
1797 /* Set a window owner */
1798 @REQ(set_window_owner)
1799     user_handle_t  handle;      /* handle to the window */
1800     user_handle_t  owner;       /* new owner */
1801 @REPLY
1802     user_handle_t  full_owner;  /* full handle of new owner */
1803     user_handle_t  prev_owner;  /* full handle of previous owner */
1804 @END
1805
1806
1807 /* Get information from a window handle */
1808 @REQ(get_window_info)
1809     user_handle_t  handle;      /* handle to the window */
1810 @REPLY
1811     user_handle_t  full_handle; /* full 32-bit handle */
1812     user_handle_t  last_active; /* last active popup */
1813     process_id_t   pid;         /* process owning the window */
1814     thread_id_t    tid;         /* thread owning the window */
1815     atom_t         atom;        /* class atom */
1816 @END
1817
1818
1819 /* Set some information in a window */
1820 @REQ(set_window_info)
1821     user_handle_t  handle;        /* handle to the window */
1822     unsigned int   flags;         /* flags for fields to set (see below) */
1823     unsigned int   style;         /* window style */
1824     unsigned int   ex_style;      /* window extended style */
1825     unsigned int   id;            /* window id */
1826     void*          instance;      /* creator instance */
1827     void*          user_data;     /* user-specific data */
1828 @REPLY
1829     unsigned int   old_style;     /* old window style */
1830     unsigned int   old_ex_style;  /* old window extended style */
1831     unsigned int   old_id;        /* old window id */
1832     void*          old_instance;  /* old creator instance */
1833     void*          old_user_data; /* old user-specific data */
1834 @END
1835 #define SET_WIN_STYLE     0x01
1836 #define SET_WIN_EXSTYLE   0x02
1837 #define SET_WIN_ID        0x04
1838 #define SET_WIN_INSTANCE  0x08
1839 #define SET_WIN_USERDATA  0x10
1840
1841
1842 /* Get a list of the window parents, up to the root of the tree */
1843 @REQ(get_window_parents)
1844     user_handle_t  handle;        /* handle to the window */
1845 @REPLY
1846     int            count;         /* total count of parents */
1847     VARARG(parents,user_handles); /* parent handles */
1848 @END
1849
1850
1851 /* Get a list of the window children */
1852 @REQ(get_window_children)
1853     user_handle_t  parent;        /* parent window */
1854     atom_t         atom;          /* class atom for the listed children */
1855     thread_id_t    tid;           /* thread owning the listed children */
1856 @REPLY
1857     int            count;         /* total count of children */
1858     VARARG(children,user_handles); /* children handles */
1859 @END
1860
1861
1862 /* Get window tree information from a window handle */
1863 @REQ(get_window_tree)
1864     user_handle_t  handle;        /* handle to the window */
1865 @REPLY
1866     user_handle_t  parent;        /* parent window */
1867     user_handle_t  owner;         /* owner window */
1868     user_handle_t  next_sibling;  /* next sibling in Z-order */
1869     user_handle_t  prev_sibling;  /* prev sibling in Z-order */
1870     user_handle_t  first_sibling; /* first sibling in Z-order */
1871     user_handle_t  last_sibling;  /* last sibling in Z-order */
1872     user_handle_t  first_child;   /* first child */
1873     user_handle_t  last_child;    /* last child */
1874 @END
1875
1876 /* Set the window and client rectangles of a window */
1877 @REQ(set_window_rectangles)
1878     user_handle_t  handle;        /* handle to the window */
1879     rectangle_t    window;        /* window rectangle */
1880     rectangle_t    client;        /* client rectangle */
1881 @END
1882
1883
1884 /* Get the window and client rectangles of a window */
1885 @REQ(get_window_rectangles)
1886     user_handle_t  handle;        /* handle to the window */
1887 @REPLY
1888     rectangle_t    window;        /* window rectangle */
1889     rectangle_t    client;        /* client rectangle */
1890 @END
1891
1892
1893 /* Get the window text */
1894 @REQ(get_window_text)
1895     user_handle_t  handle;        /* handle to the window */
1896 @REPLY
1897     VARARG(text,unicode_str);     /* window text */
1898 @END
1899
1900
1901 /* Set the window text */
1902 @REQ(set_window_text)
1903     user_handle_t  handle;        /* handle to the window */
1904     VARARG(text,unicode_str);     /* window text */
1905 @END
1906
1907
1908 /* Increment the window paint count */
1909 @REQ(inc_window_paint_count)
1910     user_handle_t  handle;        /* handle to the window */
1911     int             incr;         /* increment (can be negative) */
1912 @END
1913
1914
1915 /* Get the coordinates offset between two windows */
1916 @REQ(get_windows_offset)
1917     user_handle_t  from;          /* handle to the first window */
1918     user_handle_t  to;            /* handle to the second window */
1919 @REPLY
1920     int            x;             /* x coordinate offset */
1921     int            y;             /* y coordinate offset */
1922 @END
1923
1924
1925 /* Set a window property */
1926 @REQ(set_window_property)
1927     user_handle_t  window;        /* handle to the window */
1928     atom_t         atom;          /* property atom (high-word set if it was a string) */
1929     int            string;        /* was atom a string originally? */
1930     obj_handle_t   handle;        /* handle to store */
1931 @END
1932
1933
1934 /* Remove a window property */
1935 @REQ(remove_window_property)
1936     user_handle_t  window;        /* handle to the window */
1937     atom_t         atom;          /* property atom */
1938 @REPLY
1939     obj_handle_t   handle;        /* handle stored in property */
1940 @END
1941
1942
1943 /* Get a window property */
1944 @REQ(get_window_property)
1945     user_handle_t  window;        /* handle to the window */
1946     atom_t         atom;          /* property atom */
1947 @REPLY
1948     obj_handle_t   handle;        /* handle stored in property */
1949 @END
1950
1951
1952 /* Get the list of properties of a window */
1953 @REQ(get_window_properties)
1954     user_handle_t  window;        /* handle to the window */
1955 @REPLY
1956     int            total;         /* total number of properties */
1957     VARARG(props,properties);     /* list of properties */
1958 @END
1959
1960
1961 /* Attach (or detach) thread inputs */
1962 @REQ(attach_thread_input)
1963     thread_id_t    tid_from;       /* thread to be attached */
1964     thread_id_t    tid_to;         /* thread to which tid_from should be attached */
1965     int            attach;         /* is it an attach? */
1966 @END
1967
1968
1969 /* Get input data for a given thread */
1970 @REQ(get_thread_input)
1971     thread_id_t    tid;           /* id of thread */
1972 @REPLY
1973     user_handle_t  focus;         /* handle to the focus window */
1974     user_handle_t  capture;       /* handle to the capture window */
1975     user_handle_t  active;        /* handle to the active window */
1976     user_handle_t  foreground;    /* handle to the global foreground window */
1977     user_handle_t  menu_owner;    /* handle to the menu owner */
1978     user_handle_t  move_size;     /* handle to the moving/resizing window */
1979     user_handle_t  caret;         /* handle to the caret window */
1980     rectangle_t    rect;          /* caret rectangle */
1981 @END
1982
1983 /* Retrieve queue keyboard state for a given thread */
1984 @REQ(get_key_state)
1985     thread_id_t    tid;           /* id of thread */
1986     int            key;           /* optional key code or -1 */
1987 @REPLY
1988     unsigned char  state;         /* state of specified key */
1989     VARARG(keystate,bytes);       /* state array for all the keys */
1990 @END
1991
1992 /* Set queue keyboard state for a given thread */
1993 @REQ(set_key_state)
1994     thread_id_t    tid;           /* id of thread */
1995     VARARG(keystate,bytes);       /* state array for all the keys */
1996 @END
1997
1998 /* Set the system foreground window */
1999 @REQ(set_foreground_window)
2000     user_handle_t  handle;        /* handle to the foreground window */
2001 @REPLY
2002     user_handle_t  previous;      /* handle to the previous foreground window */
2003     int            send_msg_old;  /* whether we have to send a msg to the old window */
2004     int            send_msg_new;  /* whether we have to send a msg to the new window */
2005 @END
2006
2007 /* Set the current thread focus window */
2008 @REQ(set_focus_window)
2009     user_handle_t  handle;        /* handle to the focus window */
2010 @REPLY
2011     user_handle_t  previous;      /* handle to the previous focus window */
2012 @END
2013
2014 /* Set the current thread active window */
2015 @REQ(set_active_window)
2016     user_handle_t  handle;        /* handle to the active window */
2017 @REPLY
2018     user_handle_t  previous;      /* handle to the previous active window */
2019 @END
2020
2021 /* Set the current thread capture window */
2022 @REQ(set_capture_window)
2023     user_handle_t  handle;        /* handle to the capture window */
2024     unsigned int   flags;         /* capture flags (see below) */
2025 @REPLY
2026     user_handle_t  previous;      /* handle to the previous capture window */
2027     user_handle_t  full_handle;   /* full 32-bit handle of new capture window */
2028 @END
2029 #define CAPTURE_MENU     0x01  /* capture is for a menu */
2030 #define CAPTURE_MOVESIZE 0x02  /* capture is for moving/resizing */
2031
2032
2033 /* Set the current thread caret window */
2034 @REQ(set_caret_window)
2035     user_handle_t  handle;        /* handle to the caret window */
2036     int            width;         /* caret width */
2037     int            height;        /* caret height */
2038 @REPLY
2039     user_handle_t  previous;      /* handle to the previous caret window */
2040     rectangle_t    old_rect;      /* previous caret rectangle */
2041     int            old_hide;      /* previous hide count */
2042     int            old_state;     /* previous caret state (1=on, 0=off) */
2043 @END
2044
2045
2046 /* Set the current thread caret information */
2047 @REQ(set_caret_info)
2048     unsigned int   flags;         /* caret flags (see below) */
2049     user_handle_t  handle;        /* handle to the caret window */
2050     int            x;             /* caret x position */
2051     int            y;             /* caret y position */
2052     int            hide;          /* increment for hide count (can be negative to show it) */
2053     int            state;         /* caret state (1=on, 0=off, -1=toggle current state) */
2054 @REPLY
2055     user_handle_t  full_handle;   /* handle to the current caret window */
2056     rectangle_t    old_rect;      /* previous caret rectangle */
2057     int            old_hide;      /* previous hide count */
2058     int            old_state;     /* previous caret state (1=on, 0=off) */
2059 @END
2060 #define SET_CARET_POS        0x01  /* set the caret position from x,y */
2061 #define SET_CARET_HIDE       0x02  /* increment the caret hide count */
2062 #define SET_CARET_STATE      0x04  /* set the caret on/off state */
2063
2064
2065 /* Set a window hook */
2066 @REQ(set_hook)
2067     int            id;             /* id of the hook */
2068     thread_id_t    tid;            /* id of thread to set the hook into */
2069     void*          proc;           /* hook procedure */
2070     int            unicode;        /* is it a unicode hook? */
2071     VARARG(module,unicode_str);    /* module name */
2072 @REPLY
2073     user_handle_t  handle;         /* handle to the hook */
2074 @END
2075
2076
2077 /* Remove a window hook */
2078 @REQ(remove_hook)
2079     user_handle_t  handle;         /* handle to the hook */
2080     int            id;             /* id of the hook if handle is 0 */
2081     void*          proc;           /* hook procedure if handle is 0 */
2082 @END
2083
2084
2085 /* Start calling a hook chain */
2086 @REQ(start_hook_chain)
2087     int            id;             /* id of the hook */
2088 @REPLY
2089     user_handle_t  handle;         /* handle to the next hook */
2090     void*          proc;           /* hook procedure */
2091     int            unicode;        /* is it a unicode hook? */
2092     VARARG(module,unicode_str);    /* module name */
2093 @END
2094
2095
2096 /* Finished calling a hook chain */
2097 @REQ(finish_hook_chain)
2098     int            id;             /* id of the hook */
2099 @END
2100
2101
2102 /* Get the next hook to call */
2103 @REQ(get_next_hook)
2104     user_handle_t  handle;         /* handle to the current hook */
2105 @REPLY
2106     user_handle_t  next;           /* handle to the next hook */
2107     int            id;             /* id of the next hook */
2108     void*          proc;           /* next hook procedure */
2109     int            prev_unicode;   /* was the previous a unicode hook? */
2110     int            next_unicode;   /* is the next a unicode hook? */
2111     VARARG(module,unicode_str);    /* module name */
2112 @END