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