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