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