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