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