~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/server/protocol.def

Version: ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /* -*- C -*-
  2  *
  3  * Wine server protocol definition
  4  *
  5  * Copyright (C) 2001 Alexandre Julliard
  6  *
  7  * This file is used by tools/make_requests to build the
  8  * protocol structures in include/wine/server_protocol.h
  9  *
 10  * This library is free software; you can redistribute it and/or
 11  * modify it under the terms of the GNU Lesser General Public
 12  * License as published by the Free Software Foundation; either
 13  * version 2.1 of the License, or (at your option) any later version.
 14  *
 15  * This library is distributed in the hope that it will be useful,
 16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18  * Lesser General Public License for more details.
 19  *
 20  * You should have received a copy of the GNU Lesser General Public
 21  * License along with this library; if not, write to the Free Software
 22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 23  */
 24 
 25 @HEADER  /* start of C declarations */
 26 
 27 #include <stdarg.h>
 28 #include <stdlib.h>
 29 #include <time.h>
 30 
 31 #include <windef.h>
 32 #include <winbase.h>
 33 
 34 typedef void *obj_handle_t;
 35 typedef void *user_handle_t;
 36 typedef unsigned short atom_t;
 37 typedef unsigned int process_id_t;
 38 typedef unsigned int thread_id_t;
 39 typedef unsigned int data_size_t;
 40 typedef unsigned int ioctl_code_t;
 41 typedef unsigned __int64 file_pos_t;
 42 
 43 struct request_header
 44 {
 45     int          req;          /* request code */
 46     data_size_t  request_size; /* request variable part size */
 47     data_size_t  reply_size;   /* reply variable part maximum size */
 48 };
 49 
 50 struct reply_header
 51 {
 52     unsigned int error;        /* error result */
 53     data_size_t  reply_size;   /* reply variable part size */
 54 };
 55 
 56 /* placeholder structure for the maximum allowed request size */
 57 /* this is used to construct the generic_request union */
 58 struct request_max_size
 59 {
 60     int pad[16]; /* the max request size is 16 ints */
 61 };
 62 
 63 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
 64 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
 65 
 66 
 67 /* definitions of the event data depending on the event code */
 68 struct debug_event_exception
 69 {
 70     EXCEPTION_RECORD record;   /* exception record */
 71     int              first;    /* first chance exception? */
 72 };
 73 struct debug_event_create_thread
 74 {
 75     obj_handle_t handle;     /* handle to the new thread */
 76     void        *teb;        /* thread teb (in debugged process address space) */
 77     void        *start;      /* thread startup routine */
 78 };
 79 struct debug_event_create_process
 80 {
 81     obj_handle_t file;       /* handle to the process exe file */
 82     obj_handle_t process;    /* handle to the new process */
 83     obj_handle_t thread;     /* handle to the new thread */
 84     void        *base;       /* base of executable image */
 85     int          dbg_offset; /* offset of debug info in file */
 86     int          dbg_size;   /* size of debug info */
 87     void        *teb;        /* thread teb (in debugged process address space) */
 88     void        *start;      /* thread startup routine */
 89     void        *name;       /* image name (optional) */
 90     int          unicode;    /* is it Unicode? */
 91 };
 92 struct debug_event_exit
 93 {
 94     int          exit_code;  /* thread or process exit code */
 95 };
 96 struct debug_event_load_dll
 97 {
 98     obj_handle_t handle;     /* file handle for the dll */
 99     void        *base;       /* base address of the dll */
100     int          dbg_offset; /* offset of debug info in file */
101     int          dbg_size;   /* size of debug info */
102     void        *name;       /* image name (optional) */
103     int          unicode;    /* is it Unicode? */
104 };
105 struct debug_event_unload_dll
106 {
107     void       *base;       /* base address of the dll */
108 };
109 struct debug_event_output_string
110 {
111     void       *string;     /* string to display (in debugged process address space) */
112     int         unicode;    /* is it Unicode? */
113     int         length;     /* string length */
114 };
115 struct debug_event_rip_info
116 {
117     int         error;      /* ??? */
118     int         type;       /* ??? */
119 };
120 union debug_event_data
121 {
122     struct debug_event_exception      exception;
123     struct debug_event_create_thread  create_thread;
124     struct debug_event_create_process create_process;
125     struct debug_event_exit           exit;
126     struct debug_event_load_dll       load_dll;
127     struct debug_event_unload_dll     unload_dll;
128     struct debug_event_output_string  output_string;
129     struct debug_event_rip_info       rip_info;
130 };
131 
132 /* debug event data */
133 typedef struct
134 {
135     int                      code;   /* event code */
136     union debug_event_data   info;   /* event information */
137 } debug_event_t;
138 
139 /* structure used in sending an fd from client to server */
140 struct send_fd
141 {
142     thread_id_t tid;  /* thread id */
143     int         fd;   /* file descriptor on client-side */
144 };
145 
146 /* structure sent by the server on the wait fifo */
147 struct wake_up_reply
148 {
149     void *cookie;    /* magic cookie that was passed in select_request */
150     int   signaled;  /* wait result */
151 };
152 
153 /* NT-style timeout, in 100ns units, negative means relative timeout */
154 typedef __int64 timeout_t;
155 #define TIMEOUT_INFINITE (((timeout_t)0x7fffffff) << 32 | 0xffffffff)
156 
157 /* structure returned in the list of window properties */
158 typedef struct
159 {
160     atom_t         atom;     /* property atom */
161     short          string;   /* was atom a string originally? */
162     obj_handle_t   handle;   /* handle stored in property */
163 } property_data_t;
164 
165 /* structure to specify window rectangles */
166 typedef struct
167 {
168     int  left;
169     int  top;
170     int  right;
171     int  bottom;
172 } rectangle_t;
173 
174 /* structure for parameters of async I/O calls */
175 typedef struct
176 {
177     void           *callback;      /* client-side callback to call upon end of async */
178     void           *iosb;          /* I/O status block in client addr space */
179     void           *arg;           /* opaque user data to pass to callback */
180     void           *apc;           /* user apc to call */
181     obj_handle_t    event;         /* event to signal when done */
182     unsigned long   cvalue;        /* completion value to use for completion events */
183 } async_data_t;
184 
185 /* structures for extra message data */
186 
187 struct callback_msg_data
188 {
189     void           *callback;   /* callback function */
190     unsigned long   data;       /* user data for callback */
191     unsigned long   result;     /* message result */
192 };
193 
194 struct winevent_msg_data
195 {
196     user_handle_t   hook;       /* hook handle */
197     thread_id_t     tid;        /* thread id */
198     void           *hook_proc;  /* hook proc address */
199     /* followed by module name if any */
200 };
201 
202 typedef union
203 {
204     unsigned char            bytes[1];   /* raw data for sent messages */
205     struct callback_msg_data callback;
206     struct winevent_msg_data winevent;
207 } message_data_t;
208 
209 /* structure for console char/attribute info */
210 typedef struct
211 {
212     WCHAR          ch;
213     unsigned short attr;
214 } char_info_t;
215 
216 typedef struct
217 {
218     unsigned int low_part;
219     int          high_part;
220 } luid_t;
221 
222 #define MAX_ACL_LEN 65535
223 
224 struct security_descriptor
225 {
226     unsigned int control;       /* SE_ flags */
227     data_size_t  owner_len;
228     data_size_t  group_len;
229     data_size_t  sacl_len;
230     data_size_t  dacl_len;
231     /* VARARG(owner,SID); */
232     /* VARARG(group,SID); */
233     /* VARARG(sacl,ACL); */
234     /* VARARG(dacl,ACL); */
235 };
236 
237 struct object_attributes
238 {
239     obj_handle_t rootdir; /* root directory */
240     data_size_t sd_len;   /* length of security_descriptor data. may be 0 */
241     data_size_t name_len; /* length of the name string. may be 0 */
242     /* VARARG(sd,security_descriptor); */
243     /* VARARG(name,unicode_str); */
244 };
245 
246 struct token_groups
247 {
248     unsigned int count;
249     /* unsigned int attributes[count]; */
250     /* VARARG(sids,SID); */
251 };
252 
253 enum apc_type
254 {
255     APC_NONE,
256     APC_USER,
257     APC_TIMER,
258     APC_ASYNC_IO,
259     APC_VIRTUAL_ALLOC,
260     APC_VIRTUAL_FREE,
261     APC_VIRTUAL_QUERY,
262     APC_VIRTUAL_PROTECT,
263     APC_VIRTUAL_FLUSH,
264     APC_VIRTUAL_LOCK,
265     APC_VIRTUAL_UNLOCK,
266     APC_MAP_VIEW,
267     APC_UNMAP_VIEW,
268     APC_CREATE_THREAD
269 };
270 
271 typedef union
272 {
273     enum apc_type type;
274     struct
275     {
276         enum apc_type    type;     /* APC_USER */
277         void (__stdcall *func)(unsigned long,unsigned long,unsigned long);
278         unsigned long    args[3];  /* arguments for user function */
279     } user;
280     struct
281     {
282         enum apc_type   type;     /* APC_TIMER */
283         void (__stdcall *func)(void*, unsigned int, unsigned int);
284         timeout_t        time;     /* absolute time of expiration */
285         void            *arg;      /* user argument */
286     } timer;
287     struct
288     {
289         enum apc_type    type;     /* APC_ASYNC_IO */
290         unsigned int   (*func)(void*, void*, unsigned int, unsigned long *);
291         void            *user;     /* user pointer */
292         void            *sb;       /* status block */
293         unsigned int     status;   /* I/O status */
294     } async_io;
295     struct
296     {
297         enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
298         void            *addr;      /* requested address */
299         unsigned long    size;      /* allocation size */
300         unsigned int     zero_bits; /* allocation alignment */
301         unsigned int     op_type;   /* type of operation */
302         unsigned int     prot;      /* memory protection flags */
303     } virtual_alloc;
304     struct
305     {
306         enum apc_type    type;      /* APC_VIRTUAL_FREE */
307         void            *addr;      /* requested address */
308         unsigned long    size;      /* allocation size */
309         unsigned int     op_type;   /* type of operation */
310     } virtual_free;
311     struct
312     {
313         enum apc_type    type;      /* APC_VIRTUAL_QUERY */
314         const void      *addr;      /* requested address */
315     } virtual_query;
316     struct
317     {
318         enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
319         void            *addr;      /* requested address */
320         unsigned long    size;      /* requested address */
321         unsigned int     prot;      /* new protection flags */
322     } virtual_protect;
323     struct
324     {
325         enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
326         const void      *addr;      /* requested address */
327         unsigned long    size;      /* requested address */
328     } virtual_flush;
329     struct
330     {
331         enum apc_type    type;      /* APC_VIRTUAL_LOCK */
332         void            *addr;      /* requested address */
333         unsigned long    size;      /* requested address */
334     } virtual_lock;
335     struct
336     {
337         enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
338         void            *addr;      /* requested address */
339         unsigned long    size;      /* requested address */
340     } virtual_unlock;
341     struct
342     {
343         enum apc_type    type;      /* APC_MAP_VIEW */
344         obj_handle_t     handle;    /* mapping handle */
345         void            *addr;      /* requested address */
346         unsigned long    size;      /* allocation size */
347         file_pos_t       offset;    /* file offset */
348         unsigned int     zero_bits; /* allocation alignment */
349         unsigned int     alloc_type;/* allocation type */
350         unsigned int     prot;      /* memory protection flags */
351     } map_view;
352     struct
353     {
354         enum apc_type    type;      /* APC_UNMAP_VIEW */
355         void            *addr;      /* view address */
356     } unmap_view;
357     struct
358     {
359         enum apc_type    type;      /* APC_CREATE_THREAD */
360         void (__stdcall *func)(void*);  /* start function */
361         void            *arg;       /* argument for start function */
362         unsigned long    reserve;   /* reserve size for thread stack */
363         unsigned long    commit;    /* commit size for thread stack */
364         int              suspend;   /* suspended thread? */
365     } create_thread;
366 } apc_call_t;
367 
368 typedef union
369 {
370     enum apc_type type;
371     struct
372     {
373         enum apc_type    type;      /* APC_ASYNC_IO */
374         unsigned int     status;    /* new status of async operation */
375         unsigned long    total;     /* bytes transferred */
376     } async_io;
377     struct
378     {
379         enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
380         unsigned int     status;    /* status returned by call */
381         void            *addr;      /* resulting address */
382         unsigned long    size;      /* resulting size */
383     } virtual_alloc;
384     struct
385     {
386         enum apc_type    type;      /* APC_VIRTUAL_FREE */
387         unsigned int     status;    /* status returned by call */
388         void            *addr;      /* resulting address */
389         unsigned long    size;      /* resulting size */
390     } virtual_free;
391     struct
392     {
393         enum apc_type    type;      /* APC_VIRTUAL_QUERY */
394         unsigned int     status;    /* status returned by call */
395         void            *base;      /* resulting base address */
396         void            *alloc_base;/* resulting allocation base */
397         unsigned long    size;      /* resulting region size */
398         unsigned int     state;     /* resulting region state */
399         unsigned int     prot;      /* resulting region protection */
400         unsigned int     alloc_prot;/* resulting allocation protection */
401         unsigned int     alloc_type;/* resulting region allocation type */
402     } virtual_query;
403     struct
404     {
405         enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
406         unsigned int     status;    /* status returned by call */
407         void            *addr;      /* resulting address */
408         unsigned long    size;      /* resulting size */
409         unsigned int     prot;      /* old protection flags */
410     } virtual_protect;
411     struct
412     {
413         enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
414         unsigned int     status;    /* status returned by call */
415         const void      *addr;      /* resulting address */
416         unsigned long    size;      /* resulting size */
417     } virtual_flush;
418     struct
419     {
420         enum apc_type    type;      /* APC_VIRTUAL_LOCK */
421         unsigned int     status;    /* status returned by call */
422         void            *addr;      /* resulting address */
423         unsigned long    size;      /* resulting size */
424     } virtual_lock;
425     struct
426     {
427         enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
428         unsigned int     status;    /* status returned by call */
429         void            *addr;      /* resulting address */
430         unsigned long    size;      /* resulting size */
431     } virtual_unlock;
432     struct
433     {
434         enum apc_type    type;      /* APC_MAP_VIEW */
435         unsigned int     status;    /* status returned by call */
436         void            *addr;      /* resulting address */
437         unsigned long    size;      /* resulting size */
438     } map_view;
439     struct
440     {
441         enum apc_type    type;      /* APC_MAP_VIEW */
442         unsigned int     status;    /* status returned by call */
443     } unmap_view;
444     struct
445     {
446         enum apc_type    type;      /* APC_CREATE_THREAD */
447         unsigned int     status;    /* status returned by call */
448         thread_id_t      tid;       /* thread id */
449         obj_handle_t     handle;    /* handle to new thread */
450     } create_thread;
451 } apc_result_t;
452 
453 /****************************************************************/
454 /* Request declarations */
455 
456 /* Create a new process from the context of the parent */
457 @REQ(new_process)
458     int          inherit_all;    /* inherit all handles from parent */
459     unsigned int create_flags;   /* creation flags */
460     int          socket_fd;      /* file descriptor for process socket */
461     obj_handle_t exe_file;       /* file handle for main exe */
462     obj_handle_t hstdin;         /* handle for stdin */
463     obj_handle_t hstdout;        /* handle for stdout */
464     obj_handle_t hstderr;        /* handle for stderr */
465     unsigned int process_access; /* access rights for process object */
466     unsigned int process_attr;   /* attributes for process object */
467     unsigned int thread_access;  /* access rights for thread object */
468     unsigned int thread_attr;    /* attributes for thread object */
469     VARARG(info,startup_info);   /* startup information */
470     VARARG(env,unicode_str);     /* environment for new process */
471 @REPLY
472     obj_handle_t info;           /* new process info handle */
473     process_id_t pid;            /* process id */
474     obj_handle_t phandle;        /* process handle (in the current process) */
475     thread_id_t  tid;            /* thread id */
476     obj_handle_t thandle;        /* thread handle (in the current process) */
477 @END
478 
479 
480 /* Retrieve information about a newly started process */
481 @REQ(get_new_process_info)
482     obj_handle_t info;           /* info handle returned from new_process_request */
483 @REPLY
484     int          success;      /* did the process start successfully? */
485     int          exit_code;    /* process exit code if failed */
486 @END
487 
488 
489 /* Create a new thread from the context of the parent */
490 @REQ(new_thread)
491     unsigned int access;       /* wanted access rights */
492     unsigned int attributes;   /* object attributes */
493     int          suspend;      /* new thread should be suspended on creation */
494     int          request_fd;   /* fd for request pipe */
495 @REPLY
496     thread_id_t  tid;          /* thread id */
497     obj_handle_t handle;       /* thread handle (in the current process) */
498 @END
499 
500 
501 /* Retrieve the new process startup info */
502 @REQ(get_startup_info)
503 @REPLY
504     obj_handle_t exe_file;     /* file handle for main exe */
505     obj_handle_t hstdin;       /* handle for stdin */
506     obj_handle_t hstdout;      /* handle for stdout */
507     obj_handle_t hstderr;      /* handle for stderr */
508     VARARG(info,startup_info); /* startup information */
509     VARARG(env,unicode_str);   /* environment */
510 @END
511 
512 
513 /* Signal the end of the process initialization */
514 @REQ(init_process_done)
515     void*        module;       /* main module base address */
516     void*        entry;        /* process entry point */
517     int          gui;          /* is it a GUI process? */
518 @END
519 
520 
521 /* Initialize a thread; called from the child after fork()/clone() */
522 @REQ(init_thread)
523     int          unix_pid;     /* Unix pid of new thread */
524     int          unix_tid;     /* Unix tid of new thread */
525     int          debug_level;  /* new debug level */
526     void*        teb;          /* TEB of new thread (in thread address space) */
527     void*        peb;          /* address of PEB (in thread address space) */
528     void*        entry;        /* thread entry point (in thread address space) */
529     void*        ldt_copy;     /* address of LDT copy (in thread address space) */
530     int          reply_fd;     /* fd for reply pipe */
531     int          wait_fd;      /* fd for blocking calls pipe */
532 @REPLY
533     process_id_t pid;          /* process id of the new thread's process */
534     thread_id_t  tid;          /* thread id of the new thread */
535     data_size_t  info_size;    /* total size of startup info */
536     timeout_t    server_start; /* server start time */
537     int          version;      /* protocol version */
538 @END
539 
540 
541 /* Terminate a process */
542 @REQ(terminate_process)
543     obj_handle_t handle;       /* process handle to terminate */
544     int          exit_code;    /* process exit code */
545 @REPLY
546     int          self;         /* suicide? */
547 @END
548 
549 
550 /* Terminate a thread */
551 @REQ(terminate_thread)
552     obj_handle_t handle;       /* thread handle to terminate */
553     int          exit_code;    /* thread exit code */
554 @REPLY
555     int          self;         /* suicide? */
556     int          last;         /* last thread in this process? */
557 @END
558 
559 
560 /* Retrieve information about a process */
561 @REQ(get_process_info)
562     obj_handle_t handle;           /* process handle */
563 @REPLY
564     process_id_t pid;              /* server process id */
565     process_id_t ppid;             /* server process id of parent */
566     int          exit_code;        /* process exit code */
567     int          priority;         /* priority class */
568     unsigned int affinity;         /* process affinity mask */
569     void*        peb;              /* PEB address in process address space */
570     timeout_t    start_time;       /* process start time */
571     timeout_t    end_time;         /* process end time */
572 @END
573 
574 
575 /* Set a process informations */
576 @REQ(set_process_info)
577     obj_handle_t handle;       /* process handle */
578     int          mask;         /* setting mask (see below) */
579     int          priority;     /* priority class */
580     unsigned int affinity;     /* affinity mask */
581 @END
582 #define SET_PROCESS_INFO_PRIORITY 0x01
583 #define SET_PROCESS_INFO_AFFINITY 0x02
584 
585 
586 /* Retrieve information about a thread */
587 @REQ(get_thread_info)
588     obj_handle_t handle;        /* thread handle */
589     thread_id_t  tid_in;        /* thread id (optional) */
590 @REPLY
591     process_id_t pid;           /* server process id */
592     thread_id_t  tid;           /* server thread id */
593     void*        teb;           /* thread teb pointer */
594     int          exit_code;     /* thread exit code */
595     int          priority;      /* thread priority level */
596     unsigned int affinity;      /* thread affinity mask */
597     timeout_t    creation_time; /* thread creation time */
598     timeout_t    exit_time;     /* thread exit time */
599     int          last;          /* last thread in process */
600 @END
601 
602 
603 /* Set a thread informations */
604 @REQ(set_thread_info)
605     obj_handle_t handle;       /* thread handle */
606     int          mask;         /* setting mask (see below) */
607     int          priority;     /* priority class */
608     unsigned int affinity;     /* affinity mask */
609     obj_handle_t token;        /* impersonation token */
610 @END
611 #define SET_THREAD_INFO_PRIORITY 0x01
612 #define SET_THREAD_INFO_AFFINITY 0x02
613 #define SET_THREAD_INFO_TOKEN    0x04
614 
615 
616 /* Retrieve information about a module */
617 @REQ(get_dll_info)
618     obj_handle_t handle;       /* process handle */
619     void*        base_address; /* base address of module */
620 @REPLY
621     size_t       size;          /* module size */
622     void*        entry_point;
623     data_size_t  filename_len;    /* buffer len in bytes required to store filename */
624     VARARG(filename,unicode_str); /* file name of module */
625 @END
626 
627 
628 /* Suspend a thread */
629 @REQ(suspend_thread)
630     obj_handle_t handle;       /* thread handle */
631 @REPLY
632     int          count;        /* new suspend count */
633 @END
634 
635 
636 /* Resume a thread */
637 @REQ(resume_thread)
638     obj_handle_t handle;       /* thread handle */
639 @REPLY
640     int          count;        /* new suspend count */
641 @END
642 
643 
644 /* Notify the server that a dll has been loaded */
645 @REQ(load_dll)
646     obj_handle_t handle;       /* file handle */
647     void*        base;         /* base address */
648     size_t       size;         /* dll size */
649     int          dbg_offset;   /* debug info offset */
650     int          dbg_size;     /* debug info size */
651     void*        name;         /* ptr to ptr to name (in process addr space) */
652     VARARG(filename,unicode_str); /* file name of dll */
653 @END
654 
655 
656 /* Notify the server that a dll is being unloaded */
657 @REQ(unload_dll)
658     void*        base;         /* base address */
659 @END
660 
661 
662 /* Queue an APC for a thread or process */
663 @REQ(queue_apc)
664     obj_handle_t thread;       /* thread handle */
665     obj_handle_t process;      /* process handle */
666     apc_call_t   call;         /* call arguments */
667 @REPLY
668     obj_handle_t handle;       /* APC handle */
669     int          self;         /* run APC in caller itself? */
670 @END
671 
672 
673 /* Get the result of an APC call */
674 @REQ(get_apc_result)
675     obj_handle_t handle;       /* handle to the APC */
676 @REPLY
677     apc_result_t result;       /* result of the APC */
678 @END
679 
680 
681 /* Close a handle for the current process */
682 @REQ(close_handle)
683     obj_handle_t handle;       /* handle to close */
684 @END
685 
686 
687 /* Set a handle information */
688 @REQ(set_handle_info)
689     obj_handle_t handle;       /* handle we are interested in */
690     int          flags;        /* new handle flags */
691     int          mask;         /* mask for flags to set */
692 @REPLY
693     int          old_flags;    /* old flag value */
694 @END
695 
696 
697 /* Duplicate a handle */
698 @REQ(dup_handle)
699     obj_handle_t src_process;  /* src process handle */
700     obj_handle_t src_handle;   /* src handle to duplicate */
701     obj_handle_t dst_process;  /* dst process handle */
702     unsigned int access;       /* wanted access rights */
703     unsigned int attributes;   /* object attributes */
704     unsigned int options;      /* duplicate options (see below) */
705 @REPLY
706     obj_handle_t handle;       /* duplicated handle in dst process */
707     int          self;         /* is the source the current process? */
708     int          closed;       /* whether the source handle has been closed */
709 @END
710 #define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
711 #define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
712 #define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */
713 
714 
715 /* Open a handle to a process */
716 @REQ(open_process)
717     process_id_t pid;          /* process id to open */
718     unsigned int access;       /* wanted access rights */
719     unsigned int attributes;   /* object attributes */
720 @REPLY
721     obj_handle_t handle;       /* handle to the process */
722 @END
723 
724 
725 /* Open a handle to a thread */
726 @REQ(open_thread)
727     thread_id_t  tid;          /* thread id to open */
728     unsigned int access;       /* wanted access rights */
729     unsigned int attributes;   /* object attributes */
730 @REPLY
731     obj_handle_t handle;       /* handle to the thread */
732 @END
733 
734 
735 /* Wait for handles */
736 @REQ(select)
737     int          flags;        /* wait flags (see below) */
738     void*        cookie;       /* magic cookie to return to client */
739     obj_handle_t signal;       /* object to signal (0 if none) */
740     obj_handle_t prev_apc;     /* handle to previous APC */
741     timeout_t    timeout;      /* timeout */
742     VARARG(result,apc_result); /* result of previous APC */
743     VARARG(handles,handles);   /* handles to select on */
744 @REPLY
745     obj_handle_t apc_handle;   /* handle to next APC */
746     timeout_t    timeout;      /* timeout converted to absolute */
747     apc_call_t   call;         /* APC call arguments */
748 @END
749 #define SELECT_ALL           1
750 #define SELECT_ALERTABLE     2
751 #define SELECT_INTERRUPTIBLE 4
752 
753 
754 /* Create an event */
755 @REQ(create_event)
756     unsigned int access;        /* wanted access rights */
757     unsigned int attributes;    /* object attributes */
758     int          manual_reset;  /* manual reset event */
759     int          initial_state; /* initial state of the event */
760     VARARG(objattr,object_attributes); /* object attributes */
761 @REPLY
762     obj_handle_t handle;        /* handle to the event */
763 @END
764 
765 /* Event operation */
766 @REQ(event_op)
767     obj_handle_t  handle;       /* handle to event */
768     int           op;           /* event operation (see below) */
769 @END
770 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
771 
772 
773 /* Open an event */
774 @REQ(open_event)
775     unsigned int access;        /* wanted access rights */
776     unsigned int attributes;    /* object attributes */
777     obj_handle_t rootdir;       /* root directory */
778     VARARG(name,unicode_str);   /* object name */
779 @REPLY
780     obj_handle_t handle;        /* handle to the event */
781 @END
782 
783 
784 /* Create a mutex */
785 @REQ(create_mutex)
786     unsigned int access;        /* wanted access rights */
787     unsigned int attributes;    /* object attributes */
788     int          owned;         /* initially owned? */
789     VARARG(objattr,object_attributes); /* object attributes */
790 @REPLY
791     obj_handle_t handle;        /* handle to the mutex */
792 @END
793 
794 
795 /* Release a mutex */
796 @REQ(release_mutex)
797     obj_handle_t handle;        /* handle to the mutex */
798 @REPLY
799     unsigned int prev_count;    /* value of internal counter, before release */
800 @END
801 
802 
803 /* Open a mutex */
804 @REQ(open_mutex)
805     unsigned int access;        /* wanted access rights */
806     unsigned int attributes;    /* object attributes */
807     obj_handle_t rootdir;       /* root directory */
808     VARARG(name,unicode_str);   /* object name */
809 @REPLY
810     obj_handle_t handle;        /* handle to the mutex */
811 @END
812 
813 
814 /* Create a semaphore */
815 @REQ(create_semaphore)
816     unsigned int access;        /* wanted access rights */
817     unsigned int attributes;    /* object attributes */
818     unsigned int initial;       /* initial count */
819     unsigned int max;           /* maximum count */
820     VARARG(objattr,object_attributes); /* object attributes */
821 @REPLY
822     obj_handle_t handle;        /* handle to the semaphore */
823 @END
824 
825 
826 /* Release a semaphore */
827 @REQ(release_semaphore)
828     obj_handle_t handle;        /* handle to the semaphore */
829     unsigned int count;         /* count to add to semaphore */
830 @REPLY
831     unsigned int prev_count;    /* previous semaphore count */
832 @END
833 
834 
835 /* Open a semaphore */
836 @REQ(open_semaphore)
837     unsigned int access;        /* wanted access rights */
838     unsigned int attributes;    /* object attributes */
839     obj_handle_t rootdir;       /* root directory */
840     VARARG(name,unicode_str);   /* object name */
841 @REPLY
842     obj_handle_t handle;        /* handle to the semaphore */
843 @END
844 
845 
846 /* Create a file */
847 @REQ(create_file)
848     unsigned int access;        /* wanted access rights */
849     unsigned int attributes;    /* object attributes */
850     unsigned int sharing;       /* sharing flags */
851     int          create;        /* file create action */
852     unsigned int options;       /* file options */
853     unsigned int attrs;         /* file attributes for creation */
854     VARARG(objattr,object_attributes); /* object attributes */
855     VARARG(filename,string);    /* file name */
856 @REPLY
857     obj_handle_t handle;        /* handle to the file */
858 @END
859 
860 
861 /* Open a file object */
862 @REQ(open_file_object)
863     unsigned int access;        /* wanted access rights */
864     unsigned int attributes;    /* open attributes */
865     obj_handle_t rootdir;       /* root directory */
866     unsigned int sharing;       /* sharing flags */
867     unsigned int options;       /* file options */
868     VARARG(filename,unicode_str); /* file name */
869 @REPLY
870     obj_handle_t handle;        /* handle to the file */
871 @END
872 
873 
874 /* Allocate a file handle for a Unix fd */
875 @REQ(alloc_file_handle)
876     unsigned int access;        /* wanted access rights */
877     unsigned int attributes;    /* object attributes */
878     int          fd;            /* file descriptor on the client side */
879 @REPLY
880     obj_handle_t handle;        /* handle to the file */
881 @END
882 
883 
884 /* Get a Unix fd to access a file */
885 @REQ(get_handle_fd)
886     obj_handle_t handle;        /* handle to the file */
887 @REPLY
888     int          type;          /* file type (see below) */
889     int          removable;     /* is file removable? */
890     unsigned int access;        /* file access rights */
891     unsigned int options;       /* file open options */
892 @END
893 enum server_fd_type
894 {
895     FD_TYPE_INVALID,  /* invalid file (no associated fd) */
896     FD_TYPE_FILE,     /* regular file */
897     FD_TYPE_DIR,      /* directory */
898     FD_TYPE_SOCKET,   /* socket */
899     FD_TYPE_SERIAL,   /* serial port */
900     FD_TYPE_PIPE,     /* named pipe */
901     FD_TYPE_MAILSLOT, /* mailslot */
902     FD_TYPE_CHAR,     /* unspecified char device */
903     FD_TYPE_DEVICE,   /* Windows device file */
904     FD_TYPE_NB_TYPES
905 };
906 
907 
908 /* Flush a file buffers */
909 @REQ(flush_file)
910     obj_handle_t handle;        /* handle to the file */
911 @REPLY
912     obj_handle_t event;         /* event set when finished */
913 @END
914 
915 
916 /* Lock a region of a file */
917 @REQ(lock_file)
918     obj_handle_t handle;        /* handle to the file */
919     file_pos_t   offset;        /* offset of start of lock */
920     file_pos_t   count;         /* count of bytes to lock */
921     int          shared;        /* shared or exclusive lock? */
922     int          wait;          /* do we want to wait? */
923 @REPLY
924     obj_handle_t handle;        /* handle to wait on */
925     int          overlapped;    /* is it an overlapped I/O handle? */
926 @END
927 
928 
929 /* Unlock a region of a file */
930 @REQ(unlock_file)
931     obj_handle_t handle;        /* handle to the file */
932     file_pos_t   offset;        /* offset of start of unlock */
933     file_pos_t   count;         /* count of bytes to unlock */
934 @END
935 
936 
937 /* Create a socket */
938 @REQ(create_socket)
939     unsigned int access;        /* wanted access rights */
940     unsigned int attributes;    /* object attributes */
941     int          family;        /* family, see socket manpage */
942     int          type;          /* type, see socket manpage */
943     int          protocol;      /* protocol, see socket manpage */
944     unsigned int flags;         /* socket flags */
945 @REPLY
946     obj_handle_t handle;        /* handle to the new socket */
947 @END
948 
949 
950 /* Accept a socket */
951 @REQ(accept_socket)
952     obj_handle_t lhandle;       /* handle to the listening socket */
953     unsigned int access;        /* wanted access rights */
954     unsigned int attributes;    /* object attributes */
955 @REPLY
956     obj_handle_t handle;        /* handle to the new socket */
957 @END
958 
959 
960 /* Set socket event parameters */
961 @REQ(set_socket_event)
962     obj_handle_t  handle;        /* handle to the socket */
963     unsigned int  mask;          /* event mask */
964     obj_handle_t  event;         /* event object */
965     user_handle_t window;        /* window to send the message to */
966     unsigned int  msg;           /* message to send */
967 @END
968 
969 
970 /* Get socket event parameters */
971 @REQ(get_socket_event)
972     obj_handle_t handle;        /* handle to the socket */
973     int          service;       /* clear pending? */
974     obj_handle_t c_event;       /* event to clear */
975 @REPLY
976     unsigned int mask;          /* event mask */
977     unsigned int pmask;         /* pending events */
978     unsigned int state;         /* status bits */
979     VARARG(errors,ints);        /* event errors */
980 @END
981 
982 
983 /* Reenable pending socket events */
984 @REQ(enable_socket_event)
985     obj_handle_t handle;        /* handle to the socket */
986     unsigned int mask;          /* events to re-enable */
987     unsigned int sstate;        /* status bits to set */
988     unsigned int cstate;        /* status bits to clear */
989 @END
990 
991 @REQ(set_socket_deferred)
992     obj_handle_t handle;        /* handle to the socket */
993     obj_handle_t deferred;      /* handle to the socket for which accept() is deferred */
994 @END
995 
996 /* Allocate a console (only used by a console renderer) */
997 @REQ(alloc_console)
998     unsigned int access;        /* wanted access rights */
999     unsigned int attributes;    /* object attributes */
1000     process_id_t pid;           /* pid of process which shall be attached to the console */
1001 @REPLY
1002     obj_handle_t handle_in;     /* handle to console input */
1003     obj_handle_t event;         /* handle to renderer events change notification */
1004 @END
1005 
1006 
1007 /* Free the console of the current process */
1008 @REQ(free_console)
1009 @END
1010 
1011 
1012 #define CONSOLE_RENDERER_NONE_EVENT        0x00
1013 #define CONSOLE_RENDERER_TITLE_EVENT       0x01
1014 #define CONSOLE_RENDERER_ACTIVE_SB_EVENT   0x02
1015 #define CONSOLE_RENDERER_SB_RESIZE_EVENT   0x03
1016 #define CONSOLE_RENDERER_UPDATE_EVENT      0x04
1017 #define CONSOLE_RENDERER_CURSOR_POS_EVENT  0x05
1018 #define CONSOLE_RENDERER_CURSOR_GEOM_EVENT 0x06
1019 #define CONSOLE_RENDERER_DISPLAY_EVENT     0x07
1020 #define CONSOLE_RENDERER_EXIT_EVENT        0x08
1021 struct console_renderer_event
1022 {
1023     short event;
1024     union
1025     {
1026         struct update
1027         {
1028             short top;
1029             short bottom;
1030         } update;
1031         struct resize
1032         {
1033             short width;
1034             short height;
1035         } resize;
1036         struct cursor_pos
1037         {
1038             short x;
1039             short y;
1040         } cursor_pos;
1041         struct cursor_geom
1042         {
1043             short visible;
1044             short size;
1045         } cursor_geom;
1046         struct display
1047         {
1048             short left;
1049             short top;
1050             short width;
1051             short height;
1052         } display;
1053     } u;
1054 };
1055 
1056 /* retrieve console events for the renderer */
1057 @REQ(get_console_renderer_events)
1058     obj_handle_t handle;        /* handle to console input events */
1059 @REPLY
1060     VARARG(data,bytes);         /* the various console_renderer_events */
1061 @END
1062 
1063 
1064 /* Open a handle to the process console */
1065 @REQ(open_console)
1066     obj_handle_t from;          /* 0 (resp 1) input (resp output) of current process console */
1067                                 /* otherwise console_in handle to get active screen buffer? */
1068     unsigned int access;        /* wanted access rights */
1069     unsigned int attributes;    /* object attributes */
1070     int          share;         /* share mask (only for output handles) */
1071 @REPLY
1072     obj_handle_t handle;        /* handle to the console */
1073 @END
1074 
1075 
1076 /* Get the input queue wait event */
1077 @REQ(get_console_wait_event)
1078 @REPLY
1079     obj_handle_t handle;
1080 @END
1081 
1082 /* Get a console mode (input or output) */
1083 @REQ(get_console_mode)
1084     obj_handle_t handle;        /* handle to the console */
1085 @REPLY
1086     int          mode;          /* console mode */
1087 @END
1088 
1089 
1090 /* Set a console mode (input or output) */
1091 @REQ(set_console_mode)
1092     obj_handle_t handle;        /* handle to the console */
1093     int          mode;          /* console mode */
1094 @END
1095 
1096 
1097 /* Set info about a console (input only) */
1098 @REQ(set_console_input_info)
1099     obj_handle_t  handle;        /* handle to console input, or 0 for process' console */
1100     int           mask;          /* setting mask (see below) */
1101     obj_handle_t  active_sb;     /* active screen buffer */
1102     int           history_mode;  /* whether we duplicate lines in history */
1103     int           history_size;  /* number of lines in history */
1104     int           edition_mode;  /* index to the edition mode flavors */
1105     int           input_cp;      /* console input codepage */
1106     int           output_cp;     /* console output codepage */
1107     user_handle_t win;           /* console window if backend supports it */
1108     VARARG(title,unicode_str);   /* console title */
1109 @END
1110 #define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
1111 #define SET_CONSOLE_INPUT_INFO_TITLE            0x02
1112 #define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
1113 #define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
1114 #define SET_CONSOLE_INPUT_INFO_EDITION_MODE     0x10
1115 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE   0x20
1116 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE  0x40
1117 #define SET_CONSOLE_INPUT_INFO_WIN              0x80
1118 
1119 
1120 /* Get info about a console (input only) */
1121 @REQ(get_console_input_info)
1122     obj_handle_t  handle;         /* handle to console input, or 0 for process' console */
1123 @REPLY
1124     int           history_mode;   /* whether we duplicate lines in history */
1125     int           history_size;   /* number of lines in history */
1126     int           history_index;  /* number of used lines in history */
1127     int           edition_mode;   /* index to the edition mode flavors */
1128     int           input_cp;       /* console input codepage */
1129     int           output_cp;      /* console output codepage */
1130     user_handle_t win;            /* console window if backend supports it */
1131     VARARG(title,unicode_str);    /* console title */
1132 @END
1133 
1134 
1135 /* appends a string to console's history */
1136 @REQ(append_console_input_history)
1137     obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1138     VARARG(line,unicode_str);   /* line to add */
1139 @END
1140 
1141 
1142 /* appends a string to console's history */
1143 @REQ(get_console_input_history)
1144     obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1145     int          index;         /* index to get line from */
1146 @REPLY
1147     int          total;         /* total length of line in Unicode chars */
1148     VARARG(line,unicode_str);   /* line to add */
1149 @END
1150 
1151 
1152 /* creates a new screen buffer on process' console */
1153 @REQ(create_console_output)
1154     obj_handle_t handle_in;     /* handle to console input, or 0 for process' console */
1155     unsigned int access;        /* wanted access rights */
1156     unsigned int attributes;    /* object attributes */
1157     unsigned int share;         /* sharing credentials */
1158 @REPLY
1159     obj_handle_t handle_out;    /* handle to the screen buffer */
1160 @END
1161 
1162 
1163 /* Set info about a console (output only) */
1164 @REQ(set_console_output_info)
1165     obj_handle_t handle;        /* handle to the console */
1166     int          mask;          /* setting mask (see below) */
1167     short int    cursor_size;   /* size of cursor (percentage filled) */
1168     short int    cursor_visible;/* cursor visibility flag */
1169     short int    cursor_x;      /* position of cursor (x, y) */
1170     short int    cursor_y;
1171     short int    width;         /* width of the screen buffer */
1172     short int    height;        /* height of the screen buffer */
1173     short int    attr;          /* default attribute */
1174     short int    win_left;      /* window actually displayed by renderer */
1175     short int    win_top;       /* the rect area is expressed withing the */
1176     short int    win_right;     /* boundaries of the screen buffer */
1177     short int    win_bottom;
1178     short int    max_width;     /* maximum size (width x height) for the window */
1179     short int    max_height;
1180 @END
1181 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
1182 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
1183 #define SET_CONSOLE_OUTPUT_INFO_SIZE            0x04
1184 #define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
1185 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
1186 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20
1187 
1188 
1189 /* Get info about a console (output only) */
1190 @REQ(get_console_output_info)
1191     obj_handle_t handle;        /* handle to the console */
1192 @REPLY
1193     short int    cursor_size;   /* size of cursor (percentage filled) */
1194     short int    cursor_visible;/* cursor visibility flag */
1195     short int    cursor_x;      /* position of cursor (x, y) */
1196     short int    cursor_y;
1197     short int    width;         /* width of the screen buffer */
1198     short int    height;        /* height of the screen buffer */
1199     short int    attr;          /* default attribute */
1200     short int    win_left;      /* window actually displayed by renderer */
1201     short int    win_top;       /* the rect area is expressed withing the */
1202     short int    win_right;     /* boundaries of the screen buffer */
1203     short int    win_bottom;
1204     short int    max_width;     /* maximum size (width x height) for the window */
1205     short int    max_height;
1206 @END
1207 
1208 /* Add input records to a console input queue */
1209 @REQ(write_console_input)
1210     obj_handle_t handle;        /* handle to the console input */
1211     VARARG(rec,input_records);  /* input records */
1212 @REPLY
1213     int          written;       /* number of records written */
1214 @END
1215 
1216 
1217 /* Fetch input records from a console input queue */
1218 @REQ(read_console_input)
1219     obj_handle_t handle;        /* handle to the console input */
1220     int          flush;         /* flush the retrieved records from the queue? */
1221 @REPLY
1222     int          read;          /* number of records read */
1223     VARARG(rec,input_records);  /* input records */
1224 @END
1225 
1226 
1227 /* write data (chars and/or attributes) in a screen buffer */
1228 @REQ(write_console_output)
1229     obj_handle_t handle;        /* handle to the console output */
1230     int          x;             /* position where to start writing */
1231     int          y;