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