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