server: Make apc_param_t always 64-bit.
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 typedef unsigned int obj_handle_t;
35 typedef unsigned int user_handle_t;
36 typedef unsigned short atom_t;
37 typedef unsigned int process_id_t;
38 typedef unsigned int thread_id_t;
39 typedef unsigned int data_size_t;
40 typedef unsigned int ioctl_code_t;
41 typedef unsigned long lparam_t;
42 typedef unsigned __int64 apc_param_t;
43 typedef unsigned __int64 mem_size_t;
44 typedef unsigned __int64 file_pos_t;
45
46 struct request_header
47 {
48     int          req;          /* request code */
49     data_size_t  request_size; /* request variable part size */
50     data_size_t  reply_size;   /* reply variable part maximum size */
51 };
52
53 struct reply_header
54 {
55     unsigned int error;        /* error result */
56     data_size_t  reply_size;   /* reply variable part size */
57 };
58
59 /* placeholder structure for the maximum allowed request size */
60 /* this is used to construct the generic_request union */
61 struct request_max_size
62 {
63     int pad[16]; /* the max request size is 16 ints */
64 };
65
66 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
67 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
68
69
70 /* definitions of the event data depending on the event code */
71 struct debug_event_exception
72 {
73     EXCEPTION_RECORD record;   /* exception record */
74     int              first;    /* first chance exception? */
75 };
76 struct debug_event_create_thread
77 {
78     obj_handle_t handle;     /* handle to the new thread */
79     void        *teb;        /* thread teb (in debugged process address space) */
80     void        *start;      /* thread startup routine */
81 };
82 struct debug_event_create_process
83 {
84     obj_handle_t file;       /* handle to the process exe file */
85     obj_handle_t process;    /* handle to the new process */
86     obj_handle_t thread;     /* handle to the new thread */
87     void        *base;       /* base of executable image */
88     int          dbg_offset; /* offset of debug info in file */
89     int          dbg_size;   /* size of debug info */
90     void        *teb;        /* thread teb (in debugged process address space) */
91     void        *start;      /* thread startup routine */
92     void        *name;       /* image name (optional) */
93     int          unicode;    /* is it Unicode? */
94 };
95 struct debug_event_exit
96 {
97     int          exit_code;  /* thread or process exit code */
98 };
99 struct debug_event_load_dll
100 {
101     obj_handle_t handle;     /* file handle for the dll */
102     void        *base;       /* base address of the dll */
103     int          dbg_offset; /* offset of debug info in file */
104     int          dbg_size;   /* size of debug info */
105     void        *name;       /* image name (optional) */
106     int          unicode;    /* is it Unicode? */
107 };
108 struct debug_event_unload_dll
109 {
110     void       *base;       /* base address of the dll */
111 };
112 struct debug_event_output_string
113 {
114     void       *string;     /* string to display (in debugged process address space) */
115     int         unicode;    /* is it Unicode? */
116     int         length;     /* string length */
117 };
118 struct debug_event_rip_info
119 {
120     int         error;      /* ??? */
121     int         type;       /* ??? */
122 };
123 union debug_event_data
124 {
125     struct debug_event_exception      exception;
126     struct debug_event_create_thread  create_thread;
127     struct debug_event_create_process create_process;
128     struct debug_event_exit           exit;
129     struct debug_event_load_dll       load_dll;
130     struct debug_event_unload_dll     unload_dll;
131     struct debug_event_output_string  output_string;
132     struct debug_event_rip_info       rip_info;
133 };
134
135 /* debug event data */
136 typedef struct
137 {
138     int                      code;   /* event code */
139     union debug_event_data   info;   /* event information */
140 } debug_event_t;
141
142 /* structure used in sending an fd from client to server */
143 struct send_fd
144 {
145     thread_id_t tid;  /* thread id */
146     int         fd;   /* file descriptor on client-side */
147 };
148
149 /* structure sent by the server on the wait fifo */
150 struct wake_up_reply
151 {
152     void *cookie;    /* magic cookie that was passed in select_request */
153     int   signaled;  /* wait result */
154 };
155
156 /* NT-style timeout, in 100ns units, negative means relative timeout */
157 typedef __int64 timeout_t;
158 #define TIMEOUT_INFINITE (((timeout_t)0x7fffffff) << 32 | 0xffffffff)
159
160 /* structure returned in the list of window properties */
161 typedef struct
162 {
163     atom_t         atom;     /* property atom */
164     short          string;   /* was atom a string originally? */
165     lparam_t       data;     /* data stored in property */
166 } property_data_t;
167
168 /* structure to specify window rectangles */
169 typedef struct
170 {
171     int  left;
172     int  top;
173     int  right;
174     int  bottom;
175 } rectangle_t;
176
177 /* structure for parameters of async I/O calls */
178 typedef struct
179 {
180     void           *callback;      /* client-side callback to call upon end of async */
181     void           *iosb;          /* I/O status block in client addr space */
182     void           *arg;           /* opaque user data to pass to callback */
183     void           *apc;           /* user apc to call */
184     obj_handle_t    event;         /* event to signal when done */
185     apc_param_t     cvalue;        /* completion value to use for completion events */
186 } async_data_t;
187
188 /* structures for extra message data */
189
190 struct callback_msg_data
191 {
192     void           *callback;   /* callback function */
193     lparam_t        data;       /* user data for callback */
194     lparam_t        result;     /* message result */
195 };
196
197 struct winevent_msg_data
198 {
199     user_handle_t   hook;       /* hook handle */
200     thread_id_t     tid;        /* thread id */
201     void           *hook_proc;  /* hook proc address */
202     /* followed by module name if any */
203 };
204
205 typedef union
206 {
207     unsigned char            bytes[1];   /* raw data for sent messages */
208     struct callback_msg_data callback;
209     struct winevent_msg_data winevent;
210 } message_data_t;
211
212 /* structure for console char/attribute info */
213 typedef struct
214 {
215     WCHAR          ch;
216     unsigned short attr;
217 } char_info_t;
218
219 typedef struct
220 {
221     unsigned int low_part;
222     int          high_part;
223 } luid_t;
224
225 #define MAX_ACL_LEN 65535
226
227 struct security_descriptor
228 {
229     unsigned int control;       /* SE_ flags */
230     data_size_t  owner_len;
231     data_size_t  group_len;
232     data_size_t  sacl_len;
233     data_size_t  dacl_len;
234     /* VARARG(owner,SID); */
235     /* VARARG(group,SID); */
236     /* VARARG(sacl,ACL); */
237     /* VARARG(dacl,ACL); */
238 };
239
240 struct object_attributes
241 {
242     obj_handle_t rootdir; /* root directory */
243     data_size_t sd_len;   /* length of security_descriptor data. may be 0 */
244     data_size_t name_len; /* length of the name string. may be 0 */
245     /* VARARG(sd,security_descriptor); */
246     /* VARARG(name,unicode_str); */
247 };
248
249 struct token_groups
250 {
251     unsigned int count;
252     /* unsigned int attributes[count]; */
253     /* VARARG(sids,SID); */
254 };
255
256 enum apc_type
257 {
258     APC_NONE,
259     APC_USER,
260     APC_TIMER,
261     APC_ASYNC_IO,
262     APC_VIRTUAL_ALLOC,
263     APC_VIRTUAL_FREE,
264     APC_VIRTUAL_QUERY,
265     APC_VIRTUAL_PROTECT,
266     APC_VIRTUAL_FLUSH,
267     APC_VIRTUAL_LOCK,
268     APC_VIRTUAL_UNLOCK,
269     APC_MAP_VIEW,
270     APC_UNMAP_VIEW,
271     APC_CREATE_THREAD
272 };
273
274 typedef union
275 {
276     enum apc_type type;
277     struct
278     {
279         enum apc_type    type;     /* APC_USER */
280         void (__stdcall *func)(unsigned long,unsigned long,unsigned long);
281         apc_param_t      args[3];  /* arguments for user function */
282     } user;
283     struct
284     {
285         enum apc_type   type;     /* APC_TIMER */
286         void (__stdcall *func)(void*, unsigned int, unsigned int);
287         timeout_t        time;     /* absolute time of expiration */
288         void            *arg;      /* user argument */
289     } timer;
290     struct
291     {
292         enum apc_type    type;     /* APC_ASYNC_IO */
293         unsigned int   (*func)(void*, void*, unsigned int, unsigned int *);
294         void            *user;     /* user pointer */
295         void            *sb;       /* status block */
296         unsigned int     status;   /* I/O status */
297     } async_io;
298     struct
299     {
300         enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
301         void            *addr;      /* requested address */
302         mem_size_t       size;      /* allocation size */
303         unsigned int     zero_bits; /* allocation alignment */
304         unsigned int     op_type;   /* type of operation */
305         unsigned int     prot;      /* memory protection flags */
306     } virtual_alloc;
307     struct
308     {
309         enum apc_type    type;      /* APC_VIRTUAL_FREE */
310         void            *addr;      /* requested address */
311         mem_size_t       size;      /* allocation size */
312         unsigned int     op_type;   /* type of operation */
313     } virtual_free;
314     struct
315     {
316         enum apc_type    type;      /* APC_VIRTUAL_QUERY */
317         const void      *addr;      /* requested address */
318     } virtual_query;
319     struct
320     {
321         enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
322         void            *addr;      /* requested address */
323         mem_size_t       size;      /* requested size */
324         unsigned int     prot;      /* new protection flags */
325     } virtual_protect;
326     struct
327     {
328         enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
329         const void      *addr;      /* requested address */
330         mem_size_t       size;      /* requested size */
331     } virtual_flush;
332     struct
333     {
334         enum apc_type    type;      /* APC_VIRTUAL_LOCK */
335         void            *addr;      /* requested address */
336         mem_size_t       size;      /* requested size */
337     } virtual_lock;
338     struct
339     {
340         enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
341         void            *addr;      /* requested address */
342         mem_size_t       size;      /* requested size */
343     } virtual_unlock;
344     struct
345     {
346         enum apc_type    type;      /* APC_MAP_VIEW */
347         obj_handle_t     handle;    /* mapping handle */
348         void            *addr;      /* requested address */
349         mem_size_t       size;      /* allocation size */
350         file_pos_t       offset;    /* file offset */
351         unsigned int     zero_bits; /* allocation alignment */
352         unsigned int     alloc_type;/* allocation type */
353         unsigned int     prot;      /* memory protection flags */
354     } map_view;
355     struct
356     {
357         enum apc_type    type;      /* APC_UNMAP_VIEW */
358         void            *addr;      /* view address */
359     } unmap_view;
360     struct
361     {
362         enum apc_type    type;      /* APC_CREATE_THREAD */
363         void (__stdcall *func)(void*);  /* start function */
364         void            *arg;       /* argument for start function */
365         mem_size_t       reserve;   /* reserve size for thread stack */
366         mem_size_t       commit;    /* commit size for thread stack */
367         int              suspend;   /* suspended thread? */
368     } create_thread;
369 } apc_call_t;
370
371 typedef union
372 {
373     enum apc_type type;
374     struct
375     {
376         enum apc_type    type;      /* APC_ASYNC_IO */
377         unsigned int     status;    /* new status of async operation */
378         unsigned int     total;     /* bytes transferred */
379     } async_io;
380     struct
381     {
382         enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
383         unsigned int     status;    /* status returned by call */
384         void            *addr;      /* resulting address */
385         mem_size_t       size;      /* resulting size */
386     } virtual_alloc;
387     struct
388     {
389         enum apc_type    type;      /* APC_VIRTUAL_FREE */
390         unsigned int     status;    /* status returned by call */
391         void            *addr;      /* resulting address */
392         mem_size_t       size;      /* resulting size */
393     } virtual_free;
394     struct
395     {
396         enum apc_type    type;      /* APC_VIRTUAL_QUERY */
397         unsigned int     status;    /* status returned by call */
398         void            *base;      /* resulting base address */
399         void            *alloc_base;/* resulting allocation base */
400         mem_size_t       size;      /* resulting region size */
401         unsigned int     state;     /* resulting region state */
402         unsigned int     prot;      /* resulting region protection */
403         unsigned int     alloc_prot;/* resulting allocation protection */
404         unsigned int     alloc_type;/* resulting region allocation type */
405     } virtual_query;
406     struct
407     {
408         enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
409         unsigned int     status;    /* status returned by call */
410         void            *addr;      /* resulting address */
411         mem_size_t       size;      /* resulting size */
412         unsigned int     prot;      /* old protection flags */
413     } virtual_protect;
414     struct
415     {
416         enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
417         unsigned int     status;    /* status returned by call */
418         const void      *addr;      /* resulting address */
419         mem_size_t       size;      /* resulting size */
420     } virtual_flush;
421     struct
422     {
423         enum apc_type    type;      /* APC_VIRTUAL_LOCK */
424         unsigned int     status;    /* status returned by call */
425         void            *addr;      /* resulting address */
426         mem_size_t       size;      /* resulting size */
427     } virtual_lock;
428     struct
429     {
430         enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
431         unsigned int     status;    /* status returned by call */
432         void            *addr;      /* resulting address */
433         mem_size_t       size;      /* resulting size */
434     } virtual_unlock;
435     struct
436     {
437         enum apc_type    type;      /* APC_MAP_VIEW */
438         unsigned int     status;    /* status returned by call */
439         void            *addr;      /* resulting address */
440         mem_size_t       size;      /* resulting size */
441     } map_view;
442     struct
443     {
444         enum apc_type    type;      /* APC_MAP_VIEW */
445         unsigned int     status;    /* status returned by call */
446     } unmap_view;
447     struct
448     {
449         enum apc_type    type;      /* APC_CREATE_THREAD */
450         unsigned int     status;    /* status returned by call */
451         thread_id_t      tid;       /* thread id */
452         obj_handle_t     handle;    /* handle to new thread */
453     } create_thread;
454 } apc_result_t;
455
456 /****************************************************************/
457 /* Request declarations */
458
459 /* Create a new process from the context of the parent */
460 @REQ(new_process)
461     int          inherit_all;    /* inherit all handles from parent */
462     unsigned int create_flags;   /* creation flags */
463     int          socket_fd;      /* file descriptor for process socket */
464     obj_handle_t exe_file;       /* file handle for main exe */
465     obj_handle_t hstdin;         /* handle for stdin */
466     obj_handle_t hstdout;        /* handle for stdout */
467     obj_handle_t hstderr;        /* handle for stderr */
468     unsigned int process_access; /* access rights for process object */
469     unsigned int process_attr;   /* attributes for process object */
470     unsigned int thread_access;  /* access rights for thread object */
471     unsigned int thread_attr;    /* attributes for thread object */
472     VARARG(info,startup_info);   /* startup information */
473     VARARG(env,unicode_str);     /* environment for new process */
474 @REPLY
475     obj_handle_t info;           /* new process info handle */
476     process_id_t pid;            /* process id */
477     obj_handle_t phandle;        /* process handle (in the current process) */
478     thread_id_t  tid;            /* thread id */
479     obj_handle_t thandle;        /* thread handle (in the current process) */
480 @END
481
482
483 /* Retrieve information about a newly started process */
484 @REQ(get_new_process_info)
485     obj_handle_t info;           /* info handle returned from new_process_request */
486 @REPLY
487     int          success;      /* did the process start successfully? */
488     int          exit_code;    /* process exit code if failed */
489 @END
490
491
492 /* Create a new thread from the context of the parent */
493 @REQ(new_thread)
494     unsigned int access;       /* wanted access rights */
495     unsigned int attributes;   /* object attributes */
496     int          suspend;      /* new thread should be suspended on creation */
497     int          request_fd;   /* fd for request pipe */
498 @REPLY
499     thread_id_t  tid;          /* thread id */
500     obj_handle_t handle;       /* thread handle (in the current process) */
501 @END
502
503
504 /* Retrieve the new process startup info */
505 @REQ(get_startup_info)
506 @REPLY
507     obj_handle_t exe_file;     /* file handle for main exe */
508     obj_handle_t hstdin;       /* handle for stdin */
509     obj_handle_t hstdout;      /* handle for stdout */
510     obj_handle_t hstderr;      /* handle for stderr */
511     VARARG(info,startup_info); /* startup information */
512     VARARG(env,unicode_str);   /* environment */
513 @END
514
515
516 /* Signal the end of the process initialization */
517 @REQ(init_process_done)
518     void*        module;       /* main module base address */
519     void*        entry;        /* process entry point */
520     int          gui;          /* is it a GUI process? */
521 @END
522
523
524 /* Initialize a thread; called from the child after fork()/clone() */
525 @REQ(init_thread)
526     int          unix_pid;     /* Unix pid of new thread */
527     int          unix_tid;     /* Unix tid of new thread */
528     int          debug_level;  /* new debug level */
529     void*        teb;          /* TEB of new thread (in thread address space) */
530     void*        peb;          /* address of PEB (in thread address space) */
531     void*        entry;        /* thread entry point (in thread address space) */
532     void*        ldt_copy;     /* address of LDT copy (in thread address space) */
533     int          reply_fd;     /* fd for reply pipe */
534     int          wait_fd;      /* fd for blocking calls pipe */
535 @REPLY
536     process_id_t pid;          /* process id of the new thread's process */
537     thread_id_t  tid;          /* thread id of the new thread */
538     data_size_t  info_size;    /* total size of startup info */
539     timeout_t    server_start; /* server start time */
540     int          version;      /* protocol version */
541 @END
542
543
544 /* Terminate a process */
545 @REQ(terminate_process)
546     obj_handle_t handle;       /* process handle to terminate */
547     int          exit_code;    /* process exit code */
548 @REPLY
549     int          self;         /* suicide? */
550 @END
551
552
553 /* Terminate a thread */
554 @REQ(terminate_thread)
555     obj_handle_t handle;       /* thread handle to terminate */
556     int          exit_code;    /* thread exit code */
557 @REPLY
558     int          self;         /* suicide? */
559     int          last;         /* last thread in this process? */
560 @END
561
562
563 /* Retrieve information about a process */
564 @REQ(get_process_info)
565     obj_handle_t handle;           /* process handle */
566 @REPLY
567     process_id_t pid;              /* server process id */
568     process_id_t ppid;             /* server process id of parent */
569     int          exit_code;        /* process exit code */
570     int          priority;         /* priority class */
571     unsigned int affinity;         /* process affinity mask */
572     void*        peb;              /* PEB address in process address space */
573     timeout_t    start_time;       /* process start time */
574     timeout_t    end_time;         /* process end time */
575 @END
576
577
578 /* Set a process informations */
579 @REQ(set_process_info)
580     obj_handle_t handle;       /* process handle */
581     int          mask;         /* setting mask (see below) */
582     int          priority;     /* priority class */
583     unsigned int affinity;     /* affinity mask */
584 @END
585 #define SET_PROCESS_INFO_PRIORITY 0x01
586 #define SET_PROCESS_INFO_AFFINITY 0x02
587
588
589 /* Retrieve information about a thread */
590 @REQ(get_thread_info)
591     obj_handle_t handle;        /* thread handle */
592     thread_id_t  tid_in;        /* thread id (optional) */
593 @REPLY
594     process_id_t pid;           /* server process id */
595     thread_id_t  tid;           /* server thread id */
596     void*        teb;           /* thread teb pointer */
597     int          exit_code;     /* thread exit code */
598     int          priority;      /* thread priority level */
599     unsigned int affinity;      /* thread affinity mask */
600     timeout_t    creation_time; /* thread creation time */
601     timeout_t    exit_time;     /* thread exit time */
602     int          last;          /* last thread in process */
603 @END
604
605
606 /* Set a thread informations */
607 @REQ(set_thread_info)
608     obj_handle_t handle;       /* thread handle */
609     int          mask;         /* setting mask (see below) */
610     int          priority;     /* priority class */
611     unsigned int affinity;     /* affinity mask */
612     obj_handle_t token;        /* impersonation token */
613 @END
614 #define SET_THREAD_INFO_PRIORITY 0x01
615 #define SET_THREAD_INFO_AFFINITY 0x02
616 #define SET_THREAD_INFO_TOKEN    0x04
617
618
619 /* Retrieve information about a module */
620 @REQ(get_dll_info)
621     obj_handle_t handle;       /* process handle */
622     void*        base_address; /* base address of module */
623 @REPLY
624     void*        entry_point;
625     data_size_t  size;            /* module size */
626     data_size_t  filename_len;    /* buffer len in bytes required to store filename */
627     VARARG(filename,unicode_str); /* file name of module */
628 @END
629
630
631 /* Suspend a thread */
632 @REQ(suspend_thread)
633     obj_handle_t handle;       /* thread handle */
634 @REPLY
635     int          count;        /* new suspend count */
636 @END
637
638
639 /* Resume a thread */
640 @REQ(resume_thread)
641     obj_handle_t handle;       /* thread handle */
642 @REPLY
643     int          count;        /* new suspend count */
644 @END
645
646
647 /* Notify the server that a dll has been loaded */
648 @REQ(load_dll)
649     obj_handle_t handle;       /* file handle */
650     void*        base;         /* base address */
651     void*        name;         /* ptr to ptr to name (in process addr space) */
652     data_size_t  size;         /* dll size */
653     int          dbg_offset;   /* debug info offset */
654     int          dbg_size;     /* debug info size */
655     VARARG(filename,unicode_str); /* file name of dll */
656 @END
657
658
659 /* Notify the server that a dll is being unloaded */
660 @REQ(unload_dll)
661     void*        base;         /* base address */
662 @END
663
664
665 /* Queue an APC for a thread or process */
666 @REQ(queue_apc)
667     obj_handle_t thread;       /* thread handle */
668     obj_handle_t process;      /* process handle */
669     apc_call_t   call;         /* call arguments */
670 @REPLY
671     obj_handle_t handle;       /* APC handle */
672     int          self;         /* run APC in caller itself? */
673 @END
674
675
676 /* Get the result of an APC call */
677 @REQ(get_apc_result)
678     obj_handle_t handle;       /* handle to the APC */
679 @REPLY
680     apc_result_t result;       /* result of the APC */
681 @END
682
683
684 /* Close a handle for the current process */
685 @REQ(close_handle)
686     obj_handle_t handle;       /* handle to close */
687 @END
688
689
690 /* Set a handle information */
691 @REQ(set_handle_info)
692     obj_handle_t handle;       /* handle we are interested in */
693     int          flags;        /* new handle flags */
694     int          mask;         /* mask for flags to set */
695 @REPLY
696     int          old_flags;    /* old flag value */
697 @END
698
699
700 /* Duplicate a handle */
701 @REQ(dup_handle)
702     obj_handle_t src_process;  /* src process handle */
703     obj_handle_t src_handle;   /* src handle to duplicate */
704     obj_handle_t dst_process;  /* dst process handle */
705     unsigned int access;       /* wanted access rights */
706     unsigned int attributes;   /* object attributes */
707     unsigned int options;      /* duplicate options (see below) */
708 @REPLY
709     obj_handle_t handle;       /* duplicated handle in dst process */
710     int          self;         /* is the source the current process? */
711     int          closed;       /* whether the source handle has been closed */
712 @END
713 #define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
714 #define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
715 #define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */
716
717
718 /* Open a handle to a process */
719 @REQ(open_process)
720     process_id_t pid;          /* process id to open */
721     unsigned int access;       /* wanted access rights */
722     unsigned int attributes;   /* object attributes */
723 @REPLY
724     obj_handle_t handle;       /* handle to the process */
725 @END
726
727
728 /* Open a handle to a thread */
729 @REQ(open_thread)
730     thread_id_t  tid;          /* thread id to open */
731     unsigned int access;       /* wanted access rights */
732     unsigned int attributes;   /* object attributes */
733 @REPLY
734     obj_handle_t handle;       /* handle to the thread */
735 @END
736
737
738 /* Wait for handles */
739 @REQ(select)
740     int          flags;        /* wait flags (see below) */
741     void*        cookie;       /* magic cookie to return to client */
742     obj_handle_t signal;       /* object to signal (0 if none) */
743     obj_handle_t prev_apc;     /* handle to previous APC */
744     timeout_t    timeout;      /* timeout */
745     VARARG(result,apc_result); /* result of previous APC */
746     VARARG(handles,handles);   /* handles to select on */
747 @REPLY
748     obj_handle_t apc_handle;   /* handle to next APC */
749     timeout_t    timeout;      /* timeout converted to absolute */
750     apc_call_t   call;         /* APC call arguments */
751 @END
752 #define SELECT_ALL           1
753 #define SELECT_ALERTABLE     2
754 #define SELECT_INTERRUPTIBLE 4
755
756
757 /* Create an event */
758 @REQ(create_event)
759     unsigned int access;        /* wanted access rights */
760     unsigned int attributes;    /* object attributes */
761     int          manual_reset;  /* manual reset event */
762     int          initial_state; /* initial state of the event */
763     VARARG(objattr,object_attributes); /* object attributes */
764 @REPLY
765     obj_handle_t handle;        /* handle to the event */
766 @END
767
768 /* Event operation */
769 @REQ(event_op)
770     obj_handle_t  handle;       /* handle to event */
771     int           op;           /* event operation (see below) */
772 @END
773 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
774
775
776 /* Open an event */
777 @REQ(open_event)
778     unsigned int access;        /* wanted access rights */
779     unsigned int attributes;    /* object attributes */
780     obj_handle_t rootdir;       /* root directory */
781     VARARG(name,unicode_str);   /* object name */
782 @REPLY
783     obj_handle_t handle;        /* handle to the event */
784 @END
785
786
787 /* Create a mutex */
788 @REQ(create_mutex)
789     unsigned int access;        /* wanted access rights */
790     unsigned int attributes;    /* object attributes */
791     int          owned;         /* initially owned? */
792     VARARG(objattr,object_attributes); /* object attributes */
793 @REPLY
794     obj_handle_t handle;        /* handle to the mutex */
795 @END
796
797
798 /* Release a mutex */
799 @REQ(release_mutex)
800     obj_handle_t handle;        /* handle to the mutex */
801 @REPLY
802     unsigned int prev_count;    /* value of internal counter, before release */
803 @END
804
805
806 /* Open a mutex */
807 @REQ(open_mutex)
808     unsigned int access;        /* wanted access rights */
809     unsigned int attributes;    /* object attributes */
810     obj_handle_t rootdir;       /* root directory */
811     VARARG(name,unicode_str);   /* object name */
812 @REPLY
813     obj_handle_t handle;        /* handle to the mutex */
814 @END
815
816
817 /* Create a semaphore */
818 @REQ(create_semaphore)
819     unsigned int access;        /* wanted access rights */
820     unsigned int attributes;    /* object attributes */
821     unsigned int initial;       /* initial count */
822     unsigned int max;           /* maximum count */
823     VARARG(objattr,object_attributes); /* object attributes */
824 @REPLY
825     obj_handle_t handle;        /* handle to the semaphore */
826 @END
827
828
829 /* Release a semaphore */
830 @REQ(release_semaphore)
831     obj_handle_t handle;        /* handle to the semaphore */
832     unsigned int count;         /* count to add to semaphore */
833 @REPLY
834     unsigned int prev_count;    /* previous semaphore count */
835 @END
836
837
838 /* Open a semaphore */
839 @REQ(open_semaphore)
840     unsigned int access;        /* wanted access rights */
841     unsigned int attributes;    /* object attributes */
842     obj_handle_t rootdir;       /* root directory */
843     VARARG(name,unicode_str);   /* object name */
844 @REPLY
845     obj_handle_t handle;        /* handle to the semaphore */
846 @END
847
848
849 /* Create a file */
850 @REQ(create_file)
851     unsigned int access;        /* wanted access rights */
852     unsigned int attributes;    /* object attributes */
853     unsigned int sharing;       /* sharing flags */
854     int          create;        /* file create action */
855     unsigned int options;       /* file options */
856     unsigned int attrs;         /* file attributes for creation */
857     VARARG(objattr,object_attributes); /* object attributes */
858     VARARG(filename,string);    /* file name */
859 @REPLY
860     obj_handle_t handle;        /* handle to the file */
861 @END
862
863
864 /* Open a file object */
865 @REQ(open_file_object)
866     unsigned int access;        /* wanted access rights */
867     unsigned int attributes;    /* open attributes */
868     obj_handle_t rootdir;       /* root directory */
869     unsigned int sharing;       /* sharing flags */
870     unsigned int options;       /* file options */
871     VARARG(filename,unicode_str); /* file name */
872 @REPLY
873     obj_handle_t handle;        /* handle to the file */
874 @END
875
876
877 /* Allocate a file handle for a Unix fd */
878 @REQ(alloc_file_handle)
879     unsigned int access;        /* wanted access rights */
880     unsigned int attributes;    /* object attributes */
881     int          fd;            /* file descriptor on the client side */
882 @REPLY
883     obj_handle_t handle;        /* handle to the file */
884 @END
885
886
887 /* Get a Unix fd to access a file */
888 @REQ(get_handle_fd)
889     obj_handle_t handle;        /* handle to the file */
890 @REPLY
891     int          type;          /* file type (see below) */
892     int          removable;     /* is file removable? */
893     unsigned int access;        /* file access rights */
894     unsigned int options;       /* file open options */
895 @END
896 enum server_fd_type
897 {
898     FD_TYPE_INVALID,  /* invalid file (no associated fd) */
899     FD_TYPE_FILE,     /* regular file */
900     FD_TYPE_DIR,      /* directory */
901     FD_TYPE_SOCKET,   /* socket */
902     FD_TYPE_SERIAL,   /* serial port */
903     FD_TYPE_PIPE,     /* named pipe */
904     FD_TYPE_MAILSLOT, /* mailslot */
905     FD_TYPE_CHAR,     /* unspecified char device */
906     FD_TYPE_DEVICE,   /* Windows device file */
907     FD_TYPE_NB_TYPES
908 };
909
910
911 /* Flush a file buffers */
912 @REQ(flush_file)
913     obj_handle_t handle;        /* handle to the file */
914 @REPLY
915     obj_handle_t event;         /* event set when finished */
916 @END
917
918
919 /* Lock a region of a file */
920 @REQ(lock_file)
921     obj_handle_t handle;        /* handle to the file */
922     file_pos_t   offset;        /* offset of start of lock */
923     file_pos_t   count;         /* count of bytes to lock */
924     int          shared;        /* shared or exclusive lock? */
925     int          wait;          /* do we want to wait? */
926 @REPLY
927     obj_handle_t handle;        /* handle to wait on */
928     int          overlapped;    /* is it an overlapped I/O handle? */
929 @END
930
931
932 /* Unlock a region of a file */
933 @REQ(unlock_file)
934     obj_handle_t handle;        /* handle to the file */
935     file_pos_t   offset;        /* offset of start of unlock */
936     file_pos_t   count;         /* count of bytes to unlock */
937 @END
938
939
940 /* Create a socket */
941 @REQ(create_socket)
942     unsigned int access;        /* wanted access rights */
943     unsigned int attributes;    /* object attributes */
944     int          family;        /* family, see socket manpage */
945     int          type;          /* type, see socket manpage */
946     int          protocol;      /* protocol, see socket manpage */
947     unsigned int flags;         /* socket flags */
948 @REPLY
949     obj_handle_t handle;        /* handle to the new socket */
950 @END
951
952
953 /* Accept a socket */
954 @REQ(accept_socket)
955     obj_handle_t lhandle;       /* handle to the listening socket */
956     unsigned int access;        /* wanted access rights */
957     unsigned int attributes;    /* object attributes */
958 @REPLY
959     obj_handle_t handle;        /* handle to the new socket */
960 @END
961
962
963 /* Set socket event parameters */
964 @REQ(set_socket_event)
965     obj_handle_t  handle;        /* handle to the socket */
966     unsigned int  mask;          /* event mask */
967     obj_handle_t  event;         /* event object */
968     user_handle_t window;        /* window to send the message to */
969     unsigned int  msg;           /* message to send */
970 @END
971
972
973 /* Get socket event parameters */
974 @REQ(get_socket_event)
975     obj_handle_t handle;        /* handle to the socket */
976     int          service;       /* clear pending? */
977     obj_handle_t c_event;       /* event to clear */
978 @REPLY
979     unsigned int mask;          /* event mask */
980     unsigned int pmask;         /* pending events */
981     unsigned int state;         /* status bits */
982     VARARG(errors,ints);        /* event errors */
983 @END
984
985
986 /* Reenable pending socket events */
987 @REQ(enable_socket_event)
988     obj_handle_t handle;        /* handle to the socket */
989     unsigned int mask;          /* events to re-enable */
990     unsigned int sstate;        /* status bits to set */
991     unsigned int cstate;        /* status bits to clear */
992 @END
993
994 @REQ(set_socket_deferred)
995     obj_handle_t handle;        /* handle to the socket */
996     obj_handle_t deferred;      /* handle to the socket for which accept() is deferred */
997 @END
998
999 /* Allocate a console (only used by a console renderer) */
1000 @REQ(alloc_console)
1001     unsigned int access;        /* wanted access rights */
1002     unsigned int attributes;    /* object attributes */
1003     process_id_t pid;           /* pid of process which shall be attached to the console */
1004 @REPLY
1005     obj_handle_t handle_in;     /* handle to console input */
1006     obj_handle_t event;         /* handle to renderer events change notification */
1007 @END
1008
1009
1010 /* Free the console of the current process */
1011 @REQ(free_console)
1012 @END
1013
1014
1015 #define CONSOLE_RENDERER_NONE_EVENT        0x00
1016 #define CONSOLE_RENDERER_TITLE_EVENT       0x01
1017 #define CONSOLE_RENDERER_ACTIVE_SB_EVENT   0x02
1018 #define CONSOLE_RENDERER_SB_RESIZE_EVENT   0x03
1019 #define CONSOLE_RENDERER_UPDATE_EVENT      0x04
1020 #define CONSOLE_RENDERER_CURSOR_POS_EVENT  0x05
1021 #define CONSOLE_RENDERER_CURSOR_GEOM_EVENT 0x06
1022 #define CONSOLE_RENDERER_DISPLAY_EVENT     0x07
1023 #define CONSOLE_RENDERER_EXIT_EVENT        0x08
1024 struct console_renderer_event
1025 {
1026     short event;
1027     union
1028     {
1029         struct update
1030         {
1031             short top;
1032             short bottom;
1033         } update;
1034         struct resize
1035         {
1036             short width;
1037             short height;
1038         } resize;
1039         struct cursor_pos
1040         {
1041             short x;
1042             short y;
1043         } cursor_pos;
1044         struct cursor_geom
1045         {
1046             short visible;
1047             short size;
1048         } cursor_geom;
1049         struct display
1050         {
1051             short left;
1052             short top;
1053             short width;
1054             short height;
1055         } display;
1056     } u;
1057 };
1058
1059 /* retrieve console events for the renderer */
1060 @REQ(get_console_renderer_events)
1061     obj_handle_t handle;        /* handle to console input events */
1062 @REPLY
1063     VARARG(data,bytes);         /* the various console_renderer_events */
1064 @END
1065
1066
1067 /* Open a handle to the process console */
1068 @REQ(open_console)
1069     obj_handle_t from;          /* 0 (resp 1) input (resp output) of current process console */
1070                                 /* otherwise console_in handle to get active screen buffer? */
1071     unsigned int access;        /* wanted access rights */
1072     unsigned int attributes;    /* object attributes */
1073     int          share;         /* share mask (only for output handles) */
1074 @REPLY
1075     obj_handle_t handle;        /* handle to the console */
1076 @END
1077
1078
1079 /* Get the input queue wait event */
1080 @REQ(get_console_wait_event)
1081 @REPLY
1082     obj_handle_t handle;
1083 @END
1084
1085 /* Get a console mode (input or output) */
1086 @REQ(get_console_mode)
1087     obj_handle_t handle;        /* handle to the console */
1088 @REPLY
1089     int          mode;          /* console mode */
1090 @END
1091
1092
1093 /* Set a console mode (input or output) */
1094 @REQ(set_console_mode)
1095     obj_handle_t handle;        /* handle to the console */
1096     int          mode;          /* console mode */
1097 @END
1098
1099
1100 /* Set info about a console (input only) */
1101 @REQ(set_console_input_info)
1102     obj_handle_t  handle;        /* handle to console input, or 0 for process' console */
1103     int           mask;          /* setting mask (see below) */
1104     obj_handle_t  active_sb;     /* active screen buffer */
1105     int           history_mode;  /* whether we duplicate lines in history */
1106     int           history_size;  /* number of lines in history */
1107     int           edition_mode;  /* index to the edition mode flavors */
1108     int           input_cp;      /* console input codepage */
1109     int           output_cp;     /* console output codepage */
1110     user_handle_t win;           /* console window if backend supports it */
1111     VARARG(title,unicode_str);   /* console title */
1112 @END
1113 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
1114 #define SET_CONSOLE_INPUT_INFO_TITLE            0x02
1115 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
1116 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
1117 #define SET_CONSOLE_INPUT_INFO_EDITION_MODE     0x10
1118 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE   0x20
1119 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE  0x40
1120 #define SET_CONSOLE_INPUT_INFO_WIN              0x80
1121
1122
1123 /* Get info about a console (input only) */
1124 @REQ(get_console_input_info)
1125     obj_handle_t  handle;         /* handle to console input, or 0 for process' console */
1126 @REPLY
1127     int           history_mode;   /* whether we duplicate lines in history */
1128     int           history_size;   /* number of lines in history */
1129     int           history_index;  /* number of used lines in history */
1130     int           edition_mode;   /* index to the edition mode flavors */
1131     int           input_cp;       /* console input codepage */
1132     int           output_cp;      /* console output codepage */
1133     user_handle_t win;            /* console window if backend supports it */
1134     VARARG(title,unicode_str);    /* console title */
1135 @END
1136
1137
1138 /* appends a string to console's history */
1139 @REQ(append_console_input_history)
1140     obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1141     VARARG(line,unicode_str);   /* line to add */
1142 @END
1143
1144
1145 /* appends a string to console's history */
1146 @REQ(get_console_input_history)
1147     obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1148     int          index;         /* index to get line from */
1149 @REPLY
1150     int          total;         /* total length of line in Unicode chars */
1151     VARARG(line,unicode_str);   /* line to add */
1152 @END
1153
1154
1155 /* creates a new screen buffer on process' console */
1156 @REQ(create_console_output)
1157     obj_handle_t handle_in;     /* handle to console input, or 0 for process' console */
1158     unsigned int access;        /* wanted access rights */
1159     unsigned int attributes;    /* object attributes */
1160     unsigned int share;         /* sharing credentials */
1161 @REPLY
1162     obj_handle_t handle_out;    /* handle to the screen buffer */
1163 @END
1164
1165
1166 /* Set info about a console (output only) */
1167 @REQ(set_console_output_info)
1168     obj_handle_t handle;        /* handle to the console */
1169     int          mask;          /* setting mask (see below) */
1170     short int    cursor_size;   /* size of cursor (percentage filled) */
1171     short int    cursor_visible;/* cursor visibility flag */
1172     short int    cursor_x;      /* position of cursor (x, y) */
1173     short int    cursor_y;
1174     short int    width;         /* width of the screen buffer */
1175     short int    height;        /* height of the screen buffer */
1176     short int    attr;          /* default attribute */
1177     short int    win_left;      /* window actually displayed by renderer */
1178     short int    win_top;       /* the rect area is expressed withing the */
1179     short int    win_right;     /* boundaries of the screen buffer */
1180     short int    win_bottom;
1181     short int    max_width;     /* maximum size (width x height) for the window */
1182     short int    max_height;
1183 @END
1184 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
1185 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
1186 #define SET_CONSOLE_OUTPUT_INFO_SIZE            0x04
1187 #define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
1188 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
1189 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20
1190
1191
1192 /* Get info about a console (output only) */
1193 @REQ(get_console_output_info)
1194     obj_handle_t handle;        /* handle to the console */
1195 @REPLY
1196     short int    cursor_size;   /* size of cursor (percentage filled) */
1197     short int    cursor_visible;/* cursor visibility flag */
1198     short int    cursor_x;      /* position of cursor (x, y) */
1199     short int    cursor_y;
1200     short int    width;         /* width of the screen buffer */
1201     short int    height;        /* height of the screen buffer */
1202     short int    attr;          /* default attribute */
1203     short int    win_left;      /* window actually displayed by renderer */
1204     short int    win_top;       /* the rect area is expressed withing the */
1205     short int    win_right;     /* boundaries of the screen buffer */
1206     short int    win_bottom;
1207     short int    max_width;     /* maximum size (width x height) for the window */
1208     short int    max_height;
1209 @END
1210
1211 /* Add input records to a console input queue */
1212 @REQ(write_console_input)
1213     obj_handle_t handle;        /* handle to the console input */
1214     VARARG(rec,input_records);  /* input records */
1215 @REPLY
1216     int          written;       /* number of records written */
1217 @END
1218
1219
1220 /* Fetch input records from a console input queue */
1221 @REQ(read_console_input)
1222     obj_handle_t handle;        /* handle to the console input */
1223     int          flush;         /* flush the retrieved records from the queue? */
1224 @REPLY
1225     int          read;          /* number of records read */
1226     VARARG(rec,input_records);  /* input records */
1227 @END
1228
1229
1230 /* write data (chars and/or attributes) in a screen buffer */
1231 @REQ(write_console_output)
1232     obj_handle_t handle;        /* handle to the console output */
1233     int          x;             /* position where to start writing */
1234     int          y;
1235     int          mode;          /* char info (see below) */
1236     int          wrap;          /* wrap around at end of line? */
1237     VARARG(data,bytes);         /* info to write */
1238 @REPLY
1239     int          written;       /* number of char infos actually written */
1240     int          width;         /* width of screen buffer */
1241     int          height;        /* height of screen buffer */
1242 @END
1243 enum char_info_mode
1244 {
1245     CHAR_INFO_MODE_TEXT,        /* characters only */
1246     CHAR_INFO_MODE_ATTR,        /* attributes only */
1247     CHAR_INFO_MODE_TEXTATTR,    /* both characters and attributes */
1248     CHAR_INFO_MODE_TEXTSTDATTR  /* characters but use standard attributes */
1249 };
1250
1251
1252 /* fill a screen buffer with constant data (chars and/or attributes) */
1253 @REQ(fill_console_output)
1254     obj_handle_t handle;        /* handle to the console output */
1255     int          x;             /* position where to start writing */
1256     int          y;
1257     int          mode;          /* char info mode */
1258     int          count;         /* number to write */
1259     int          wrap;          /* wrap around at end of line? */
1260     char_info_t  data;          /* data to write */
1261 @REPLY
1262     int          written;       /* number of char infos actually written */
1263 @END
1264
1265
1266 /* read data (chars and/or attributes) from a screen buffer */
1267 @REQ(read_console_output)
1268     obj_handle_t handle;        /* handle to the console output */
1269     int          x;             /* position (x,y) where to start reading */
1270     int          y;
1271     int          mode;          /* char info mode */
1272     int          wrap;          /* wrap around at end of line? */
1273 @REPLY
1274     int          width;         /* width of screen buffer */
1275     int          height;        /* height of screen buffer */
1276     VARARG(data,bytes);
1277 @END
1278
1279
1280 /* move a rect (of data) in screen buffer content */
1281 @REQ(move_console_output)
1282     obj_handle_t handle;        /* handle to the console output */
1283     short int    x_src;         /* position (x, y) of rect to start moving from */
1284     short int    y_src;
1285     short int    x_dst;         /* position (x, y) of rect to move to */
1286     short int    y_dst;
1287     short int    w;             /* size of the rect (width, height) to move */
1288     short int    h;
1289 @END
1290
1291
1292 /* Sends a signal to a process group */
1293 @REQ(send_console_signal)
1294     int          signal;        /* the signal to send */
1295     process_id_t group_id;      /* the group to send the signal to */
1296 @END
1297
1298
1299 /* enable directory change notifications */
1300 @REQ(read_directory_changes)
1301     unsigned int filter;        /* notification filter */
1302     obj_handle_t handle;        /* handle to the directory */
1303     int          subtree;       /* watch the subtree? */
1304     int          want_data;     /* flag indicating whether change data should be collected */
1305     async_data_t async;         /* async I/O parameters */
1306 @END
1307
1308
1309 @REQ(read_change)
1310     obj_handle_t handle;
1311 @REPLY
1312     int          action;        /* type of change */
1313     VARARG(name,string);        /* name of directory entry that changed */
1314 @END
1315
1316
1317 /* Create a file mapping */
1318 @REQ(create_mapping)
1319     unsigned int access;        /* wanted access rights */
1320     unsigned int attributes;    /* object attributes */
1321     mem_size_t   size;          /* mapping size */
1322     unsigned int protect;       /* protection flags (see below) */
1323     obj_handle_t file_handle;   /* file handle */
1324     VARARG(objattr,object_attributes); /* object attributes */
1325 @REPLY
1326     obj_handle_t handle;        /* handle to the mapping */
1327 @END
1328 /* per-page protection flags */
1329 #define VPROT_READ       0x01
1330 #define VPROT_WRITE      0x02
1331 #define VPROT_EXEC       0x04
1332 #define VPROT_WRITECOPY  0x08
1333 #define VPROT_GUARD      0x10
1334 #define VPROT_NOCACHE    0x20
1335 #define VPROT_COMMITTED  0x40
1336 #define VPROT_WRITEWATCH 0x80
1337 /* per-mapping protection flags */
1338 #define VPROT_IMAGE      0x0100  /* mapping for an exe image */
1339 #define VPROT_SYSTEM     0x0200  /* system view (underlying mmap not under our control) */
1340 #define VPROT_VALLOC     0x0400  /* allocated by VirtualAlloc */
1341 #define VPROT_NOEXEC     0x0800  /* don't force exec permission */
1342
1343
1344 /* Open a mapping */
1345 @REQ(open_mapping)
1346     unsigned int access;        /* wanted access rights */
1347     unsigned int attributes;    /* object attributes */
1348     obj_handle_t rootdir;       /* root directory */
1349     VARARG(name,unicode_str);   /* object name */
1350 @REPLY
1351     obj_handle_t handle;        /* handle to the mapping */
1352 @END
1353
1354
1355 /* Get information about a file mapping */
1356 @REQ(get_mapping_info)
1357     obj_handle_t handle;        /* handle to the mapping */
1358     unsigned int access;        /* wanted access rights */
1359 @REPLY
1360     mem_size_t   size;          /* mapping size */
1361     int          protect;       /* protection flags */
1362     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1363     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1364     obj_handle_t mapping;       /* duplicate mapping handle unless removable */
1365     obj_handle_t shared_file;   /* shared mapping file handle */
1366 @END
1367
1368
1369 /* Get a range of committed pages in a file mapping */
1370 @REQ(get_mapping_committed_range)
1371     obj_handle_t handle;        /* handle to the mapping */
1372     file_pos_t   offset;        /* starting offset (page-aligned, in bytes) */
1373 @REPLY
1374     mem_size_t   size;          /* size of range starting at offset (page-aligned, in bytes) */
1375     int          committed;     /* whether it is a committed range */
1376 @END
1377
1378
1379 /* Add a range to the committed pages in a file mapping */
1380 @REQ(add_mapping_committed_range)
1381     obj_handle_t handle;        /* handle to the mapping */
1382     file_pos_t   offset;        /* starting offset (page-aligned, in bytes) */
1383     mem_size_t   size;          /* size to set (page-aligned, in bytes) or 0 if only retrieving */
1384 @END
1385
1386
1387 #define SNAP_PROCESS    0x00000001
1388 #define SNAP_THREAD     0x00000002
1389 /* Create a snapshot */
1390 @REQ(create_snapshot)
1391     unsigned int attributes;    /* object attributes */
1392     unsigned int flags;         /* snapshot flags (SNAP_*) */
1393 @REPLY
1394     obj_handle_t handle;        /* handle to the snapshot */
1395 @END
1396
1397
1398 /* Get the next process from a snapshot */
1399 @REQ(next_process)
1400     obj_handle_t handle;        /* handle to the snapshot */
1401     int          reset;         /* reset snapshot position? */
1402 @REPLY
1403     int          count;         /* process usage count */
1404     process_id_t pid;           /* process id */
1405     process_id_t ppid;          /* parent process id */
1406     int          threads;       /* number of threads */
1407     int          priority;      /* process priority */
1408     int          handles;       /* number of handles */
1409     VARARG(filename,unicode_str); /* file name of main exe */
1410 @END
1411
1412
1413 /* Get the next thread from a snapshot */
1414 @REQ(next_thread)
1415     obj_handle_t handle;        /* handle to the snapshot */
1416     int          reset;         /* reset snapshot position? */
1417 @REPLY
1418     int          count;         /* thread usage count */
1419     process_id_t pid;           /* process id */
1420     thread_id_t  tid;           /* thread id */
1421     int          base_pri;      /* base priority */
1422     int          delta_pri;     /* delta priority */
1423 @END
1424
1425
1426 /* Wait for a debug event */
1427 @REQ(wait_debug_event)
1428     int           get_handle;  /* should we alloc a handle for waiting? */
1429 @REPLY
1430     process_id_t  pid;         /* process id */
1431     thread_id_t   tid;         /* thread id */
1432     obj_handle_t  wait;        /* wait handle if no event ready */
1433     VARARG(event,debug_event); /* debug event data */
1434 @END
1435
1436
1437 /* Queue an exception event */
1438 @REQ(queue_exception_event)
1439     int              first;    /* first chance exception? */
1440     VARARG(record,exc_event);  /* thread context followed by exception record */
1441 @REPLY
1442     obj_handle_t     handle;   /* handle to the queued event */
1443 @END
1444
1445
1446 /* Retrieve the status of an exception event */
1447 @REQ(get_exception_status)
1448     obj_handle_t     handle;   /* handle to the queued event */
1449 @REPLY
1450     VARARG(context,context);   /* modified thread context */
1451 @END
1452
1453
1454 /* Send an output string to the debugger */
1455 @REQ(output_debug_string)
1456     void*         string;      /* string to display (in debugged process address space) */
1457     int           unicode;     /* is it Unicode? */
1458     int           length;      /* string length */
1459 @END
1460
1461
1462 /* Continue a debug event */
1463 @REQ(continue_debug_event)
1464     process_id_t pid;          /* process id to continue */
1465     thread_id_t  tid;          /* thread id to continue */
1466     int          status;       /* continuation status */
1467 @END
1468
1469
1470 /* Start/stop debugging an existing process */
1471 @REQ(debug_process)
1472     process_id_t pid;          /* id of the process to debug */
1473     int          attach;       /* 1=attaching / 0=detaching from the process */
1474 @END
1475
1476
1477 /* Simulate a breakpoint in a process */
1478 @REQ(debug_break)
1479     obj_handle_t handle;       /* process handle */
1480 @REPLY
1481     int          self;         /* was it the caller itself? */
1482 @END
1483
1484
1485 /* Set debugger kill on exit flag */
1486 @REQ(set_debugger_kill_on_exit)
1487     int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1488 @END
1489
1490
1491 /* Read data from a process address space */
1492 @REQ(read_process_memory)
1493     obj_handle_t handle;       /* process handle */
1494     void*        addr;         /* addr to read from */
1495 @REPLY
1496     VARARG(data,bytes);        /* result data */
1497 @END
1498
1499
1500 /* Write data to a process address space */
1501 @REQ(write_process_memory)
1502     obj_handle_t handle;       /* process handle */
1503     void*        addr;         /* addr to write to */
1504     VARARG(data,bytes);        /* data to write */
1505 @END
1506
1507
1508 /* Create a registry key */
1509 @REQ(create_key)
1510     obj_handle_t parent;       /* handle to the parent key */
1511     unsigned int access;       /* desired access rights */
1512     unsigned int attributes;   /* object attributes */
1513     unsigned int options;      /* creation options */
1514     data_size_t  namelen;      /* length of key name in bytes */
1515     VARARG(name,unicode_str,namelen);  /* key name */
1516     VARARG(class,unicode_str);         /* class name */
1517 @REPLY
1518     obj_handle_t hkey;         /* handle to the created key */
1519     int          created;      /* has it been newly created? */
1520 @END
1521
1522 /* Open a registry key */
1523 @REQ(open_key)
1524     obj_handle_t parent;       /* handle to the parent key */
1525     unsigned int access;       /* desired access rights */
1526     unsigned int attributes;   /* object attributes */
1527     VARARG(name,unicode_str);  /* key name */
1528 @REPLY
1529     obj_handle_t hkey;         /* handle to the open key */
1530 @END
1531
1532
1533 /* Delete a registry key */
1534 @REQ(delete_key)
1535     obj_handle_t hkey;         /* handle to the key */
1536 @END
1537
1538
1539 /* Flush a registry key */
1540 @REQ(flush_key)
1541     obj_handle_t hkey;         /* handle to the key */
1542 @END
1543
1544
1545 /* Enumerate registry subkeys */
1546 @REQ(enum_key)
1547     obj_handle_t hkey;         /* handle to registry key */
1548     int          index;        /* index of subkey (or -1 for current key) */
1549     int          info_class;   /* requested information class */
1550 @REPLY
1551     int          subkeys;      /* number of subkeys */
1552     int          max_subkey;   /* longest subkey name */
1553     int          max_class;    /* longest class name */
1554     int          values;       /* number of values */
1555     int          max_value;    /* longest value name */
1556     int          max_data;     /* longest value data */
1557     timeout_t    modif;        /* last modification time */
1558     data_size_t  total;        /* total length needed for full name and class */
1559     data_size_t  namelen;      /* length of key name in bytes */
1560     VARARG(name,unicode_str,namelen);  /* key name */
1561     VARARG(class,unicode_str);         /* class name */
1562 @END
1563
1564
1565 /* Set a value of a registry key */
1566 @REQ(set_key_value)
1567     obj_handle_t hkey;         /* handle to registry key */
1568     int          type;         /* value type */
1569     data_size_t  namelen;      /* length of value name in bytes */
1570     VARARG(name,unicode_str,namelen);  /* value name */
1571     VARARG(data,bytes);                /* value data */
1572 @END
1573
1574
1575 /* Retrieve the value of a registry key */
1576 @REQ(get_key_value)
1577     obj_handle_t hkey;         /* handle to registry key */
1578     VARARG(name,unicode_str);  /* value name */
1579 @REPLY
1580     int          type;         /* value type */
1581     data_size_t  total;        /* total length needed for data */
1582     VARARG(data,bytes);        /* value data */
1583 @END
1584
1585
1586 /* Enumerate a value of a registry key */
1587 @REQ(enum_key_value)
1588     obj_handle_t hkey;         /* handle to registry key */
1589     int          index;        /* value index */
1590     int          info_class;   /* requested information class */
1591 @REPLY
1592     int          type;         /* value type */
1593     data_size_t  total;        /* total length needed for full name and data */
1594     data_size_t  namelen;      /* length of value name in bytes */
1595     VARARG(name,unicode_str,namelen);  /* value name */
1596     VARARG(data,bytes);                /* value data */
1597 @END
1598
1599
1600 /* Delete a value of a registry key */
1601 @REQ(delete_key_value)
1602     obj_handle_t hkey;         /* handle to registry key */
1603     VARARG(name,unicode_str);  /* value name */
1604 @END
1605
1606
1607 /* Load a registry branch from a file */
1608 @REQ(load_registry)
1609     obj_handle_t hkey;         /* root key to load to */
1610     obj_handle_t file;         /* file to load from */
1611     VARARG(name,unicode_str);  /* subkey name */
1612 @END
1613
1614
1615 /* UnLoad a registry branch from a file */
1616 @REQ(unload_registry)
1617     obj_handle_t hkey;         /* root key to unload to */
1618 @END
1619
1620
1621 /* Save a registry branch to a file */
1622 @REQ(save_registry)
1623     obj_handle_t hkey;         /* key to save */
1624     obj_handle_t file;         /* file to save to */
1625 @END
1626
1627
1628 /* Add a registry key change notification */
1629 @REQ(set_registry_notification)
1630     obj_handle_t hkey;         /* key to watch for changes */
1631     obj_handle_t event;        /* event to set */
1632     int          subtree;      /* should we watch the whole subtree? */
1633     unsigned int filter;       /* things to watch */
1634 @END
1635
1636
1637 /* Create a waitable timer */
1638 @REQ(create_timer)
1639     unsigned int access;        /* wanted access rights */
1640     unsigned int attributes;    /* object attributes */
1641     obj_handle_t rootdir;       /* root directory */
1642     int          manual;        /* manual reset */
1643     VARARG(name,unicode_str);   /* object name */
1644 @REPLY
1645     obj_handle_t handle;        /* handle to the timer */
1646 @END
1647
1648
1649 /* Open a waitable timer */
1650 @REQ(open_timer)
1651     unsigned int access;        /* wanted access rights */
1652     unsigned int attributes;    /* object attributes */
1653     obj_handle_t rootdir;       /* root directory */
1654     VARARG(name,unicode_str);   /* object name */
1655 @REPLY
1656     obj_handle_t handle;        /* handle to the timer */
1657 @END
1658
1659 /* Set a waitable timer */
1660 @REQ(set_timer)
1661     obj_handle_t handle;        /* handle to the timer */
1662     timeout_t    expire;        /* next expiration absolute time */
1663     int          period;        /* timer period in ms */
1664     void*        callback;      /* callback function */
1665     void*        arg;           /* callback argument */
1666 @REPLY
1667     int          signaled;      /* was the timer signaled before this call ? */
1668 @END
1669
1670 /* Cancel a waitable timer */
1671 @REQ(cancel_timer)
1672     obj_handle_t handle;        /* handle to the timer */
1673 @REPLY
1674      int         signaled;      /* was the timer signaled before this calltime ? */
1675 @END
1676
1677 /* Get information on a waitable timer */
1678 @REQ(get_timer_info)
1679     obj_handle_t handle;        /* handle to the timer */
1680 @REPLY
1681     timeout_t    when;          /* absolute time when the timer next expires */
1682     int          signaled;      /* is the timer signaled? */
1683 @END
1684
1685
1686 /* Retrieve the current context of a thread */
1687 @REQ(get_thread_context)
1688     obj_handle_t handle;       /* thread handle */
1689     unsigned int flags;        /* context flags */
1690     int          suspend;      /* if getting context during suspend */
1691 @REPLY
1692     int          self;         /* was it a handle to the current thread? */
1693     VARARG(context,context);   /* thread context */
1694 @END
1695
1696
1697 /* Set the current context of a thread */
1698 @REQ(set_thread_context)
1699     obj_handle_t handle;       /* thread handle */
1700     unsigned int flags;        /* context flags */
1701     int          suspend;      /* if setting context during suspend */
1702     VARARG(context,context);   /* thread context */
1703 @REPLY
1704     int          self;         /* was it a handle to the current thread? */
1705 @END
1706
1707
1708 /* Fetch a selector entry for a thread */
1709 @REQ(get_selector_entry)
1710     obj_handle_t  handle;      /* thread handle */
1711     int           entry;       /* LDT entry */
1712 @REPLY
1713     unsigned int  base;        /* selector base */
1714     unsigned int  limit;       /* selector limit */
1715     unsigned char flags;       /* selector flags */
1716 @END
1717
1718
1719 /* Add an atom */
1720 @REQ(add_atom)
1721     obj_handle_t  table;       /* which table to add atom to */
1722     VARARG(name,unicode_str);  /* atom name */
1723 @REPLY
1724     atom_t        atom;        /* resulting atom */
1725 @END
1726
1727
1728 /* Delete an atom */
1729 @REQ(delete_atom)
1730     obj_handle_t  table;       /* which table to delete atom from */
1731     atom_t        atom;        /* atom handle */
1732 @END
1733
1734
1735 /* Find an atom */
1736 @REQ(find_atom)
1737     obj_handle_t table;        /* which table to find atom from */
1738     VARARG(name,unicode_str);  /* atom name */
1739 @REPLY
1740     atom_t       atom;         /* atom handle */
1741 @END
1742
1743
1744 /* Get information about an atom */
1745 @REQ(get_atom_information)
1746     obj_handle_t table;        /* which table to find atom from */
1747     atom_t       atom;         /* atom handle */
1748 @REPLY
1749     int          count;        /* atom lock count */
1750     int          pinned;       /* whether the atom has been pinned */
1751     data_size_t  total;        /* actual length of atom name */
1752     VARARG(name,unicode_str);  /* atom name */
1753 @END
1754
1755
1756 /* Set information about an atom */
1757 @REQ(set_atom_information)
1758     obj_handle_t table;        /* which table to find atom from */
1759     atom_t       atom;         /* atom handle */
1760     int          pinned;       /* whether to bump atom information */
1761 @END
1762
1763
1764 /* Empty an atom table */
1765 @REQ(empty_atom_table)
1766     obj_handle_t table;        /* which table to find atom from */
1767     int          if_pinned;    /* whether to delete pinned atoms */
1768 @END
1769
1770
1771 /* Init an atom table */
1772 @REQ(init_atom_table)
1773     int          entries;      /* number of entries (only for local) */
1774 @REPLY
1775     obj_handle_t table;        /* handle to the atom table */
1776 @END
1777
1778
1779 /* Get the message queue of the current thread */
1780 @REQ(get_msg_queue)
1781 @REPLY
1782     obj_handle_t handle;       /* handle to the queue */
1783 @END
1784
1785
1786 /* Set the file descriptor associated to the current thread queue */
1787 @REQ(set_queue_fd)
1788     obj_handle_t handle;       /* handle to the file descriptor */
1789 @END
1790
1791
1792 /* Set the current message queue wakeup mask */
1793 @REQ(set_queue_mask)
1794     unsigned int wake_mask;    /* wakeup bits mask */
1795     unsigned int changed_mask; /* changed bits mask */
1796     int          skip_wait;    /* will we skip waiting if signaled? */
1797 @REPLY
1798     unsigned int wake_bits;    /* current wake bits */
1799     unsigned int changed_bits; /* current changed bits */
1800 @END
1801
1802
1803 /* Get the current message queue status */
1804 @REQ(get_queue_status)
1805     int          clear;        /* should we clear the change bits? */
1806 @REPLY
1807     unsigned int wake_bits;    /* wake bits */
1808     unsigned int changed_bits; /* changed bits since last time */
1809 @END
1810
1811
1812 /* Retrieve the process idle event */
1813 @REQ(get_process_idle_event)
1814     obj_handle_t handle;       /* process handle */
1815 @REPLY
1816     obj_handle_t event;        /* handle to idle event */
1817 @END
1818
1819
1820 /* Send a message to a thread queue */
1821 @REQ(send_message)
1822     thread_id_t     id;        /* thread id */
1823     int             type;      /* message type (see below) */
1824     int             flags;     /* message flags (see below) */
1825     user_handle_t   win;       /* window handle */
1826     unsigned int    msg;       /* message code */
1827     lparam_t        wparam;    /* parameters */
1828     lparam_t        lparam;    /* parameters */
1829     timeout_t       timeout;   /* timeout for reply */
1830     VARARG(data,message_data); /* message data for sent messages */
1831 @END
1832
1833 @REQ(post_quit_message)
1834     int             exit_code; /* exit code to return */
1835 @END
1836
1837 enum message_type
1838 {
1839     MSG_ASCII,          /* Ascii message (from SendMessageA) */
1840     MSG_UNICODE,        /* Unicode message (from SendMessageW) */
1841     MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
1842     MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
1843     MSG_CALLBACK_RESULT,/* result of a callback message */
1844     MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
1845     MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
1846     MSG_HARDWARE,       /* hardware message */
1847     MSG_WINEVENT        /* winevent message */
1848 };
1849 #define SEND_MSG_ABORT_IF_HUNG  0x01
1850
1851
1852 /* Send a hardware message to a thread queue */
1853 @REQ(send_hardware_message)
1854     thread_id_t     id;        /* thread id */
1855     user_handle_t   win;       /* window handle */
1856     unsigned int    msg;       /* message code */
1857     unsigned int    time;      /* message time */
1858     lparam_t        wparam;    /* parameters */
1859     lparam_t        lparam;    /* parameters */
1860     lparam_t        info;      /* extra info */
1861     int             x;         /* x position */
1862     int             y;         /* y position */
1863 @END
1864
1865
1866 /* Get a message from the current queue */
1867 @REQ(get_message)
1868     unsigned int    flags;     /* PM_* flags */
1869     user_handle_t   get_win;   /* window handle to get */
1870     unsigned int    get_first; /* first message code to get */
1871     unsigned int    get_last;  /* last message code to get */
1872     unsigned int    hw_id;     /* id of the previous hardware message (or 0) */
1873     unsigned int    wake_mask; /* wakeup bits mask */
1874     unsigned int    changed_mask; /* changed bits mask */
1875 @REPLY
1876     user_handle_t   win;       /* window handle */
1877     int             type;      /* message type */
1878     unsigned int    msg;       /* message code */
1879     lparam_t        wparam;    /* parameters */
1880     lparam_t        lparam;    /* parameters */
1881     lparam_t        info;      /* extra info */
1882     int             x;         /* x position */
1883     int             y;         /* y position */
1884     unsigned int    time;      /* message time */
1885     unsigned int    hw_id;     /* id if hardware message */
1886     unsigned int    active_hooks; /* active hooks bitmap */
1887     data_size_t     total;     /* total size of extra data */
1888     VARARG(data,message_data); /* message data for sent messages */
1889 @END
1890
1891
1892 /* Reply to a sent message */
1893 @REQ(reply_message)
1894     lparam_t        result;    /* message result */
1895     int             remove;    /* should we remove the message? */
1896     VARARG(data,bytes);        /* message data for sent messages */
1897 @END
1898
1899
1900 /* Accept the current hardware message */
1901 @REQ(accept_hardware_message)
1902     unsigned int    hw_id;     /* id of the hardware message */
1903     int             remove;    /* should we remove the message? */
1904     user_handle_t   new_win;   /* new destination window for current message */
1905 @END
1906
1907
1908 /* Retrieve the reply for the last message sent */
1909 @REQ(get_message_reply)
1910     int             cancel;    /* cancel message if not ready? */
1911 @REPLY
1912     lparam_t        result;    /* message result */
1913     VARARG(data,bytes);        /* message data for sent messages */
1914 @END
1915
1916
1917 /* Set a window timer */
1918 @REQ(set_win_timer)
1919     user_handle_t   win;       /* window handle */
1920     unsigned int    msg;       /* message to post */
1921     unsigned int    rate;      /* timer rate in ms */
1922     lparam_t        id;        /* timer id */
1923     lparam_t        lparam;    /* message lparam (callback proc) */
1924 @REPLY
1925     lparam_t        id;        /* timer id */
1926 @END
1927
1928
1929 /* Kill a window timer */
1930 @REQ(kill_win_timer)
1931     user_handle_t   win;       /* window handle */
1932     unsigned int    msg;       /* message to post */
1933     lparam_t        id;        /* timer id */
1934 @END
1935
1936
1937 /* check if the thread owning the window is hung */
1938 @REQ(is_window_hung)
1939     user_handle_t   win;       /* window handle */
1940 @REPLY
1941     int is_hung;
1942 @END
1943
1944
1945 /* Retrieve info about a serial port */
1946 @REQ(get_serial_info)
1947     obj_handle_t handle;       /* handle to comm port */
1948 @REPLY
1949     unsigned int readinterval;
1950     unsigned int readconst;
1951     unsigned int readmult;
1952     unsigned int writeconst;
1953     unsigned int writemult;
1954     unsigned int eventmask;
1955 @END
1956
1957
1958 /* Set info about a serial port */
1959 @REQ(set_serial_info)
1960     obj_handle_t handle;       /* handle to comm port */
1961     int          flags;        /* bitmask to set values (see below) */
1962     unsigned int readinterval;
1963     unsigned int readconst;
1964     unsigned int readmult;
1965     unsigned int writeconst;
1966     unsigned int writemult;
1967     unsigned int eventmask;
1968 @END
1969 #define SERIALINFO_SET_TIMEOUTS  0x01
1970 #define SERIALINFO_SET_MASK      0x02
1971
1972
1973 /* Create an async I/O */
1974 @REQ(register_async)
1975     obj_handle_t handle;        /* handle to comm port, socket or file */
1976     int          type;          /* type of queue to look after */
1977     int          count;         /* count - usually # of bytes to be read/written */
1978     async_data_t async;         /* async I/O parameters */
1979 @END
1980 #define ASYNC_TYPE_READ  0x01
1981 #define ASYNC_TYPE_WRITE 0x02
1982 #define ASYNC_TYPE_WAIT  0x03
1983
1984
1985 /* Cancel all async op on a fd */
1986 @REQ(cancel_async)
1987     obj_handle_t handle;        /* handle to comm port, socket or file */
1988 @END
1989
1990
1991 /* Perform an ioctl on a file */
1992 @REQ(ioctl)
1993     obj_handle_t   handle;        /* handle to the device */
1994     ioctl_code_t   code;          /* ioctl code */
1995     async_data_t   async;         /* async I/O parameters */
1996     VARARG(in_data,bytes);        /* ioctl input data */
1997 @REPLY
1998     obj_handle_t   wait;          /* handle to wait on for blocking ioctl */
1999     unsigned int   options;       /* device open options */
2000     VARARG(out_data,bytes);       /* ioctl output data */
2001 @END
2002
2003
2004 /* Retrieve results of an async ioctl */
2005 @REQ(get_ioctl_result)
2006     obj_handle_t   handle;        /* handle to the device */
2007     void*          user_arg;      /* user arg used to identify the request */
2008 @REPLY
2009     VARARG(out_data,bytes);       /* ioctl output data */
2010 @END
2011
2012
2013 /* Create a named pipe */
2014 @REQ(create_named_pipe)
2015     unsigned int   access;
2016     unsigned int   attributes;   /* object attributes */
2017     obj_handle_t   rootdir;      /* root directory */
2018     unsigned int   options;
2019     unsigned int   flags;
2020     unsigned int   maxinstances;
2021     unsigned int   outsize;
2022     unsigned int   insize;
2023     timeout_t      timeout;
2024     VARARG(name,unicode_str);    /* pipe name */
2025 @REPLY
2026     obj_handle_t   handle;       /* handle to the pipe */
2027 @END
2028
2029 /* flags in create_named_pipe and get_named_pipe_info */
2030 #define NAMED_PIPE_MESSAGE_STREAM_WRITE 0x0001
2031 #define NAMED_PIPE_MESSAGE_STREAM_READ  0x0002
2032 #define NAMED_PIPE_NONBLOCKING_MODE     0x0004
2033 #define NAMED_PIPE_SERVER_END           0x8000
2034
2035
2036 @REQ(get_named_pipe_info)
2037     obj_handle_t   handle;
2038 @REPLY
2039     unsigned int   flags;
2040     unsigned int   maxinstances;
2041     unsigned int   instances;
2042     unsigned int   outsize;
2043     unsigned int   insize;
2044 @END
2045
2046
2047 /* Create a window */
2048 @REQ(create_window)
2049     user_handle_t  parent;      /* parent window */
2050     user_handle_t  owner;       /* owner window */
2051     atom_t         atom;        /* class atom */
2052     void*          instance;    /* module instance */
2053     VARARG(class,unicode_str);  /* class name */
2054 @REPLY
2055     user_handle_t  handle;      /* created window */
2056     user_handle_t  parent;      /* full handle of parent */
2057     user_handle_t  owner;       /* full handle of owner */
2058     int            extra;       /* number of extra bytes */
2059     void*          class_ptr;   /* pointer to class in client address space */
2060 @END
2061
2062
2063 /* Destroy a window */
2064 @REQ(destroy_window)
2065     user_handle_t  handle;      /* handle to the window */
2066 @END
2067
2068
2069 /* Retrieve the desktop window for the current thread */
2070 @REQ(get_desktop_window)
2071     int            force;       /* force creation if it doesn't exist */
2072 @REPLY
2073     user_handle_t  top_window;  /* handle to the desktop window */
2074     user_handle_t  msg_window;  /* handle to the top-level HWND_MESSAGE parent */
2075 @END
2076
2077
2078 /* Set a window owner */
2079 @REQ(set_window_owner)
2080     user_handle_t  handle;      /* handle to the window */
2081     user_handle_t  owner;       /* new owner */
2082 @REPLY
2083     user_handle_t  full_owner;  /* full handle of new owner */
2084     user_handle_t  prev_owner;  /* full handle of previous owner */
2085 @END
2086
2087
2088 /* Get information from a window handle */
2089 @REQ(get_window_info)
2090     user_handle_t  handle;      /* handle to the window */
2091 @REPLY
2092     user_handle_t  full_handle; /* full 32-bit handle */
2093     user_handle_t  last_active; /* last active popup */
2094     process_id_t   pid;         /* process owning the window */
2095     thread_id_t    tid;         /* thread owning the window */
2096     atom_t         atom;        /* class atom */
2097     int            is_unicode;  /* ANSI or unicode */
2098 @END
2099
2100
2101 /* Set some information in a window */
2102 @REQ(set_window_info)
2103     unsigned int   flags;         /* flags for fields to set (see below) */
2104     user_handle_t  handle;        /* handle to the window */
2105     unsigned int   style;         /* window style */
2106     unsigned int   ex_style;      /* window extended style */
2107     unsigned int   id;            /* window id */
2108     int            is_unicode;    /* ANSI or unicode */
2109     void*          instance;      /* creator instance */
2110     lparam_t       user_data;     /* user-specific data */
2111     int            extra_offset;  /* offset to set in extra bytes */
2112     data_size_t    extra_size;    /* size to set in extra bytes */
2113     lparam_t       extra_value;   /* value to set in extra bytes */
2114 @REPLY
2115     unsigned int   old_style;     /* old window style */
2116     unsigned int   old_ex_style;  /* old window extended style */
2117     unsigned int   old_id;        /* old window id */
2118     void*          old_instance;  /* old creator instance */
2119     lparam_t       old_user_data; /* old user-specific data */
2120     lparam_t       old_extra_value; /* old value in extra bytes */
2121 @END
2122 #define SET_WIN_STYLE     0x01
2123 #define SET_WIN_EXSTYLE   0x02
2124 #define SET_WIN_ID        0x04
2125 #define SET_WIN_INSTANCE  0x08
2126 #define SET_WIN_USERDATA  0x10
2127 #define SET_WIN_EXTRA     0x20
2128 #define SET_WIN_UNICODE   0x40
2129
2130
2131 /* Set the parent of a window */
2132 @REQ(set_parent)
2133     user_handle_t  handle;      /* handle to the window */
2134     user_handle_t  parent;      /* handle to the parent */
2135 @REPLY
2136     user_handle_t  old_parent;  /* old parent window */
2137     user_handle_t  full_parent; /* full handle of new parent */
2138 @END
2139
2140
2141 /* Get a list of the window parents, up to the root of the tree */
2142 @REQ(get_window_parents)
2143     user_handle_t  handle;        /* handle to the window */
2144 @REPLY
2145     int            count;         /* total count of parents */
2146     VARARG(parents,user_handles); /* parent handles */
2147 @END
2148
2149
2150 /* Get a list of the window children */
2151 @REQ(get_window_children)
2152     obj_handle_t   desktop;       /* handle to desktop */
2153     user_handle_t  parent;        /* parent window */
2154     atom_t         atom;          /* class atom for the listed children */
2155     thread_id_t    tid;           /* thread owning the listed children */
2156     VARARG(class,unicode_str);    /* class name */
2157 @REPLY
2158     int            count;         /* total count of children */
2159     VARARG(children,user_handles); /* children handles */
2160 @END
2161
2162
2163 /* Get a list of the window children that contain a given point */
2164 @REQ(get_window_children_from_point)
2165     user_handle_t  parent;        /* parent window */
2166     int            x;             /* point in parent coordinates */
2167     int            y;
2168 @REPLY
2169     int            count;         /* total count of children */
2170     VARARG(children,user_handles); /* children handles */
2171 @END
2172
2173
2174 /* Get window tree information from a window handle */
2175 @REQ(get_window_tree)
2176     user_handle_t  handle;        /* handle to the window */
2177 @REPLY
2178     user_handle_t  parent;        /* parent window */
2179     user_handle_t  owner;         /* owner window */
2180     user_handle_t  next_sibling;  /* next sibling in Z-order */
2181     user_handle_t  prev_sibling;  /* prev sibling in Z-order */
2182     user_handle_t  first_sibling; /* first sibling in Z-order */
2183     user_handle_t  last_sibling;  /* last sibling in Z-order */
2184     user_handle_t  first_child;   /* first child */
2185     user_handle_t  last_child;    /* last child */
2186 @END
2187
2188 /* Set the position and Z order of a window */
2189 @REQ(set_window_pos)
2190     unsigned int   flags;         /* SWP_* flags */
2191     user_handle_t  handle;        /* handle to the window */
2192     user_handle_t  previous;      /* previous window in Z order */
2193     rectangle_t    window;        /* window rectangle */
2194     rectangle_t    client;        /* client rectangle */
2195     VARARG(valid,rectangles);     /* valid rectangles from WM_NCCALCSIZE */
2196 @REPLY
2197     unsigned int   new_style;     /* new window style */
2198     unsigned int   new_ex_style;  /* new window extended style */
2199 @END
2200
2201
2202 /* Get the window and client rectangles of a window */
2203 @REQ(get_window_rectangles)
2204     user_handle_t  handle;        /* handle to the window */
2205 @REPLY
2206     rectangle_t    window;        /* window rectangle */
2207     rectangle_t    visible;       /* visible part of the window rectangle */
2208     rectangle_t    client;        /* client rectangle */
2209 @END
2210
2211
2212 /* Get the window text */
2213 @REQ(get_window_text)
2214     user_handle_t  handle;        /* handle to the window */
2215 @REPLY
2216     VARARG(text,unicode_str);     /* window text */
2217 @END
2218
2219
2220 /* Set the window text */
2221 @REQ(set_window_text)
2222     user_handle_t  handle;        /* handle to the window */
2223     VARARG(text,unicode_str);     /* window text */
2224 @END
2225
2226
2227 /* Get the coordinates offset between two windows */
2228 @REQ(get_windows_offset)
2229     user_handle_t  from;          /* handle to the first window */
2230     user_handle_t  to;            /* handle to the second window */
2231 @REPLY
2232     int            x;             /* x coordinate offset */
2233     int            y;             /* y coordinate offset */
2234 @END
2235
2236
2237 /* Get the visible region of a window */
2238 @REQ(get_visible_region)
2239     user_handle_t  window;        /* handle to the window */
2240     unsigned int   flags;         /* DCX flags */
2241 @REPLY
2242     user_handle_t  top_win;       /* top window to clip against */
2243     rectangle_t    top_rect;      /* top window visible rect with screen coords */
2244     rectangle_t    win_rect;      /* window rect in screen coords */
2245     data_size_t    total_size;    /* total size of the resulting region */
2246     VARARG(region,rectangles);    /* list of rectangles for the region (in screen coords) */
2247 @END
2248
2249
2250 /* Get the window region */
2251 @REQ(get_window_region)
2252     user_handle_t  window;        /* handle to the window */
2253 @REPLY
2254     data_size_t    total_size;    /* total size of the resulting region */
2255     VARARG(region,rectangles);    /* list of rectangles for the region */
2256 @END
2257
2258
2259 /* Set the window region */
2260 @REQ(set_window_region)
2261     user_handle_t  window;        /* handle to the window */
2262     int            redraw;        /* redraw the window? */
2263     VARARG(region,rectangles);    /* list of rectangles for the region */
2264 @END
2265
2266
2267 /* Get the window update region */
2268 @REQ(get_update_region)
2269     user_handle_t  window;        /* handle to the window */
2270     user_handle_t  from_child;    /* child to start searching from */
2271     unsigned int   flags;         /* update flags (see below) */
2272 @REPLY
2273     user_handle_t  child;         /* child to repaint (or window itself) */
2274     unsigned int   flags;         /* resulting update flags (see below) */
2275     data_size_t    total_size;    /* total size of the resulting region */
2276     VARARG(region,rectangles);    /* list of rectangles for the region */
2277 @END
2278 #define UPDATE_NONCLIENT       0x01  /* get region for repainting non-client area */
2279 #define UPDATE_ERASE           0x02  /* get region for erasing client area */
2280 #define UPDATE_PAINT           0x04  /* get region for painting client area */
2281 #define UPDATE_INTERNALPAINT   0x08  /* get region if internal paint is pending */
2282 #define UPDATE_ALLCHILDREN     0x10  /* force repaint of all children */
2283 #define UPDATE_NOCHILDREN      0x20  /* don't try to repaint any children */
2284 #define UPDATE_NOREGION        0x40  /* don't return a region, only the flags */
2285 #define UPDATE_DELAYED_ERASE   0x80  /* still needs erase after BeginPaint */
2286
2287
2288 /* Update the z order of a window so that a given rectangle is fully visible */
2289 @REQ(update_window_zorder)
2290     user_handle_t  window;        /* handle to the window */
2291     rectangle_t    rect;          /* rectangle that must be visible */
2292 @END
2293
2294
2295 /* Mark parts of a window as needing a redraw */
2296 @REQ(redraw_window)
2297     user_handle_t  window;        /* handle to the window */
2298     unsigned int   flags;         /* RDW_* flags */
2299     VARARG(region,rectangles);    /* list of rectangles for the region */
2300 @END
2301
2302
2303 /* Set a window property */
2304 @REQ(set_window_property)
2305     user_handle_t  window;        /* handle to the window */
2306     atom_t         atom;          /* property atom (if no name specified) */
2307     lparam_t       data;          /* data to store */
2308     VARARG(name,unicode_str);     /* property name */
2309 @END
2310
2311
2312 /* Remove a window property */
2313 @REQ(remove_window_property)
2314     user_handle_t  window;        /* handle to the window */
2315     atom_t         atom;          /* property atom (if no name specified) */
2316     VARARG(name,unicode_str);     /* property name */
2317 @REPLY
2318     lparam_t       data;          /* data stored in property */
2319 @END
2320
2321
2322 /* Get a window property */
2323 @REQ(get_window_property)
2324     user_handle_t  window;        /* handle to the window */
2325     atom_t         atom;          /* property atom (if no name specified) */
2326     VARARG(name,unicode_str);     /* property name */
2327 @REPLY
2328     lparam_t       data;          /* data stored in property */
2329 @END
2330
2331
2332 /* Get the list of properties of a window */
2333 @REQ(get_window_properties)
2334     user_handle_t  window;        /* handle to the window */
2335 @REPLY
2336     int            total;         /* total number of properties */
2337     VARARG(props,properties);     /* list of properties */
2338 @END
2339
2340
2341 /* Create a window station */
2342 @REQ(create_winstation)
2343     unsigned int flags;           /* window station flags */
2344     unsigned int access;          /* wanted access rights */
2345     unsigned int attributes;      /* object attributes */
2346     VARARG(name,unicode_str);     /* object name */
2347 @REPLY
2348     obj_handle_t handle;          /* handle to the window station */
2349 @END
2350
2351
2352 /* Open a handle to a window station */
2353 @REQ(open_winstation)
2354     unsigned int access;          /* wanted access rights */
2355     unsigned int attributes;      /* object attributes */
2356     VARARG(name,unicode_str);     /* object name */
2357 @REPLY
2358     obj_handle_t handle;          /* handle to the window station */
2359 @END
2360
2361
2362 /* Close a window station */
2363 @REQ(close_winstation)
2364     obj_handle_t handle;          /* handle to the window station */
2365 @END
2366
2367
2368 /* Get the process current window station */
2369 @REQ(get_process_winstation)
2370 @REPLY
2371     obj_handle_t handle;          /* handle to the window station */
2372 @END
2373
2374
2375 /* Set the process current window station */
2376 @REQ(set_process_winstation)
2377     obj_handle_t handle;          /* handle to the window station */
2378 @END
2379
2380
2381 /* Enumerate window stations */
2382 @REQ(enum_winstation)
2383     unsigned int index;           /* current index */
2384 @REPLY
2385     unsigned int next;            /* next index */
2386     VARARG(name,unicode_str);     /* window station name */
2387 @END
2388
2389
2390 /* Create a desktop */
2391 @REQ(create_desktop)
2392     unsigned int flags;           /* desktop flags */
2393     unsigned int access;          /* wanted access rights */
2394     unsigned int attributes;      /* object attributes */
2395     VARARG(name,unicode_str);     /* object name */
2396 @REPLY
2397     obj_handle_t handle;          /* handle to the desktop */
2398 @END
2399
2400
2401 /* Open a handle to a desktop */
2402 @REQ(open_desktop)
2403     obj_handle_t winsta;          /* window station to open (null allowed) */
2404     unsigned int flags;           /* desktop flags */
2405     unsigned int access;          /* wanted access rights */
2406     unsigned int attributes;      /* object attributes */
2407     VARARG(name,unicode_str);     /* object name */
2408 @REPLY
2409     obj_handle_t handle;          /* handle to the desktop */
2410 @END
2411
2412
2413 /* Close a desktop */
2414 @REQ(close_desktop)
2415     obj_handle_t handle;          /* handle to the desktop */
2416 @END
2417
2418
2419 /* Get the thread current desktop */
2420 @REQ(get_thread_desktop)
2421     thread_id_t  tid;             /* thread id */
2422 @REPLY
2423     obj_handle_t handle;          /* handle to the desktop */
2424 @END
2425
2426
2427 /* Set the thread current desktop */
2428 @REQ(set_thread_desktop)
2429     obj_handle_t handle;          /* handle to the desktop */
2430 @END
2431
2432
2433 /* Enumerate desktops */
2434 @REQ(enum_desktop)
2435     obj_handle_t winstation;      /* handle to the window station */
2436     unsigned int index;           /* current index */
2437 @REPLY
2438     unsigned int next;            /* next index */
2439     VARARG(name,unicode_str);     /* window station name */
2440 @END
2441
2442
2443 /* Get/set information about a user object (window station or desktop) */
2444 @REQ(set_user_object_info)
2445     obj_handle_t handle;          /* handle to the object */
2446     unsigned int flags;           /* information to set */
2447     unsigned int obj_flags;       /* new object flags */
2448 @REPLY
2449     int          is_desktop;      /* is object a desktop? */
2450     unsigned int old_obj_flags;   /* old object flags */
2451     VARARG(name,unicode_str);     /* object name */
2452 @END
2453 #define SET_USER_OBJECT_FLAGS 1
2454
2455
2456 /* Attach (or detach) thread inputs */
2457 @REQ(attach_thread_input)
2458     thread_id_t    tid_from;       /* thread to be attached */
2459     thread_id_t    tid_to;         /* thread to which tid_from should be attached */
2460     int            attach;         /* is it an attach? */
2461 @END
2462
2463
2464 /* Get input data for a given thread */
2465 @REQ(get_thread_input)
2466     thread_id_t    tid;           /* id of thread */
2467 @REPLY
2468     user_handle_t  focus;         /* handle to the focus window */
2469     user_handle_t  capture;       /* handle to the capture window */
2470     user_handle_t  active;        /* handle to the active window */
2471     user_handle_t  foreground;    /* handle to the global foreground window */
2472     user_handle_t  menu_owner;    /* handle to the menu owner */
2473     user_handle_t  move_size;     /* handle to the moving/resizing window */
2474     user_handle_t  caret;         /* handle to the caret window */
2475     rectangle_t    rect;          /* caret rectangle */
2476 @END
2477
2478
2479 /* Get the time of the last input event */
2480 @REQ(get_last_input_time)
2481 @REPLY
2482     unsigned int time;
2483 @END
2484
2485
2486 /* Retrieve queue keyboard state for a given thread */
2487 @REQ(get_key_state)
2488     thread_id_t    tid;           /* id of thread */
2489     int            key;           /* optional key code or -1 */
2490 @REPLY
2491     unsigned char  state;         /* state of specified key */
2492     VARARG(keystate,bytes);       /* state array for all the keys */
2493 @END
2494
2495 /* Set queue keyboard state for a given thread */
2496 @REQ(set_key_state)
2497     thread_id_t    tid;           /* id of thread */
2498     VARARG(keystate,bytes);       /* state array for all the keys */
2499 @END
2500
2501 /* Set the system foreground window */
2502 @REQ(set_foreground_window)
2503     user_handle_t  handle;        /* handle to the foreground window */
2504 @REPLY
2505     user_handle_t  previous;      /* handle to the previous foreground window */
2506     int            send_msg_old;  /* whether we have to send a msg to the old window */
2507     int            send_msg_new;  /* whether we have to send a msg to the new window */
2508 @END
2509
2510 /* Set the current thread focus window */
2511 @REQ(set_focus_window)
2512     user_handle_t  handle;        /* handle to the focus window */
2513 @REPLY
2514     user_handle_t  previous;      /* handle to the previous focus window */
2515 @END
2516
2517 /* Set the current thread active window */
2518 @REQ(set_active_window)
2519     user_handle_t  handle;        /* handle to the active window */
2520 @REPLY
2521     user_handle_t  previous;      /* handle to the previous active window */
2522 @END
2523
2524 /* Set the current thread capture window */
2525 @REQ(set_capture_window)
2526     user_handle_t  handle;        /* handle to the capture window */
2527     unsigned int   flags;         /* capture flags (see below) */
2528 @REPLY
2529     user_handle_t  previous;      /* handle to the previous capture window */
2530     user_handle_t  full_handle;   /* full 32-bit handle of new capture window */
2531 @END
2532 #define CAPTURE_MENU     0x01  /* capture is for a menu */
2533 #define CAPTURE_MOVESIZE 0x02  /* capture is for moving/resizing */
2534
2535
2536 /* Set the current thread caret window */
2537 @REQ(set_caret_window)
2538     user_handle_t  handle;        /* handle to the caret window */
2539     int            width;         /* caret width */
2540     int            height;        /* caret height */
2541 @REPLY
2542     user_handle_t  previous;      /* handle to the previous caret window */
2543     rectangle_t    old_rect;      /* previous caret rectangle */
2544     int            old_hide;      /* previous hide count */
2545     int            old_state;     /* previous caret state (1=on, 0=off) */
2546 @END
2547
2548
2549 /* Set the current thread caret information */
2550 @REQ(set_caret_info)
2551     unsigned int   flags;         /* caret flags (see below) */
2552     user_handle_t  handle;        /* handle to the caret window */
2553     int            x;             /* caret x position */
2554     int            y;             /* caret y position */
2555     int            hide;          /* increment for hide count (can be negative to show it) */
2556     int            state;         /* caret state (1=on, 0=off, -1=toggle current state) */
2557 @REPLY
2558     user_handle_t  full_handle;   /* handle to the current caret window */
2559     rectangle_t    old_rect;      /* previous caret rectangle */
2560     int            old_hide;      /* previous hide count */
2561     int            old_state;     /* previous caret state (1=on, 0=off) */
2562 @END
2563 #define SET_CARET_POS        0x01  /* set the caret position from x,y */
2564 #define SET_CARET_HIDE       0x02  /* increment the caret hide count */
2565 #define SET_CARET_STATE      0x04  /* set the caret on/off state */
2566
2567
2568 /* Set a window hook */
2569 @REQ(set_hook)
2570     int            id;             /* id of the hook */
2571     process_id_t   pid;            /* id of process to set the hook into */
2572     thread_id_t    tid;            /* id of thread to set the hook into */
2573     int            event_min;
2574     int            event_max;
2575     int            flags;
2576     void*          proc;           /* hook procedure */
2577     int            unicode;        /* is it a unicode hook? */
2578     VARARG(module,unicode_str);    /* module name */
2579 @REPLY
2580     user_handle_t  handle;         /* handle to the hook */
2581     unsigned int   active_hooks;   /* active hooks bitmap */
2582 @END
2583
2584
2585 /* Remove a window hook */
2586 @REQ(remove_hook)
2587     user_handle_t  handle;         /* handle to the hook */
2588     int            id;             /* id of the hook if handle is 0 */
2589     void*          proc;           /* hook procedure if handle is 0 */
2590 @REPLY
2591     unsigned int   active_hooks;   /* active hooks bitmap */
2592 @END
2593
2594
2595 /* Start calling a hook chain */
2596 @REQ(start_hook_chain)
2597     int            id;             /* id of the hook */
2598     int            event;          /* signalled event */
2599     user_handle_t  window;         /* handle to the event window */
2600     int            object_id;      /* object id for out of context winevent */
2601     int            child_id;       /* child id for out of context winevent */
2602 @REPLY
2603     user_handle_t  handle;         /* handle to the next hook */
2604     process_id_t   pid;            /* process id for low-level keyboard/mouse hooks */
2605     thread_id_t    tid;            /* thread id for low-level keyboard/mouse hooks */
2606     void*          proc;           /* hook procedure */
2607     int            unicode;        /* is it a unicode hook? */
2608     unsigned int   active_hooks;   /* active hooks bitmap */
2609     VARARG(module,unicode_str);    /* module name */
2610 @END
2611
2612
2613 /* Finished calling a hook chain */
2614 @REQ(finish_hook_chain)
2615     int            id;             /* id of the hook */
2616 @END
2617
2618
2619 /* Get the hook information */
2620 @REQ(get_hook_info)
2621     user_handle_t  handle;         /* handle to the current hook */
2622     int            get_next;       /* do we want info about current or next hook? */
2623     int            event;          /* signalled event */
2624     user_handle_t  window;         /* handle to the event window */
2625     int            object_id;      /* object id for out of context winevent */
2626     int            child_id;       /* child id for out of context winevent */
2627 @REPLY
2628     user_handle_t  handle;         /* handle to the hook */
2629     int            id;             /* id of the hook */
2630     process_id_t   pid;            /* process id for low-level keyboard/mouse hooks */
2631     thread_id_t    tid;            /* thread id for low-level keyboard/mouse hooks */
2632     void*          proc;           /* hook procedure */
2633     int            unicode;        /* is it a unicode hook? */
2634     VARARG(module,unicode_str);    /* module name */
2635 @END
2636
2637
2638 /* Create a window class */
2639 @REQ(create_class)
2640     int            local;          /* is it a local class? */
2641     atom_t         atom;           /* class atom */
2642     unsigned int   style;          /* class style */
2643     void*          instance;       /* module instance */
2644     int            extra;          /* number of extra class bytes */
2645     int            win_extra;      /* number of window extra bytes */
2646     void*          client_ptr;     /* pointer to class in client address space */
2647     VARARG(name,unicode_str);      /* class name */
2648 @REPLY
2649     atom_t         atom;           /* resulting class atom */
2650 @END
2651
2652
2653 /* Destroy a window class */
2654 @REQ(destroy_class)
2655     atom_t         atom;           /* class atom */
2656     void*          instance;       /* module instance */
2657     VARARG(name,unicode_str);      /* class name */
2658 @REPLY
2659     void*          client_ptr;     /* pointer to class in client address space */
2660 @END
2661
2662
2663 /* Set some information in a class */
2664 @REQ(set_class_info)
2665     user_handle_t  window;         /* handle to the window */
2666     unsigned int   flags;          /* flags for info to set (see below) */
2667     atom_t         atom;           /* class atom */
2668     unsigned int   style;          /* class style */
2669     int            win_extra;      /* number of window extra bytes */
2670     void*          instance;       /* module instance */
2671     int            extra_offset;   /* offset to set in extra bytes */
2672     data_size_t    extra_size;     /* size to set in extra bytes */
2673     lparam_t       extra_value;    /* value to set in extra bytes */
2674 @REPLY
2675     atom_t         old_atom;       /* previous class atom */
2676     unsigned int   old_style;      /* previous class style */
2677     int            old_extra;      /* previous number of class extra bytes */
2678     int            old_win_extra;  /* previous number of window extra bytes */
2679     void*          old_instance;   /* previous module instance */
2680     lparam_t       old_extra_value; /* old value in extra bytes */
2681 @END
2682 #define SET_CLASS_ATOM      0x0001
2683 #define SET_CLASS_STYLE     0x0002
2684 #define SET_CLASS_WINEXTRA  0x0004
2685 #define SET_CLASS_INSTANCE  0x0008
2686 #define SET_CLASS_EXTRA     0x0010
2687
2688
2689 /* Set/get clipboard information */
2690 @REQ(set_clipboard_info)
2691     unsigned int   flags;       /* flags for fields to set (see below) */
2692     user_handle_t  clipboard;   /* clipboard window */
2693     user_handle_t  owner;       /* clipboard owner */
2694     user_handle_t  viewer;      /* first clipboard viewer */
2695     unsigned int   seqno;       /* change sequence number */
2696 @REPLY
2697     unsigned int   flags;           /* status flags (see below) */
2698     user_handle_t  old_clipboard;   /* old clipboard window */
2699     user_handle_t  old_owner;       /* old clipboard owner */
2700     user_handle_t  old_viewer;      /* old clipboard viewer */
2701     unsigned int   seqno;           /* current sequence number */
2702 @END
2703
2704 #define SET_CB_OPEN      0x001
2705 #define SET_CB_OWNER     0x002
2706 #define SET_CB_VIEWER    0x004
2707 #define SET_CB_SEQNO     0x008
2708 #define SET_CB_RELOWNER  0x010
2709 #define SET_CB_CLOSE     0x020
2710 #define CB_OPEN          0x040
2711 #define CB_OWNER         0x080
2712 #define CB_PROCESS       0x100
2713
2714
2715 /* Open a security token */
2716 @REQ(open_token)
2717     obj_handle_t   handle;    /* handle to the thread or process */
2718     unsigned int   access;    /* access rights to the new token */
2719     unsigned int   attributes;/* object attributes */
2720     unsigned int   flags;     /* flags (see below) */
2721 @REPLY
2722     obj_handle_t   token;    /* handle to the token */
2723 @END
2724 #define OPEN_TOKEN_THREAD   1
2725 #define OPEN_TOKEN_AS_SELF  2
2726
2727
2728 /* Set/get the global windows */
2729 @REQ(set_global_windows)
2730     unsigned int   flags;               /* flags for fields to set (see below) */
2731     user_handle_t  shell_window;        /* handle to the new shell window */
2732     user_handle_t  shell_listview;      /* handle to the new shell listview window */
2733     user_handle_t  progman_window;      /* handle to the new program manager window */
2734     user_handle_t  taskman_window;      /* handle to the new task manager window */
2735 @REPLY
2736     user_handle_t  old_shell_window;    /* handle to the shell window */
2737     user_handle_t  old_shell_listview;  /* handle to the shell listview window */
2738     user_handle_t  old_progman_window;  /* handle to the new program manager window */
2739     user_handle_t  old_taskman_window;  /* handle to the new task manager window */
2740 @END
2741 #define SET_GLOBAL_SHELL_WINDOWS   0x01  /* set both main shell and listview windows */
2742 #define SET_GLOBAL_PROGMAN_WINDOW  0x02
2743 #define SET_GLOBAL_TASKMAN_WINDOW  0x04
2744
2745 /* Adjust the privileges held by a token */
2746 @REQ(adjust_token_privileges)
2747     obj_handle_t  handle; /* handle to the token */
2748     int           disable_all; /* disable all privileges? */
2749     int           get_modified_state; /* get modified privileges? */
2750     VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to enable/disable/remove */
2751 @REPLY
2752     unsigned int  len; /* total length in bytes required to store token privileges */
2753     VARARG(privileges,LUID_AND_ATTRIBUTES); /* modified privileges */
2754 @END
2755
2756 /* Retrieves the set of privileges held by or available to a token */
2757 @REQ(get_token_privileges)
2758     obj_handle_t  handle; /* handle to the token */
2759 @REPLY
2760     unsigned int  len; /* total length in bytes required to store token privileges */
2761     VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
2762 @END
2763
2764 /* Check the token has the required privileges */
2765 @REQ(check_token_privileges)
2766     obj_handle_t  handle; /* handle to the token */
2767     int           all_required; /* are all the privileges required for the check to succeed? */
2768     VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to check */
2769 @REPLY
2770     int           has_privileges; /* does the token have the required privileges? */
2771     VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
2772 @END
2773
2774 @REQ(duplicate_token)
2775     obj_handle_t  handle;        /* handle to the token to duplicate */
2776     unsigned int  access;        /* access rights to the new token */
2777     unsigned int  attributes;    /* object attributes */
2778     int           primary;       /* is the new token to be a primary one? */
2779     int           impersonation_level; /* impersonation level of the new token */
2780 @REPLY
2781     obj_handle_t  new_handle; /* duplicated handle */
2782 @END
2783
2784 @REQ(access_check)
2785     obj_handle_t    handle; /* handle to the token */
2786     unsigned int    desired_access; /* desired access to the object */
2787     unsigned int    mapping_read; /* mapping from generic read to specific rights */
2788     unsigned int    mapping_write; /* mapping from generic write to specific rights */
2789     unsigned int    mapping_execute; /* mapping from generic execute to specific rights */
2790     unsigned int    mapping_all; /* mapping from generic all to specific rights */
2791     VARARG(sd,security_descriptor); /* security descriptor to check */
2792 @REPLY
2793     unsigned int    access_granted; /* access rights actually granted */
2794     unsigned int    access_status; /* was access granted? */
2795     unsigned int    privileges_len; /* length needed to store privileges */
2796     VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges used during access check */
2797 @END
2798
2799 @REQ(get_token_user)
2800     obj_handle_t    handle;       /* handle to the token */
2801 @REPLY
2802     data_size_t     user_len;     /* length needed to store user */
2803     VARARG(user,SID);             /* sid of the user the token represents */
2804 @END
2805
2806 @REQ(get_token_groups)
2807     obj_handle_t    handle;       /* handle to the token */
2808 @REPLY
2809     data_size_t     user_len;     /* length needed to store user */
2810     VARARG(user,token_groups); /* groups the token's user belongs to */
2811 @END
2812
2813 @REQ(set_security_object)
2814     obj_handle_t    handle;       /* handle to the object */
2815     unsigned int    security_info; /* which parts of security descriptor to set */
2816     VARARG(sd,security_descriptor); /* security descriptor to set */
2817 @END
2818
2819 @REQ(get_security_object)
2820     obj_handle_t    handle;       /* handle to the object */
2821     unsigned int    security_info; /* which parts of security descriptor to get */
2822 @REPLY
2823     unsigned int    sd_len;         /* buffer size needed for sd */
2824     VARARG(sd,security_descriptor); /* retrieved security descriptor */
2825 @END
2826
2827 /* Create a mailslot */
2828 @REQ(create_mailslot)
2829     unsigned int   access;        /* wanted access rights */
2830     unsigned int   attributes;    /* object attributes */
2831     obj_handle_t   rootdir;       /* root directory */
2832     unsigned int   max_msgsize;
2833     timeout_t      read_timeout;
2834     VARARG(name,unicode_str);     /* mailslot name */
2835 @REPLY
2836     obj_handle_t   handle;        /* handle to the mailslot */
2837 @END
2838
2839
2840 /* Set mailslot information */
2841 @REQ(set_mailslot_info)
2842     obj_handle_t   handle;        /* handle to the mailslot */
2843     unsigned int   flags;
2844     timeout_t      read_timeout;
2845 @REPLY
2846     unsigned int   max_msgsize;
2847     timeout_t      read_timeout;
2848 @END
2849 #define MAILSLOT_SET_READ_TIMEOUT  1
2850
2851
2852 /* Create a directory object */
2853 @REQ(create_directory)
2854     unsigned int   access;        /* access flags */
2855     unsigned int   attributes;    /* object attributes */
2856     obj_handle_t   rootdir;       /* root directory */
2857     VARARG(directory_name,unicode_str); /* Directory name */
2858 @REPLY
2859     obj_handle_t   handle;        /* handle to the directory */
2860 @END
2861
2862
2863 /* Open a directory object */
2864 @REQ(open_directory)
2865     unsigned int   access;        /* access flags */
2866     unsigned int   attributes;    /* object attributes */
2867     obj_handle_t   rootdir;       /* root directory */
2868     VARARG(directory_name,unicode_str); /* Directory name */
2869 @REPLY
2870     obj_handle_t   handle;        /* handle to the directory */
2871 @END
2872
2873
2874 /* Get a directory entry by index */
2875 @REQ(get_directory_entry)
2876     obj_handle_t   handle;             /* handle to the directory */
2877     unsigned int   index;              /* entry index */
2878 @REPLY
2879     data_size_t    name_len;           /* length of the entry name in bytes */
2880     VARARG(name,unicode_str,name_len); /* entry name */
2881     VARARG(type,unicode_str);          /* entry type */
2882 @END
2883
2884
2885 /* Create a symbolic link object */
2886 @REQ(create_symlink)
2887     unsigned int   access;        /* access flags */
2888     unsigned int   attributes;    /* object attributes */
2889     obj_handle_t   rootdir;       /* root directory */
2890     data_size_t    name_len;      /* length of the symlink name in bytes */
2891     VARARG(name,unicode_str,name_len); /* symlink name */
2892     VARARG(target_name,unicode_str);   /* target name */
2893 @REPLY
2894     obj_handle_t   handle;        /* handle to the symlink */
2895 @END
2896
2897
2898 /* Open a symbolic link object */
2899 @REQ(open_symlink)
2900     unsigned int   access;        /* access flags */
2901     unsigned int   attributes;    /* object attributes */
2902     obj_handle_t   rootdir;       /* root directory */
2903     VARARG(name,unicode_str);     /* symlink name */
2904 @REPLY
2905     obj_handle_t   handle;        /* handle to the symlink */
2906 @END
2907
2908
2909 /* Query a symbolic link object */
2910 @REQ(query_symlink)
2911     obj_handle_t   handle;        /* handle to the symlink */
2912 @REPLY
2913     VARARG(target_name,unicode_str); /* target name */
2914 @END
2915
2916
2917 /* Query basic object information */
2918 @REQ(get_object_info)
2919     obj_handle_t   handle;        /* handle to the object */
2920 @REPLY
2921     unsigned int   access;        /* granted access mask */
2922     unsigned int   ref_count;     /* object ref count */
2923 @END
2924
2925
2926 /* Unlink a named object */
2927 @REQ(unlink_object)
2928     obj_handle_t   handle;        /* handle to the object */
2929 @END
2930
2931
2932 /* Query the impersonation level of an impersonation token */
2933 @REQ(get_token_impersonation_level)
2934     obj_handle_t   handle;        /* handle to the object */
2935 @REPLY
2936     int            impersonation_level; /* impersonation level of the impersonation token */
2937 @END
2938
2939 /* Allocate a locally-unique identifier */
2940 @REQ(allocate_locally_unique_id)
2941 @REPLY
2942     luid_t         luid;
2943 @END
2944
2945
2946 /* Create a device manager */
2947 @REQ(create_device_manager)
2948     unsigned int access;          /* wanted access rights */
2949     unsigned int attributes;      /* object attributes */
2950 @REPLY
2951     obj_handle_t handle;          /* handle to the device */
2952 @END
2953
2954
2955 /* Create a device */
2956 @REQ(create_device)
2957     unsigned int access;          /* wanted access rights */
2958     unsigned int attributes;      /* object attributes */
2959     obj_handle_t rootdir;         /* root directory */
2960     obj_handle_t manager;         /* device manager */
2961     void*        user_ptr;        /* opaque ptr for use by client */
2962     VARARG(name,unicode_str);     /* object name */
2963 @REPLY
2964     obj_handle_t handle;          /* handle to the device */
2965 @END
2966
2967
2968 /* Delete a device */
2969 @REQ(delete_device)
2970     obj_handle_t handle;          /* handle to the device */
2971 @END
2972
2973
2974 /* Retrieve the next pending device ioctl request */
2975 @REQ(get_next_device_request)
2976     obj_handle_t manager;         /* handle to the device manager */
2977     obj_handle_t prev;            /* handle to the previous ioctl */
2978     unsigned int status;          /* status of the previous ioctl */
2979     VARARG(prev_data,bytes);      /* output data of the previous ioctl */
2980 @REPLY
2981     obj_handle_t next;            /* handle to the next ioctl */
2982     ioctl_code_t code;            /* ioctl code */
2983     void*        user_ptr;        /* opaque ptr for the device */
2984     data_size_t  in_size;         /* total needed input size */
2985     data_size_t  out_size;        /* needed output size */
2986     VARARG(next_data,bytes);      /* input data of the next ioctl */
2987 @END
2988
2989
2990 /* Make the current process a system process */
2991 @REQ(make_process_system)
2992 @REPLY
2993     obj_handle_t event;           /* event signaled when all user processes have exited */
2994 @END
2995
2996
2997 /* Get detailed fixed-size information about a token */
2998 @REQ(get_token_statistics)
2999     obj_handle_t   handle;        /* handle to the object */
3000 @REPLY
3001     luid_t         token_id;      /* locally-unique identifier of the token */
3002     luid_t         modified_id;   /* locally-unique identifier of the modified version of the token */
3003     int            primary;       /* is the token primary or impersonation? */
3004     int            impersonation_level; /* level of impersonation */
3005     int            group_count;   /* the number of groups the token is a member of */
3006     int            privilege_count; /* the number of privileges the token has */
3007 @END
3008
3009
3010 /* Create I/O completion port */
3011 @REQ(create_completion)
3012     unsigned int access;          /* desired access to a port */
3013     unsigned int attributes;      /* object attributes */
3014     unsigned int concurrent;      /* max number of concurrent active threads */
3015     obj_handle_t rootdir;         /* root directory */
3016     VARARG(filename,string);      /* port name */
3017 @REPLY
3018     obj_handle_t handle;          /* port handle */
3019 @END
3020
3021
3022 /* Open I/O completion port */
3023 @REQ(open_completion)
3024     unsigned int access;          /* desired access to a port */
3025     unsigned int attributes;      /* object attributes */
3026     obj_handle_t rootdir;         /* root directory */
3027     VARARG(filename,string);      /* port name */
3028 @REPLY
3029     obj_handle_t handle;          /* port handle */
3030 @END
3031
3032
3033 /* add completion to completion port */
3034 @REQ(add_completion)
3035     obj_handle_t  handle;         /* port handle */
3036     apc_param_t   ckey;           /* completion key */
3037     apc_param_t   cvalue;         /* completion value */
3038     unsigned int  information;    /* IO_STATUS_BLOCK Information */
3039     unsigned int  status;         /* completion result */
3040 @END
3041
3042
3043 /* get completion from completion port queue */
3044 @REQ(remove_completion)
3045     obj_handle_t handle;          /* port handle */
3046 @REPLY
3047     apc_param_t   ckey;           /* completion key */
3048     apc_param_t   cvalue;         /* completion value */
3049     unsigned int  information;    /* IO_STATUS_BLOCK Information */
3050     unsigned int  status;         /* completion result */
3051 @END
3052
3053
3054 /* get completion queue depth */
3055 @REQ(query_completion)
3056     obj_handle_t  handle;         /* port handle */
3057 @REPLY
3058     unsigned int  depth;          /* completion queue depth */
3059 @END
3060
3061
3062 /* associate object with completion port */
3063 @REQ(set_completion_info)
3064     obj_handle_t  handle;         /* object handle */
3065     obj_handle_t  chandle;        /* port handle */
3066     apc_param_t   ckey;           /* completion key */
3067 @END
3068
3069
3070 /* check for associated completion and push msg */
3071 @REQ(add_fd_completion)
3072     obj_handle_t   handle;        /* async' object */
3073     apc_param_t    cvalue;        /* completion value */
3074     unsigned int   status;        /* completion status */
3075     unsigned int   information;   /* IO_STATUS_BLOCK Information */
3076 @END
3077
3078
3079 /* Retrieve layered info for a window */
3080 @REQ(get_window_layered_info)
3081     user_handle_t  handle;        /* handle to the window */
3082 @REPLY
3083     unsigned int   color_key;     /* color key */
3084     unsigned int   alpha;         /* alpha (0..255) */
3085     unsigned int   flags;         /* LWA_* flags */
3086 @END
3087
3088
3089 /* Set layered info for a window */
3090 @REQ(set_window_layered_info)
3091     user_handle_t  handle;        /* handle to the window */
3092     unsigned int   color_key;     /* color key */
3093     unsigned int   alpha;         /* alpha (0..255) */
3094     unsigned int   flags;         /* LWA_* flags */
3095 @END