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