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