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