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