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