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