Check POLLHUP semantics at remote shutdown when wineserver is started.
[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
1013 /* move a rect (of data) in screen buffer content */
1014 @REQ(move_console_output)
1015     obj_handle_t handle;        /* handle to the console output */
1016     short int    x_src;         /* position (x, y) of rect to start moving from */
1017     short int    y_src;
1018     short int    x_dst;         /* position (x, y) of rect to move to */
1019     short int    y_dst;
1020     short int    w;             /* size of the rect (width, height) to move */
1021     short int    h;
1022 @END
1023
1024
1025 /* Sends a signal to a process group */
1026 @REQ(send_console_signal)
1027     int          signal;        /* the signal to send */
1028     void*        group_id;      /* the group to send the signal to */
1029 @END
1030
1031
1032 /* Create a change notification */
1033 @REQ(create_change_notification)
1034     int          subtree;       /* watch all the subtree */
1035     int          filter;        /* notification filter */
1036 @REPLY
1037     obj_handle_t handle;        /* handle to the change notification */
1038 @END
1039
1040
1041 /* Create a file mapping */
1042 @REQ(create_mapping)
1043     int          size_high;     /* mapping size */
1044     int          size_low;      /* mapping size */
1045     int          protect;       /* protection flags (see below) */
1046     int          inherit;       /* inherit flag */
1047     obj_handle_t file_handle;   /* file handle */
1048     VARARG(name,unicode_str);   /* object name */
1049 @REPLY
1050     obj_handle_t handle;        /* handle to the mapping */
1051 @END
1052 /* protection flags */
1053 #define VPROT_READ       0x01
1054 #define VPROT_WRITE      0x02
1055 #define VPROT_EXEC       0x04
1056 #define VPROT_WRITECOPY  0x08
1057 #define VPROT_GUARD      0x10
1058 #define VPROT_NOCACHE    0x20
1059 #define VPROT_COMMITTED  0x40
1060 #define VPROT_IMAGE      0x80
1061
1062
1063 /* Open a mapping */
1064 @REQ(open_mapping)
1065     unsigned int access;        /* wanted access rights */
1066     int          inherit;       /* inherit flag */
1067     VARARG(name,unicode_str);   /* object name */
1068 @REPLY
1069     obj_handle_t handle;        /* handle to the mapping */
1070 @END
1071
1072
1073 /* Get information about a file mapping */
1074 @REQ(get_mapping_info)
1075     obj_handle_t handle;        /* handle to the mapping */
1076 @REPLY
1077     int          size_high;     /* mapping size */
1078     int          size_low;      /* mapping size */
1079     int          protect;       /* protection flags */
1080     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1081     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1082     obj_handle_t shared_file;   /* shared mapping file handle */
1083     int          shared_size;   /* shared mapping size */
1084     int          drive_type;    /* type of drive the file is on */
1085 @END
1086
1087
1088 /* Create a device */
1089 @REQ(create_device)
1090     unsigned int access;        /* wanted access rights */
1091     int          inherit;       /* inherit flag */
1092     int          id;            /* client private id */
1093 @REPLY
1094     obj_handle_t handle;        /* handle to the device */
1095 @END
1096
1097
1098 /* Create a snapshot */
1099 @REQ(create_snapshot)
1100     int          inherit;       /* inherit flag */
1101     int          flags;         /* snapshot flags (TH32CS_*) */
1102     void*        pid;           /* process id */
1103 @REPLY
1104     obj_handle_t handle;        /* handle to the snapshot */
1105 @END
1106
1107
1108 /* Get the next process from a snapshot */
1109 @REQ(next_process)
1110     obj_handle_t handle;        /* handle to the snapshot */
1111     int          reset;         /* reset snapshot position? */
1112 @REPLY
1113     int          count;         /* process usage count */
1114     void*        pid;           /* process id */
1115     void*        ppid;          /* parent process id */
1116     void*        heap;          /* heap base */
1117     void*        module;        /* main module */
1118     int          threads;       /* number of threads */
1119     int          priority;      /* process priority */
1120     VARARG(filename,string);    /* file name of main exe */
1121 @END
1122
1123
1124 /* Get the next thread from a snapshot */
1125 @REQ(next_thread)
1126     obj_handle_t handle;        /* handle to the snapshot */
1127     int          reset;         /* reset snapshot position? */
1128 @REPLY
1129     int          count;         /* thread usage count */
1130     void*        pid;           /* process id */
1131     void*        tid;           /* thread id */
1132     int          base_pri;      /* base priority */
1133     int          delta_pri;     /* delta priority */
1134 @END
1135
1136
1137 /* Get the next module from a snapshot */
1138 @REQ(next_module)
1139     obj_handle_t handle;        /* handle to the snapshot */
1140     int          reset;         /* reset snapshot position? */
1141 @REPLY
1142     void*        pid;           /* process id */
1143     void*        base;          /* module base address */
1144     size_t       size;          /* module size */
1145     VARARG(filename,string);    /* file name of module */
1146 @END
1147
1148
1149 /* Wait for a debug event */
1150 @REQ(wait_debug_event)
1151     int           get_handle;  /* should we alloc a handle for waiting? */
1152 @REPLY
1153     void*         pid;         /* process id */
1154     void*         tid;         /* thread id */
1155     obj_handle_t  wait;        /* wait handle if no event ready */
1156     VARARG(event,debug_event); /* debug event data */
1157 @END
1158
1159
1160 /* Queue an exception event */
1161 @REQ(queue_exception_event)
1162     int              first;    /* first chance exception? */
1163     VARARG(record,exc_event);  /* thread context followed by exception record */
1164 @REPLY
1165     obj_handle_t     handle;   /* handle to the queued event */
1166 @END
1167
1168
1169 /* Retrieve the status of an exception event */
1170 @REQ(get_exception_status)
1171     obj_handle_t     handle;   /* handle to the queued event */
1172 @REPLY
1173     int              status;   /* event continuation status */
1174     VARARG(context,context);   /* modified thread context */
1175 @END
1176
1177
1178 /* Send an output string to the debugger */
1179 @REQ(output_debug_string)
1180     void*         string;      /* string to display (in debugged process address space) */
1181     int           unicode;     /* is it Unicode? */
1182     int           length;      /* string length */
1183 @END
1184
1185
1186 /* Continue a debug event */
1187 @REQ(continue_debug_event)
1188     void*        pid;          /* process id to continue */
1189     void*        tid;          /* thread id to continue */
1190     int          status;       /* continuation status */
1191 @END
1192
1193
1194 /* Start/stop debugging an existing process */
1195 @REQ(debug_process)
1196     void*        pid;          /* id of the process to debug */
1197     int          attach;       /* 1=attaching / 0=detaching from the process */
1198 @END
1199
1200
1201 /* Simulate a breakpoint in a process */
1202 @REQ(debug_break)
1203     obj_handle_t handle;       /* process handle */
1204 @REPLY
1205     int          self;         /* was it the caller itself? */
1206 @END
1207
1208
1209 /* Set debugger kill on exit flag */
1210 @REQ(set_debugger_kill_on_exit)
1211     int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1212 @END
1213
1214
1215 /* Read data from a process address space */
1216 @REQ(read_process_memory)
1217     obj_handle_t handle;       /* process handle */
1218     void*        addr;         /* addr to read from */
1219 @REPLY
1220     VARARG(data,bytes);        /* result data */
1221 @END
1222
1223
1224 /* Write data to a process address space */
1225 @REQ(write_process_memory)
1226     obj_handle_t handle;       /* process handle */
1227     void*        addr;         /* addr to write to (must be int-aligned) */
1228     unsigned int first_mask;   /* mask for first word */
1229     unsigned int last_mask;    /* mask for last word */
1230     VARARG(data,bytes);        /* data to write */
1231 @END
1232
1233
1234 /* Create a registry key */
1235 @REQ(create_key)
1236     obj_handle_t parent;       /* handle to the parent key */
1237     unsigned int access;       /* desired access rights */
1238     unsigned int options;      /* creation options */
1239     time_t       modif;        /* last modification time */
1240     size_t       namelen;      /* length of key name in bytes */
1241     VARARG(name,unicode_str,namelen);  /* key name */
1242     VARARG(class,unicode_str);         /* class name */
1243 @REPLY
1244     obj_handle_t hkey;         /* handle to the created key */
1245     int          created;      /* has it been newly created? */
1246 @END
1247
1248 /* Open a registry key */
1249 @REQ(open_key)
1250     obj_handle_t parent;       /* handle to the parent key */
1251     unsigned int access;       /* desired access rights */
1252     VARARG(name,unicode_str);  /* key name */
1253 @REPLY
1254     obj_handle_t hkey;         /* handle to the open key */
1255 @END
1256
1257
1258 /* Delete a registry key */
1259 @REQ(delete_key)
1260     obj_handle_t hkey;         /* handle to the key */
1261 @END
1262
1263
1264 /* Enumerate registry subkeys */
1265 @REQ(enum_key)
1266     obj_handle_t hkey;         /* handle to registry key */
1267     int          index;        /* index of subkey (or -1 for current key) */
1268     int          info_class;   /* requested information class */
1269 @REPLY
1270     int          subkeys;      /* number of subkeys */
1271     int          max_subkey;   /* longest subkey name */
1272     int          max_class;    /* longest class name */
1273     int          values;       /* number of values */
1274     int          max_value;    /* longest value name */
1275     int          max_data;     /* longest value data */
1276     time_t       modif;        /* last modification time */
1277     size_t       total;        /* total length needed for full name and class */
1278     size_t       namelen;      /* length of key name in bytes */
1279     VARARG(name,unicode_str,namelen);  /* key name */
1280     VARARG(class,unicode_str);         /* class name */
1281 @END
1282
1283
1284 /* Set a value of a registry key */
1285 @REQ(set_key_value)
1286     obj_handle_t hkey;         /* handle to registry key */
1287     int          type;         /* value type */
1288     size_t       namelen;      /* length of value name in bytes */
1289     VARARG(name,unicode_str,namelen);  /* value name */
1290     VARARG(data,bytes);                /* value data */
1291 @END
1292
1293
1294 /* Retrieve the value of a registry key */
1295 @REQ(get_key_value)
1296     obj_handle_t hkey;         /* handle to registry key */
1297     VARARG(name,unicode_str);  /* value name */
1298 @REPLY
1299     int          type;         /* value type */
1300     size_t       total;        /* total length needed for data */
1301     VARARG(data,bytes);        /* value data */
1302 @END
1303
1304
1305 /* Enumerate a value of a registry key */
1306 @REQ(enum_key_value)
1307     obj_handle_t hkey;         /* handle to registry key */
1308     int          index;        /* value index */
1309     int          info_class;   /* requested information class */
1310 @REPLY
1311     int          type;         /* value type */
1312     size_t       total;        /* total length needed for full name and data */
1313     size_t       namelen;      /* length of value name in bytes */
1314     VARARG(name,unicode_str,namelen);  /* value name */
1315     VARARG(data,bytes);                /* value data */
1316 @END
1317
1318
1319 /* Delete a value of a registry key */
1320 @REQ(delete_key_value)
1321     obj_handle_t hkey;         /* handle to registry key */
1322     VARARG(name,unicode_str);  /* value name */
1323 @END
1324
1325
1326 /* Load a registry branch from a file */
1327 @REQ(load_registry)
1328     obj_handle_t hkey;         /* root key to load to */
1329     obj_handle_t file;         /* file to load from */
1330     VARARG(name,unicode_str);  /* subkey name */
1331 @END
1332
1333
1334 /* Save a registry branch to a file */
1335 @REQ(save_registry)
1336     obj_handle_t hkey;         /* key to save */
1337     obj_handle_t file;         /* file to save to */
1338 @END
1339
1340
1341 /* Save a registry branch at server exit */
1342 @REQ(save_registry_atexit)
1343     obj_handle_t hkey;         /* key to save */
1344     VARARG(file,string);       /* file to save to */
1345 @END
1346
1347
1348 /* Set the current and saving level for the registry */
1349 @REQ(set_registry_levels)
1350     int          current;      /* new current level */
1351     int          saving;       /* new saving level */
1352     int          period;       /* duration between periodic saves (milliseconds) */
1353 @END
1354
1355
1356 /* Create a waitable timer */
1357 @REQ(create_timer)
1358     int          inherit;       /* inherit flag */
1359     int          manual;        /* manual reset */
1360     VARARG(name,unicode_str);   /* object name */
1361 @REPLY
1362     obj_handle_t handle;        /* handle to the timer */
1363 @END
1364
1365
1366 /* Open a waitable timer */
1367 @REQ(open_timer)
1368     unsigned int access;        /* wanted access rights */
1369     int          inherit;       /* inherit flag */
1370     VARARG(name,unicode_str);   /* object name */
1371 @REPLY
1372     obj_handle_t handle;        /* handle to the timer */
1373 @END
1374
1375 /* Set a waitable timer */
1376 @REQ(set_timer)
1377     obj_handle_t handle;        /* handle to the timer */
1378     int          sec;           /* next expiration absolute time */
1379     int          usec;          /* next expiration absolute time */
1380     int          period;        /* timer period in ms */
1381     void*        callback;      /* callback function */
1382     void*        arg;           /* callback argument */
1383 @END
1384
1385 /* Cancel a waitable timer */
1386 @REQ(cancel_timer)
1387     obj_handle_t handle;        /* handle to the timer */
1388 @END
1389
1390
1391 /* Retrieve the current context of a thread */
1392 @REQ(get_thread_context)
1393     obj_handle_t handle;       /* thread handle */
1394     unsigned int flags;        /* context flags */
1395 @REPLY
1396     VARARG(context,context);   /* thread context */
1397 @END
1398
1399
1400 /* Set the current context of a thread */
1401 @REQ(set_thread_context)
1402     obj_handle_t handle;       /* thread handle */
1403     unsigned int flags;        /* context flags */
1404     VARARG(context,context);   /* thread context */
1405 @END
1406
1407
1408 /* Fetch a selector entry for a thread */
1409 @REQ(get_selector_entry)
1410     obj_handle_t  handle;      /* thread handle */
1411     int           entry;       /* LDT entry */
1412 @REPLY
1413     unsigned int  base;        /* selector base */
1414     unsigned int  limit;       /* selector limit */
1415     unsigned char flags;       /* selector flags */
1416 @END
1417
1418
1419 /* Add an atom */
1420 @REQ(add_atom)
1421     int           local;       /* is atom in local process table? */
1422     VARARG(name,unicode_str);  /* atom name */
1423 @REPLY
1424     atom_t        atom;        /* resulting atom */
1425 @END
1426
1427
1428 /* Delete an atom */
1429 @REQ(delete_atom)
1430     atom_t        atom;        /* atom handle */
1431     int           local;       /* is atom in local process table? */
1432 @END
1433
1434
1435 /* Find an atom */
1436 @REQ(find_atom)
1437     int          local;        /* is atom in local process table? */
1438     VARARG(name,unicode_str);  /* atom name */
1439 @REPLY
1440     atom_t       atom;         /* atom handle */
1441 @END
1442
1443
1444 /* Get an atom name */
1445 @REQ(get_atom_name)
1446     atom_t       atom;         /* atom handle */
1447     int          local;        /* is atom in local process table? */
1448 @REPLY
1449     int          count;        /* atom lock count */
1450     VARARG(name,unicode_str);  /* atom name */
1451 @END
1452
1453
1454 /* Init the process atom table */
1455 @REQ(init_atom_table)
1456     int          entries;      /* number of entries */
1457 @END
1458
1459
1460 /* Get the message queue of the current thread */
1461 @REQ(get_msg_queue)
1462 @REPLY
1463     obj_handle_t handle;       /* handle to the queue */
1464 @END
1465
1466
1467 /* Set the current message queue wakeup mask */
1468 @REQ(set_queue_mask)
1469     unsigned int wake_mask;    /* wakeup bits mask */
1470     unsigned int changed_mask; /* changed bits mask */
1471     int          skip_wait;    /* will we skip waiting if signaled? */
1472 @REPLY
1473     unsigned int wake_bits;    /* current wake bits */
1474     unsigned int changed_bits; /* current changed bits */
1475 @END
1476
1477
1478 /* Get the current message queue status */
1479 @REQ(get_queue_status)
1480     int          clear;        /* should we clear the change bits? */
1481 @REPLY
1482     unsigned int wake_bits;    /* wake bits */
1483     unsigned int changed_bits; /* changed bits since last time */
1484 @END
1485
1486
1487 /* Wait for a process to start waiting on input */
1488 @REQ(wait_input_idle)
1489     obj_handle_t handle;       /* process handle */
1490     int          timeout;      /* timeout */
1491 @REPLY
1492     obj_handle_t event;        /* handle to idle event */
1493 @END
1494
1495
1496 /* Send a message to a thread queue */
1497 @REQ(send_message)
1498     void*           id;        /* thread id */
1499     int             type;      /* message type (see below) */
1500     user_handle_t   win;       /* window handle */
1501     unsigned int    msg;       /* message code */
1502     unsigned int    wparam;    /* parameters */
1503     unsigned int    lparam;    /* parameters */
1504     int             x;         /* x position */
1505     int             y;         /* y position */
1506     unsigned int    time;      /* message time */
1507     unsigned int    info;      /* extra info */
1508     int             timeout;   /* timeout for reply */
1509     VARARG(data,bytes);        /* message data for sent messages */
1510 @END
1511
1512 enum message_type
1513 {
1514     MSG_ASCII,          /* Ascii message (from SendMessageA) */
1515     MSG_UNICODE,        /* Unicode message (from SendMessageW) */
1516     MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
1517     MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
1518     MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
1519     MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
1520     MSG_HARDWARE_RAW,   /* raw hardware message */
1521     MSG_HARDWARE_COOKED /* cooked hardware message */
1522 };
1523
1524
1525 /* Get a message from the current queue */
1526 @REQ(get_message)
1527     int             flags;     /* see below */
1528     user_handle_t   get_win;   /* window handle to get */
1529     unsigned int    get_first; /* first message code to get */
1530     unsigned int    get_last;  /* last message code to get */
1531 @REPLY
1532     int             type;      /* message type */
1533     user_handle_t   win;       /* window handle */
1534     unsigned int    msg;       /* message code */
1535     unsigned int    wparam;    /* parameters */
1536     unsigned int    lparam;    /* parameters */
1537     int             x;         /* x position */
1538     int             y;         /* y position */
1539     unsigned int    time;      /* message time */
1540     unsigned int    info;      /* extra info */
1541     size_t          total;     /* total size of extra data */
1542     VARARG(data,bytes);        /* message data for sent messages */
1543 @END
1544 #define GET_MSG_REMOVE      1  /* remove the message */
1545 #define GET_MSG_SENT_ONLY   2  /* only get sent messages */
1546 #define GET_MSG_REMOVE_LAST 4  /* remove last message returned before checking for a new one */
1547
1548 /* Reply to a sent message */
1549 @REQ(reply_message)
1550     unsigned int    result;    /* message result */
1551     int             remove;    /* should we remove the message? */
1552     VARARG(data,bytes);        /* message data for sent messages */
1553 @END
1554
1555
1556 /* Retrieve the reply for the last message sent */
1557 @REQ(get_message_reply)
1558     int             cancel;    /* cancel message if not ready? */
1559 @REPLY
1560     unsigned int    result;    /* message result */
1561     VARARG(data,bytes);        /* message data for sent messages */
1562 @END
1563
1564
1565 /* Set a window timer */
1566 @REQ(set_win_timer)
1567     user_handle_t   win;       /* window handle */
1568     unsigned int    msg;       /* message to post */
1569     unsigned int    id;        /* timer id */
1570     unsigned int    rate;      /* timer rate in ms */
1571     unsigned int    lparam;    /* message lparam (callback proc) */
1572 @END
1573
1574
1575 /* Kill a window timer */
1576 @REQ(kill_win_timer)
1577     user_handle_t   win;       /* window handle */
1578     unsigned int    msg;       /* message to post */
1579     unsigned int    id;        /* timer id */
1580 @END
1581
1582
1583 /* Open a serial port */
1584 @REQ(create_serial)
1585     unsigned int access;       /* wanted access rights */
1586     int          inherit;      /* inherit flag */
1587     unsigned int attributes;   /* eg. FILE_FLAG_OVERLAPPED */
1588     unsigned int sharing;      /* sharing flags */
1589     VARARG(name,string);       /* file name */
1590 @REPLY
1591     obj_handle_t handle;       /* handle to the port */
1592 @END
1593
1594
1595 /* Retrieve info about a serial port */
1596 @REQ(get_serial_info)
1597     obj_handle_t handle;       /* handle to comm port */
1598 @REPLY
1599     unsigned int readinterval;
1600     unsigned int readconst;
1601     unsigned int readmult;
1602     unsigned int writeconst;
1603     unsigned int writemult;
1604     unsigned int eventmask;
1605     unsigned int commerror;
1606 @END
1607
1608
1609 /* Set info about a serial port */
1610 @REQ(set_serial_info)
1611     obj_handle_t handle;       /* handle to comm port */
1612     int          flags;        /* bitmask to set values (see below) */
1613     unsigned int readinterval;
1614     unsigned int readconst;
1615     unsigned int readmult;
1616     unsigned int writeconst;
1617     unsigned int writemult;
1618     unsigned int eventmask;
1619     unsigned int commerror;
1620 @END
1621 #define SERIALINFO_SET_TIMEOUTS  0x01
1622 #define SERIALINFO_SET_MASK      0x02
1623 #define SERIALINFO_SET_ERROR     0x04
1624
1625
1626 /* Create / reschedule an async I/O */
1627 @REQ(register_async)
1628     obj_handle_t handle;  /* handle to comm port, socket or file */
1629     int          type;
1630     void*        overlapped;
1631     int          count;
1632     unsigned int status;
1633 @END
1634 #define ASYNC_TYPE_NONE  0x00
1635 #define ASYNC_TYPE_READ  0x01
1636 #define ASYNC_TYPE_WRITE 0x02
1637 #define ASYNC_TYPE_WAIT  0x03
1638
1639
1640 /* Create a named pipe */
1641 @REQ(create_named_pipe)
1642     unsigned int   openmode;
1643     unsigned int   pipemode;
1644     unsigned int   maxinstances;
1645     unsigned int   outsize;
1646     unsigned int   insize;
1647     unsigned int   timeout;
1648     VARARG(name,unicode_str);    /* pipe name */
1649 @REPLY
1650     obj_handle_t   handle;       /* handle to the pipe */
1651 @END
1652
1653
1654 /* Open an existing named pipe */
1655 @REQ(open_named_pipe)
1656     unsigned int   access;
1657     VARARG(name,unicode_str);    /* pipe name */
1658 @REPLY
1659     obj_handle_t   handle;       /* handle to the pipe */
1660 @END
1661
1662
1663 /* Connect to a named pipe */
1664 @REQ(connect_named_pipe)
1665     obj_handle_t   handle;
1666     void*          overlapped;
1667     void*          func;
1668 @END
1669
1670
1671 /* Wait for a named pipe */
1672 @REQ(wait_named_pipe)
1673     unsigned int   timeout;
1674     void*          overlapped;
1675     void*          func;
1676     VARARG(name,unicode_str);    /* pipe name */
1677 @END
1678
1679
1680 /* Disconnect a named pipe */
1681 @REQ(disconnect_named_pipe)
1682     obj_handle_t   handle;
1683 @END
1684
1685
1686 @REQ(get_named_pipe_info)
1687     obj_handle_t   handle;
1688 @REPLY
1689     unsigned int   flags;
1690     unsigned int   maxinstances;
1691     unsigned int   outsize;
1692     unsigned int   insize;
1693 @END
1694
1695
1696 @REQ(create_smb)
1697     int            fd;
1698     unsigned int   tree_id;
1699     unsigned int   user_id;
1700     unsigned int   file_id;
1701     unsigned int   dialect;
1702 @REPLY
1703     obj_handle_t   handle;
1704 @END
1705
1706
1707 @REQ(get_smb_info)
1708     obj_handle_t   handle;
1709     unsigned int   flags;
1710     unsigned int   offset;
1711 @REPLY
1712     unsigned int   tree_id;
1713     unsigned int   user_id;
1714     unsigned int   dialect;
1715     unsigned int   file_id;
1716     unsigned int   offset;
1717 @END
1718 #define SMBINFO_SET_OFFSET    0x01
1719
1720
1721 /* Create a window */
1722 @REQ(create_window)
1723     user_handle_t  parent;      /* parent window */
1724     user_handle_t  owner;       /* owner window */
1725     atom_t         atom;        /* class atom */
1726 @REPLY
1727     user_handle_t  handle;      /* created window */
1728 @END
1729
1730
1731 /* Link a window into the tree */
1732 @REQ(link_window)
1733     user_handle_t  handle;      /* handle to the window */
1734     user_handle_t  parent;      /* handle to the parent */
1735     user_handle_t  previous;    /* previous child in Z-order */
1736 @REPLY
1737     user_handle_t  full_parent; /* full handle of new parent */
1738 @END
1739
1740
1741 /* Destroy a window */
1742 @REQ(destroy_window)
1743     user_handle_t  handle;      /* handle to the window */
1744 @END
1745
1746
1747 /* Set a window owner */
1748 @REQ(set_window_owner)
1749     user_handle_t  handle;      /* handle to the window */
1750     user_handle_t  owner;       /* new owner */
1751 @REPLY
1752     user_handle_t  full_owner;  /* full handle of new owner */
1753 @END
1754
1755
1756 /* Get information from a window handle */
1757 @REQ(get_window_info)
1758     user_handle_t  handle;      /* handle to the window */
1759 @REPLY
1760     user_handle_t  full_handle; /* full 32-bit handle */
1761     void*          pid;         /* process owning the window */
1762     void*          tid;         /* thread owning the window */
1763     atom_t         atom;        /* class atom */
1764 @END
1765
1766
1767 /* Set some information in a window */
1768 @REQ(set_window_info)
1769     user_handle_t  handle;        /* handle to the window */
1770     unsigned int   flags;         /* flags for fields to set (see below) */
1771     unsigned int   style;         /* window style */
1772     unsigned int   ex_style;      /* window extended style */
1773     unsigned int   id;            /* window id */
1774     void*          instance;      /* creator instance */
1775     void*          user_data;     /* user-specific data */
1776 @REPLY
1777     unsigned int   old_style;     /* old window style */
1778     unsigned int   old_ex_style;  /* old window extended style */
1779     unsigned int   old_id;        /* old window id */
1780     void*          old_instance;  /* old creator instance */
1781     void*          old_user_data; /* old user-specific data */
1782 @END
1783 #define SET_WIN_STYLE     0x01
1784 #define SET_WIN_EXSTYLE   0x02
1785 #define SET_WIN_ID        0x04
1786 #define SET_WIN_INSTANCE  0x08
1787 #define SET_WIN_USERDATA  0x10
1788
1789
1790 /* Get a list of the window parents, up to the root of the tree */
1791 @REQ(get_window_parents)
1792     user_handle_t  handle;        /* handle to the window */
1793 @REPLY
1794     int            count;         /* total count of parents */
1795     VARARG(parents,user_handles); /* parent handles */
1796 @END
1797
1798
1799 /* Get a list of the window children */
1800 @REQ(get_window_children)
1801     user_handle_t  parent;        /* parent window */
1802     atom_t         atom;          /* class atom for the listed children */
1803     void*          tid;           /* thread owning the listed children */
1804 @REPLY
1805     int            count;         /* total count of children */
1806     VARARG(children,user_handles); /* children handles */
1807 @END
1808
1809
1810 /* Get window tree information from a window handle */
1811 @REQ(get_window_tree)
1812     user_handle_t  handle;        /* handle to the window */
1813 @REPLY
1814     user_handle_t  parent;        /* parent window */
1815     user_handle_t  owner;         /* owner window */
1816     user_handle_t  next_sibling;  /* next sibling in Z-order */
1817     user_handle_t  prev_sibling;  /* prev sibling in Z-order */
1818     user_handle_t  first_sibling; /* first sibling in Z-order */
1819     user_handle_t  last_sibling;  /* last sibling in Z-order */
1820     user_handle_t  first_child;   /* first child */
1821     user_handle_t  last_child;    /* last child */
1822 @END
1823
1824 /* Set the window and client rectangles of a window */
1825 @REQ(set_window_rectangles)
1826     user_handle_t  handle;        /* handle to the window */
1827     rectangle_t    window;        /* window rectangle */
1828     rectangle_t    client;        /* client rectangle */
1829 @END
1830
1831
1832 /* Get the window and client rectangles of a window */
1833 @REQ(get_window_rectangles)
1834     user_handle_t  handle;        /* handle to the window */
1835 @REPLY
1836     rectangle_t    window;        /* window rectangle */
1837     rectangle_t    client;        /* client rectangle */
1838 @END
1839
1840
1841 /* Get the window text */
1842 @REQ(get_window_text)
1843     user_handle_t  handle;        /* handle to the window */
1844 @REPLY
1845     VARARG(text,unicode_str);     /* window text */
1846 @END
1847
1848
1849 /* Set the window text */
1850 @REQ(set_window_text)
1851     user_handle_t  handle;        /* handle to the window */
1852     VARARG(text,unicode_str);     /* window text */
1853 @END
1854
1855
1856 /* Increment the window paint count */
1857 @REQ(inc_window_paint_count)
1858     user_handle_t  handle;        /* handle to the window */
1859     int             incr;         /* increment (can be negative) */
1860 @END
1861
1862
1863 /* Get the coordinates offset between two windows */
1864 @REQ(get_windows_offset)
1865     user_handle_t  from;          /* handle to the first window */
1866     user_handle_t  to;            /* handle to the second window */
1867 @REPLY
1868     int            x;             /* x coordinate offset */
1869     int            y;             /* y coordinate offset */
1870 @END
1871
1872
1873 /* Set a window property */
1874 @REQ(set_window_property)
1875     user_handle_t  window;        /* handle to the window */
1876     atom_t         atom;          /* property atom (high-word set if it was a string) */
1877     int            string;        /* was atom a string originally? */
1878     obj_handle_t   handle;        /* handle to store */
1879 @END
1880
1881
1882 /* Remove a window property */
1883 @REQ(remove_window_property)
1884     user_handle_t  window;        /* handle to the window */
1885     atom_t         atom;          /* property atom */
1886 @REPLY
1887     obj_handle_t   handle;        /* handle stored in property */
1888 @END
1889
1890
1891 /* Get a window property */
1892 @REQ(get_window_property)
1893     user_handle_t  window;        /* handle to the window */
1894     atom_t         atom;          /* property atom */
1895 @REPLY
1896     obj_handle_t   handle;        /* handle stored in property */
1897 @END
1898
1899
1900 /* Get the list of properties of a window */
1901 @REQ(get_window_properties)
1902     user_handle_t  window;        /* handle to the window */
1903 @REPLY
1904     int            total;         /* total number of properties */
1905     VARARG(props,properties);     /* list of properties */
1906 @END