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