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