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