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