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