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