New mechanism to transfer file descriptors from client to server.
[wine/multimedia.git] / include / server.h
bloba697d97487855ddf92fca85787777e360bb1d533
1 /*
2 * Wine server definitions
4 * Copyright (C) 1998 Alexandre Julliard
5 */
7 #ifndef __WINE_SERVER_H
8 #define __WINE_SERVER_H
10 #include <stdlib.h>
11 #include <time.h>
12 #include "winbase.h"
14 /* Request structures */
16 /* Following are the definitions of all the client<->server */
17 /* communication format; if you make any change in this file, */
18 /* you must run tools/make_requests again. */
21 /* These empty macros are used by tools/make_requests */
22 /* to generate the request/reply tracing functions */
23 #define IN /*nothing*/
24 #define OUT /*nothing*/
25 #define VARARG(name,func) /*nothing*/
27 struct request_header
29 IN int req; /* request code */
30 IN unsigned short var_offset; /* offset of the variable part of the request */
31 IN unsigned short var_size; /* size of the variable part of the request */
32 OUT unsigned int error; /* error result */
34 #define REQUEST_HEADER struct request_header header
37 /* placeholder structure for the maximum allowed request size */
38 /* this is used to construct the generic_request union */
39 struct request_max_size
41 int pad[16]; /* the max request size is 16 ints */
44 /* max size of the variable part of a request */
45 #define REQUEST_MAX_VAR_SIZE 1024
47 typedef int handle_t;
49 /* definitions of the event data depending on the event code */
50 struct debug_event_exception
52 EXCEPTION_RECORD record; /* exception record */
53 int first; /* first chance exception? */
55 struct debug_event_create_thread
57 handle_t handle; /* handle to the new thread */
58 void *teb; /* thread teb (in debugged process address space) */
59 void *start; /* thread startup routine */
61 struct debug_event_create_process
63 handle_t file; /* handle to the process exe file */
64 handle_t process; /* handle to the new process */
65 handle_t thread; /* handle to the new thread */
66 void *base; /* base of executable image */
67 int dbg_offset; /* offset of debug info in file */
68 int dbg_size; /* size of debug info */
69 void *teb; /* thread teb (in debugged process address space) */
70 void *start; /* thread startup routine */
71 void *name; /* image name (optional) */
72 int unicode; /* is it Unicode? */
74 struct debug_event_exit
76 int exit_code; /* thread or process exit code */
78 struct debug_event_load_dll
80 handle_t handle; /* file handle for the dll */
81 void *base; /* base address of the dll */
82 int dbg_offset; /* offset of debug info in file */
83 int dbg_size; /* size of debug info */
84 void *name; /* image name (optional) */
85 int unicode; /* is it Unicode? */
87 struct debug_event_unload_dll
89 void *base; /* base address of the dll */
91 struct debug_event_output_string
93 void *string; /* string to display (in debugged process address space) */
94 int unicode; /* is it Unicode? */
95 int length; /* string length */
97 struct debug_event_rip_info
99 int error; /* ??? */
100 int type; /* ??? */
102 union debug_event_data
104 struct debug_event_exception exception;
105 struct debug_event_create_thread create_thread;
106 struct debug_event_create_process create_process;
107 struct debug_event_exit exit;
108 struct debug_event_load_dll load_dll;
109 struct debug_event_unload_dll unload_dll;
110 struct debug_event_output_string output_string;
111 struct debug_event_rip_info rip_info;
114 /* debug event data */
115 typedef struct
117 int code; /* event code */
118 union debug_event_data info; /* event information */
119 } debug_event_t;
121 /* structure used in sending an fd from client to server */
122 struct send_fd
124 void *tid; /* thread id */
125 int fd; /* file descriptor on client-side */
128 /* Create a new process from the context of the parent */
129 struct new_process_request
131 REQUEST_HEADER; /* request header */
132 IN int inherit_all; /* inherit all handles from parent */
133 IN int create_flags; /* creation flags */
134 IN int start_flags; /* flags from startup info */
135 IN handle_t exe_file; /* file handle for main exe */
136 IN handle_t hstdin; /* handle for stdin */
137 IN handle_t hstdout; /* handle for stdout */
138 IN handle_t hstderr; /* handle for stderr */
139 IN int cmd_show; /* main window show mode */
140 OUT handle_t info; /* new process info handle */
141 IN VARARG(filename,string); /* file name of main exe */
145 /* Retrieve information about a newly started process */
146 struct get_new_process_info_request
148 REQUEST_HEADER; /* request header */
149 IN handle_t info; /* info handle returned from new_process_request */
150 IN int pinherit; /* process handle inherit flag */
151 IN int tinherit; /* thread handle inherit flag */
152 OUT void* pid; /* process id */
153 OUT handle_t phandle; /* process handle (in the current process) */
154 OUT void* tid; /* thread id */
155 OUT handle_t thandle; /* thread handle (in the current process) */
156 OUT handle_t event; /* event handle to signal startup */
160 /* Create a new thread from the context of the parent */
161 struct new_thread_request
163 REQUEST_HEADER; /* request header */
164 IN int suspend; /* new thread should be suspended on creation */
165 IN int inherit; /* inherit flag */
166 OUT void* tid; /* thread id */
167 OUT handle_t handle; /* thread handle (in the current process) */
171 /* Signal that we are finished booting on the client side */
172 struct boot_done_request
174 REQUEST_HEADER; /* request header */
175 IN int debug_level; /* new debug level */
179 /* Initialize a process; called from the new process context */
180 struct init_process_request
182 REQUEST_HEADER; /* request header */
183 IN void* ldt_copy; /* addr of LDT copy */
184 IN int ppid; /* parent Unix pid */
185 OUT int create_flags; /* creation flags */
186 OUT int start_flags; /* flags from startup info */
187 OUT unsigned int server_start; /* server start time (GetTickCount) */
188 OUT handle_t exe_file; /* file handle for main exe */
189 OUT handle_t hstdin; /* handle for stdin */
190 OUT handle_t hstdout; /* handle for stdout */
191 OUT handle_t hstderr; /* handle for stderr */
192 OUT int cmd_show; /* main window show mode */
193 OUT VARARG(filename,string); /* file name of main exe */
197 /* Signal the end of the process initialization */
198 struct init_process_done_request
200 REQUEST_HEADER; /* request header */
201 IN void* module; /* main module base address */
202 IN void* entry; /* process entry point */
203 IN void* name; /* ptr to ptr to name (in process addr space) */
204 IN handle_t exe_file; /* file handle for main exe */
205 IN int gui; /* is it a GUI process? */
206 OUT int debugged; /* being debugged? */
210 /* Initialize a thread; called from the child after fork()/clone() */
211 struct init_thread_request
213 REQUEST_HEADER; /* request header */
214 IN int unix_pid; /* Unix pid of new thread */
215 IN void* teb; /* TEB of new thread (in thread address space) */
216 IN void* entry; /* thread entry point (in thread address space) */
220 /* Retrieve the thread buffer file descriptor */
221 /* The reply to this request is the first thing a newly */
222 /* created thread gets (without having to request it) */
223 struct get_thread_buffer_request
225 REQUEST_HEADER; /* request header */
226 OUT void* pid; /* process id of the new thread's process */
227 OUT void* tid; /* thread id of the new thread */
228 OUT int boot; /* is this the boot thread? */
229 OUT int version; /* protocol version */
233 /* Terminate a process */
234 struct terminate_process_request
236 REQUEST_HEADER; /* request header */
237 IN handle_t handle; /* process handle to terminate */
238 IN int exit_code; /* process exit code */
239 OUT int self; /* suicide? */
243 /* Terminate a thread */
244 struct terminate_thread_request
246 REQUEST_HEADER; /* request header */
247 IN handle_t handle; /* thread handle to terminate */
248 IN int exit_code; /* thread exit code */
249 OUT int self; /* suicide? */
250 OUT int last; /* last thread in this process? */
254 /* Retrieve information about a process */
255 struct get_process_info_request
257 REQUEST_HEADER; /* request header */
258 IN handle_t handle; /* process handle */
259 OUT void* pid; /* server process id */
260 OUT int debugged; /* debugged? */
261 OUT int exit_code; /* process exit code */
262 OUT int priority; /* priority class */
263 OUT int process_affinity; /* process affinity mask */
264 OUT int system_affinity; /* system affinity mask */
268 /* Set a process informations */
269 struct set_process_info_request
271 REQUEST_HEADER; /* request header */
272 IN handle_t handle; /* process handle */
273 IN int mask; /* setting mask (see below) */
274 IN int priority; /* priority class */
275 IN int affinity; /* affinity mask */
277 #define SET_PROCESS_INFO_PRIORITY 0x01
278 #define SET_PROCESS_INFO_AFFINITY 0x02
281 /* Retrieve information about a thread */
282 struct get_thread_info_request
284 REQUEST_HEADER; /* request header */
285 IN handle_t handle; /* thread handle */
286 IN void* tid_in; /* thread id (optional) */
287 OUT void* tid; /* server thread id */
288 OUT void* teb; /* thread teb pointer */
289 OUT int exit_code; /* thread exit code */
290 OUT int priority; /* thread priority level */
294 /* Set a thread informations */
295 struct set_thread_info_request
297 REQUEST_HEADER; /* request header */
298 IN handle_t handle; /* thread handle */
299 IN int mask; /* setting mask (see below) */
300 IN int priority; /* priority class */
301 IN int affinity; /* affinity mask */
303 #define SET_THREAD_INFO_PRIORITY 0x01
304 #define SET_THREAD_INFO_AFFINITY 0x02
307 /* Suspend a thread */
308 struct suspend_thread_request
310 REQUEST_HEADER; /* request header */
311 IN handle_t handle; /* thread handle */
312 OUT int count; /* new suspend count */
316 /* Resume a thread */
317 struct resume_thread_request
319 REQUEST_HEADER; /* request header */
320 IN handle_t handle; /* thread handle */
321 OUT int count; /* new suspend count */
325 /* Notify the server that a dll has been loaded */
326 struct load_dll_request
328 REQUEST_HEADER; /* request header */
329 IN handle_t handle; /* file handle */
330 IN void* base; /* base address */
331 IN int dbg_offset; /* debug info offset */
332 IN int dbg_size; /* debug info size */
333 IN void* name; /* ptr to ptr to name (in process addr space) */
337 /* Notify the server that a dll is being unloaded */
338 struct unload_dll_request
340 REQUEST_HEADER; /* request header */
341 IN void* base; /* base address */
345 /* Queue an APC for a thread */
346 struct queue_apc_request
348 REQUEST_HEADER; /* request header */
349 IN handle_t handle; /* thread handle */
350 IN int user; /* user or system apc? */
351 IN void* func; /* function to call */
352 IN void* param; /* param for function to call */
356 /* Get next APC to call */
357 struct get_apc_request
359 REQUEST_HEADER; /* request header */
360 IN int alertable; /* is thread alertable? */
361 OUT void* func; /* function to call */
362 OUT int type; /* function type */
363 OUT VARARG(args,ptrs); /* function arguments */
365 enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC };
368 /* Close a handle for the current process */
369 struct close_handle_request
371 REQUEST_HEADER; /* request header */
372 IN handle_t handle; /* handle to close */
373 OUT int fd; /* associated fd to close */
377 /* Set a handle information */
378 struct set_handle_info_request
380 REQUEST_HEADER; /* request header */
381 IN handle_t handle; /* handle we are interested in */
382 IN int flags; /* new handle flags */
383 IN int mask; /* mask for flags to set */
384 IN int fd; /* file descriptor or -1 */
385 OUT int old_flags; /* old flag value */
386 OUT int cur_fd; /* current file descriptor */
390 /* Duplicate a handle */
391 struct dup_handle_request
393 REQUEST_HEADER; /* request header */
394 IN handle_t src_process; /* src process handle */
395 IN handle_t src_handle; /* src handle to duplicate */
396 IN handle_t dst_process; /* dst process handle */
397 IN unsigned int access; /* wanted access rights */
398 IN int inherit; /* inherit flag */
399 IN int options; /* duplicate options (see below) */
400 OUT handle_t handle; /* duplicated handle in dst process */
401 OUT int fd; /* associated fd to close */
403 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
404 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
405 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
408 /* Open a handle to a process */
409 struct open_process_request
411 REQUEST_HEADER; /* request header */
412 IN void* pid; /* process id to open */
413 IN unsigned int access; /* wanted access rights */
414 IN int inherit; /* inherit flag */
415 OUT handle_t handle; /* handle to the process */
419 /* Wait for handles */
420 struct select_request
422 REQUEST_HEADER; /* request header */
423 IN int flags; /* wait flags (see below) */
424 IN int sec; /* absolute timeout */
425 IN int usec; /* absolute timeout */
426 IN VARARG(handles,handles); /* handles to select on */
428 #define SELECT_ALL 1
429 #define SELECT_ALERTABLE 2
430 #define SELECT_INTERRUPTIBLE 4
431 #define SELECT_TIMEOUT 8
434 /* Create an event */
435 struct create_event_request
437 REQUEST_HEADER; /* request header */
438 IN int manual_reset; /* manual reset event */
439 IN int initial_state; /* initial state of the event */
440 IN int inherit; /* inherit flag */
441 OUT handle_t handle; /* handle to the event */
442 IN VARARG(name,unicode_str); /* object name */
445 /* Event operation */
446 struct event_op_request
448 REQUEST_HEADER; /* request header */
449 IN handle_t handle; /* handle to event */
450 IN int op; /* event operation (see below) */
452 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
455 /* Open an event */
456 struct open_event_request
458 REQUEST_HEADER; /* request header */
459 IN unsigned int access; /* wanted access rights */
460 IN int inherit; /* inherit flag */
461 OUT handle_t handle; /* handle to the event */
462 IN VARARG(name,unicode_str); /* object name */
466 /* Create a mutex */
467 struct create_mutex_request
469 REQUEST_HEADER; /* request header */
470 IN int owned; /* initially owned? */
471 IN int inherit; /* inherit flag */
472 OUT handle_t handle; /* handle to the mutex */
473 IN VARARG(name,unicode_str); /* object name */
477 /* Release a mutex */
478 struct release_mutex_request
480 REQUEST_HEADER; /* request header */
481 IN handle_t handle; /* handle to the mutex */
485 /* Open a mutex */
486 struct open_mutex_request
488 REQUEST_HEADER; /* request header */
489 IN unsigned int access; /* wanted access rights */
490 IN int inherit; /* inherit flag */
491 OUT handle_t handle; /* handle to the mutex */
492 IN VARARG(name,unicode_str); /* object name */
496 /* Create a semaphore */
497 struct create_semaphore_request
499 REQUEST_HEADER; /* request header */
500 IN unsigned int initial; /* initial count */
501 IN unsigned int max; /* maximum count */
502 IN int inherit; /* inherit flag */
503 OUT handle_t handle; /* handle to the semaphore */
504 IN VARARG(name,unicode_str); /* object name */
508 /* Release a semaphore */
509 struct release_semaphore_request
511 REQUEST_HEADER; /* request header */
512 IN handle_t handle; /* handle to the semaphore */
513 IN unsigned int count; /* count to add to semaphore */
514 OUT unsigned int prev_count; /* previous semaphore count */
518 /* Open a semaphore */
519 struct open_semaphore_request
521 REQUEST_HEADER; /* request header */
522 IN unsigned int access; /* wanted access rights */
523 IN int inherit; /* inherit flag */
524 OUT handle_t handle; /* handle to the semaphore */
525 IN VARARG(name,unicode_str); /* object name */
529 /* Create a file */
530 struct create_file_request
532 REQUEST_HEADER; /* request header */
533 IN unsigned int access; /* wanted access rights */
534 IN int inherit; /* inherit flag */
535 IN unsigned int sharing; /* sharing flags */
536 IN int create; /* file create action */
537 IN unsigned int attrs; /* file attributes for creation */
538 OUT handle_t handle; /* handle to the file */
539 IN VARARG(filename,string); /* file name */
543 /* Allocate a file handle for a Unix fd */
544 struct alloc_file_handle_request
546 REQUEST_HEADER; /* request header */
547 IN unsigned int access; /* wanted access rights */
548 IN int fd; /* file descriptor on the client side */
549 OUT handle_t handle; /* handle to the file */
553 /* Get a Unix fd to access a file */
554 struct get_handle_fd_request
556 REQUEST_HEADER; /* request header */
557 IN handle_t handle; /* handle to the file */
558 IN unsigned int access; /* wanted access rights */
559 OUT int fd; /* file descriptor */
563 /* Set a file current position */
564 struct set_file_pointer_request
566 REQUEST_HEADER; /* request header */
567 IN handle_t handle; /* handle to the file */
568 IN int low; /* position low word */
569 IN int high; /* position high word */
570 IN int whence; /* whence to seek */
571 OUT int new_low; /* new position low word */
572 OUT int new_high; /* new position high word */
576 /* Truncate (or extend) a file */
577 struct truncate_file_request
579 REQUEST_HEADER; /* request header */
580 IN handle_t handle; /* handle to the file */
584 /* Set a file access and modification times */
585 struct set_file_time_request
587 REQUEST_HEADER; /* request header */
588 IN handle_t handle; /* handle to the file */
589 IN time_t access_time; /* last access time */
590 IN time_t write_time; /* last write time */
594 /* Flush a file buffers */
595 struct flush_file_request
597 REQUEST_HEADER; /* request header */
598 IN handle_t handle; /* handle to the file */
602 /* Get information about a file */
603 struct get_file_info_request
605 REQUEST_HEADER; /* request header */
606 IN handle_t handle; /* handle to the file */
607 OUT int type; /* file type */
608 OUT int attr; /* file attributes */
609 OUT time_t access_time; /* last access time */
610 OUT time_t write_time; /* last write time */
611 OUT int size_high; /* file size */
612 OUT int size_low; /* file size */
613 OUT int links; /* number of links */
614 OUT int index_high; /* unique index */
615 OUT int index_low; /* unique index */
616 OUT unsigned int serial; /* volume serial number */
620 /* Lock a region of a file */
621 struct lock_file_request
623 REQUEST_HEADER; /* request header */
624 IN handle_t handle; /* handle to the file */
625 IN unsigned int offset_low; /* offset of start of lock */
626 IN unsigned int offset_high; /* offset of start of lock */
627 IN unsigned int count_low; /* count of bytes to lock */
628 IN unsigned int count_high; /* count of bytes to lock */
632 /* Unlock a region of a file */
633 struct unlock_file_request
635 REQUEST_HEADER; /* request header */
636 IN handle_t handle; /* handle to the file */
637 IN unsigned int offset_low; /* offset of start of unlock */
638 IN unsigned int offset_high; /* offset of start of unlock */
639 IN unsigned int count_low; /* count of bytes to unlock */
640 IN unsigned int count_high; /* count of bytes to unlock */
644 /* Create an anonymous pipe */
645 struct create_pipe_request
647 REQUEST_HEADER; /* request header */
648 IN int inherit; /* inherit flag */
649 OUT handle_t handle_read; /* handle to the read-side of the pipe */
650 OUT handle_t handle_write; /* handle to the write-side of the pipe */
654 /* Create a socket */
655 struct create_socket_request
657 REQUEST_HEADER; /* request header */
658 IN unsigned int access; /* wanted access rights */
659 IN int inherit; /* inherit flag */
660 IN int family; /* family, see socket manpage */
661 IN int type; /* type, see socket manpage */
662 IN int protocol; /* protocol, see socket manpage */
663 OUT handle_t handle; /* handle to the new socket */
667 /* Accept a socket */
668 struct accept_socket_request
670 REQUEST_HEADER; /* request header */
671 IN handle_t lhandle; /* handle to the listening socket */
672 IN unsigned int access; /* wanted access rights */
673 IN int inherit; /* inherit flag */
674 OUT handle_t handle; /* handle to the new socket */
678 /* Set socket event parameters */
679 struct set_socket_event_request
681 REQUEST_HEADER; /* request header */
682 IN handle_t handle; /* handle to the socket */
683 IN unsigned int mask; /* event mask */
684 IN handle_t event; /* event object */
688 /* Get socket event parameters */
689 struct get_socket_event_request
691 REQUEST_HEADER; /* request header */
692 IN handle_t handle; /* handle to the socket */
693 IN int service; /* clear pending? */
694 IN handle_t s_event; /* "expected" event object */
695 IN handle_t c_event; /* event to clear */
696 OUT unsigned int mask; /* event mask */
697 OUT unsigned int pmask; /* pending events */
698 OUT unsigned int state; /* status bits */
699 OUT VARARG(errors,ints); /* event errors */
703 /* Reenable pending socket events */
704 struct enable_socket_event_request
706 REQUEST_HEADER; /* request header */
707 IN handle_t handle; /* handle to the socket */
708 IN unsigned int mask; /* events to re-enable */
709 IN unsigned int sstate; /* status bits to set */
710 IN unsigned int cstate; /* status bits to clear */
714 /* Allocate a console for the current process */
715 struct alloc_console_request
717 REQUEST_HEADER; /* request header */
718 IN unsigned int access; /* wanted access rights */
719 IN int inherit; /* inherit flag */
720 OUT handle_t handle_in; /* handle to console input */
721 OUT handle_t handle_out; /* handle to console output */
725 /* Free the console of the current process */
726 struct free_console_request
728 REQUEST_HEADER; /* request header */
732 /* Open a handle to the process console */
733 struct open_console_request
735 REQUEST_HEADER; /* request header */
736 IN int output; /* input or output? */
737 IN unsigned int access; /* wanted access rights */
738 IN int inherit; /* inherit flag */
739 OUT handle_t handle; /* handle to the console */
743 /* Set a console file descriptor */
744 struct set_console_fd_request
746 REQUEST_HEADER; /* request header */
747 IN handle_t handle; /* handle to the console */
748 IN handle_t handle_in; /* handle of file to use as input */
749 IN handle_t handle_out; /* handle of file to use as output */
750 IN int pid; /* pid of xterm (hack) */
754 /* Get a console mode (input or output) */
755 struct get_console_mode_request
757 REQUEST_HEADER; /* request header */
758 IN handle_t handle; /* handle to the console */
759 OUT int mode; /* console mode */
763 /* Set a console mode (input or output) */
764 struct set_console_mode_request
766 REQUEST_HEADER; /* request header */
767 IN handle_t handle; /* handle to the console */
768 IN int mode; /* console mode */
772 /* Set info about a console (output only) */
773 struct set_console_info_request
775 REQUEST_HEADER; /* request header */
776 IN handle_t handle; /* handle to the console */
777 IN int mask; /* setting mask (see below) */
778 IN int cursor_size; /* size of cursor (percentage filled) */
779 IN int cursor_visible;/* cursor visibility flag */
780 IN VARARG(title,string); /* console title */
782 #define SET_CONSOLE_INFO_CURSOR 0x01
783 #define SET_CONSOLE_INFO_TITLE 0x02
785 /* Get info about a console (output only) */
786 struct get_console_info_request
788 REQUEST_HEADER; /* request header */
789 IN handle_t handle; /* handle to the console */
790 OUT int cursor_size; /* size of cursor (percentage filled) */
791 OUT int cursor_visible;/* cursor visibility flag */
792 OUT int pid; /* pid of xterm (hack) */
793 OUT VARARG(title,string); /* console title */
797 /* Add input records to a console input queue */
798 struct write_console_input_request
800 REQUEST_HEADER; /* request header */
801 IN handle_t handle; /* handle to the console input */
802 OUT int written; /* number of records written */
803 IN VARARG(rec,input_records); /* input records */
806 /* Fetch input records from a console input queue */
807 struct read_console_input_request
809 REQUEST_HEADER; /* request header */
810 IN handle_t handle; /* handle to the console input */
811 IN int flush; /* flush the retrieved records from the queue? */
812 OUT int read; /* number of records read */
813 OUT VARARG(rec,input_records); /* input records */
817 /* Create a change notification */
818 struct create_change_notification_request
820 REQUEST_HEADER; /* request header */
821 IN int subtree; /* watch all the subtree */
822 IN int filter; /* notification filter */
823 OUT handle_t handle; /* handle to the change notification */
827 /* Create a file mapping */
828 struct create_mapping_request
830 REQUEST_HEADER; /* request header */
831 IN int size_high; /* mapping size */
832 IN int size_low; /* mapping size */
833 IN int protect; /* protection flags (see below) */
834 IN int inherit; /* inherit flag */
835 IN handle_t file_handle; /* file handle */
836 OUT handle_t handle; /* handle to the mapping */
837 IN VARARG(name,unicode_str); /* object name */
839 /* protection flags */
840 #define VPROT_READ 0x01
841 #define VPROT_WRITE 0x02
842 #define VPROT_EXEC 0x04
843 #define VPROT_WRITECOPY 0x08
844 #define VPROT_GUARD 0x10
845 #define VPROT_NOCACHE 0x20
846 #define VPROT_COMMITTED 0x40
847 #define VPROT_IMAGE 0x80
850 /* Open a mapping */
851 struct open_mapping_request
853 REQUEST_HEADER; /* request header */
854 IN unsigned int access; /* wanted access rights */
855 IN int inherit; /* inherit flag */
856 OUT handle_t handle; /* handle to the mapping */
857 IN VARARG(name,unicode_str); /* object name */
861 /* Get information about a file mapping */
862 struct get_mapping_info_request
864 REQUEST_HEADER; /* request header */
865 IN handle_t handle; /* handle to the mapping */
866 OUT int size_high; /* mapping size */
867 OUT int size_low; /* mapping size */
868 OUT int protect; /* protection flags */
869 OUT int header_size; /* header size (for VPROT_IMAGE mapping) */
870 OUT void* base; /* default base addr (for VPROT_IMAGE mapping) */
871 OUT handle_t shared_file; /* shared mapping file handle */
872 OUT int shared_size; /* shared mapping size */
876 /* Create a device */
877 struct create_device_request
879 REQUEST_HEADER; /* request header */
880 IN unsigned int access; /* wanted access rights */
881 IN int inherit; /* inherit flag */
882 IN int id; /* client private id */
883 OUT handle_t handle; /* handle to the device */
887 /* Create a snapshot */
888 struct create_snapshot_request
890 REQUEST_HEADER; /* request header */
891 IN int inherit; /* inherit flag */
892 IN int flags; /* snapshot flags (TH32CS_*) */
893 IN void* pid; /* process id */
894 OUT handle_t handle; /* handle to the snapshot */
898 /* Get the next process from a snapshot */
899 struct next_process_request
901 REQUEST_HEADER; /* request header */
902 IN handle_t handle; /* handle to the snapshot */
903 IN int reset; /* reset snapshot position? */
904 OUT int count; /* process usage count */
905 OUT void* pid; /* process id */
906 OUT int threads; /* number of threads */
907 OUT int priority; /* process priority */
911 /* Get the next thread from a snapshot */
912 struct next_thread_request
914 REQUEST_HEADER; /* request header */
915 IN handle_t handle; /* handle to the snapshot */
916 IN int reset; /* reset snapshot position? */
917 OUT int count; /* thread usage count */
918 OUT void* pid; /* process id */
919 OUT void* tid; /* thread id */
920 OUT int base_pri; /* base priority */
921 OUT int delta_pri; /* delta priority */
925 /* Get the next module from a snapshot */
926 struct next_module_request
928 REQUEST_HEADER; /* request header */
929 IN handle_t handle; /* handle to the snapshot */
930 IN int reset; /* reset snapshot position? */
931 OUT void* pid; /* process id */
932 OUT void* base; /* module base address */
936 /* Wait for a debug event */
937 struct wait_debug_event_request
939 REQUEST_HEADER; /* request header */
940 IN int get_handle; /* should we alloc a handle for waiting? */
941 OUT void* pid; /* process id */
942 OUT void* tid; /* thread id */
943 OUT handle_t wait; /* wait handle if no event ready */
944 OUT VARARG(event,debug_event); /* debug event data */
948 /* Queue an exception event */
949 struct queue_exception_event_request
951 REQUEST_HEADER; /* request header */
952 IN int first; /* first chance exception? */
953 OUT handle_t handle; /* handle to the queued event */
954 IN VARARG(record,exc_event); /* thread context followed by exception record */
958 /* Retrieve the status of an exception event */
959 struct get_exception_status_request
961 REQUEST_HEADER; /* request header */
962 OUT handle_t handle; /* handle to the queued event */
963 OUT int status; /* event continuation status */
964 OUT VARARG(context,context); /* modified thread context */
968 /* Send an output string to the debugger */
969 struct output_debug_string_request
971 REQUEST_HEADER; /* request header */
972 IN void* string; /* string to display (in debugged process address space) */
973 IN int unicode; /* is it Unicode? */
974 IN int length; /* string length */
978 /* Continue a debug event */
979 struct continue_debug_event_request
981 REQUEST_HEADER; /* request header */
982 IN void* pid; /* process id to continue */
983 IN void* tid; /* thread id to continue */
984 IN int status; /* continuation status */
988 /* Start debugging an existing process */
989 struct debug_process_request
991 REQUEST_HEADER; /* request header */
992 IN void* pid; /* id of the process to debug */
996 /* Read data from a process address space */
997 struct read_process_memory_request
999 REQUEST_HEADER; /* request header */
1000 IN handle_t handle; /* process handle */
1001 IN void* addr; /* addr to read from (must be int-aligned) */
1002 IN int len; /* number of ints to read */
1003 OUT VARARG(data,bytes); /* result data */
1007 /* Write data to a process address space */
1008 struct write_process_memory_request
1010 REQUEST_HEADER; /* request header */
1011 IN handle_t handle; /* process handle */
1012 IN void* addr; /* addr to write to (must be int-aligned) */
1013 IN int len; /* number of ints to write */
1014 IN unsigned int first_mask; /* mask for first word */
1015 IN unsigned int last_mask; /* mask for last word */
1016 IN VARARG(data,bytes); /* result data */
1020 /* Create a registry key */
1021 struct create_key_request
1023 REQUEST_HEADER; /* request header */
1024 IN handle_t parent; /* handle to the parent key */
1025 IN unsigned int access; /* desired access rights */
1026 IN unsigned int options; /* creation options */
1027 IN time_t modif; /* last modification time */
1028 OUT handle_t hkey; /* handle to the created key */
1029 OUT int created; /* has it been newly created? */
1030 IN VARARG(name,unicode_len_str); /* key name */
1031 IN VARARG(class,unicode_str); /* class name */
1034 /* Open a registry key */
1035 struct open_key_request
1037 REQUEST_HEADER; /* request header */
1038 IN handle_t parent; /* handle to the parent key */
1039 IN unsigned int access; /* desired access rights */
1040 OUT handle_t hkey; /* handle to the open key */
1041 IN VARARG(name,unicode_str); /* key name */
1045 /* Delete a registry key */
1046 struct delete_key_request
1048 REQUEST_HEADER; /* request header */
1049 IN handle_t hkey; /* handle to the key */
1053 /* Enumerate registry subkeys */
1054 struct enum_key_request
1056 REQUEST_HEADER; /* request header */
1057 IN handle_t hkey; /* handle to registry key */
1058 IN int index; /* index of subkey (or -1 for current key) */
1059 IN int full; /* return the full info? */
1060 OUT int subkeys; /* number of subkeys */
1061 OUT int max_subkey; /* longest subkey name */
1062 OUT int max_class; /* longest class name */
1063 OUT int values; /* number of values */
1064 OUT int max_value; /* longest value name */
1065 OUT int max_data; /* longest value data */
1066 OUT time_t modif; /* last modification time */
1067 OUT VARARG(name,unicode_len_str); /* key name */
1068 OUT VARARG(class,unicode_str); /* class name */
1072 /* Set a value of a registry key */
1073 struct set_key_value_request
1075 REQUEST_HEADER; /* request header */
1076 IN handle_t hkey; /* handle to registry key */
1077 IN int type; /* value type */
1078 IN unsigned int total; /* total value len */
1079 IN unsigned int offset; /* offset for setting data */
1080 IN VARARG(name,unicode_len_str); /* value name */
1081 IN VARARG(data,bytes); /* value data */
1085 /* Retrieve the value of a registry key */
1086 struct get_key_value_request
1088 REQUEST_HEADER; /* request header */
1089 IN handle_t hkey; /* handle to registry key */
1090 IN unsigned int offset; /* offset for getting data */
1091 OUT int type; /* value type */
1092 OUT int len; /* value data len */
1093 IN VARARG(name,unicode_len_str); /* value name */
1094 OUT VARARG(data,bytes); /* value data */
1098 /* Enumerate a value of a registry key */
1099 struct enum_key_value_request
1101 REQUEST_HEADER; /* request header */
1102 IN handle_t hkey; /* handle to registry key */
1103 IN int index; /* value index */
1104 IN unsigned int offset; /* offset for getting data */
1105 OUT int type; /* value type */
1106 OUT int len; /* value data len */
1107 OUT VARARG(name,unicode_len_str); /* value name */
1108 OUT VARARG(data,bytes); /* value data */
1112 /* Delete a value of a registry key */
1113 struct delete_key_value_request
1115 REQUEST_HEADER; /* request header */
1116 IN handle_t hkey; /* handle to registry key */
1117 IN VARARG(name,unicode_str); /* value name */
1121 /* Load a registry branch from a file */
1122 struct load_registry_request
1124 REQUEST_HEADER; /* request header */
1125 IN handle_t hkey; /* root key to load to */
1126 IN handle_t file; /* file to load from */
1127 IN VARARG(name,unicode_str); /* subkey name */
1131 /* Save a registry branch to a file */
1132 struct save_registry_request
1134 REQUEST_HEADER; /* request header */
1135 IN handle_t hkey; /* key to save */
1136 IN handle_t file; /* file to save to */
1140 /* Save a registry branch at server exit */
1141 struct save_registry_atexit_request
1143 REQUEST_HEADER; /* request header */
1144 IN handle_t hkey; /* key to save */
1145 IN VARARG(file,string); /* file to save to */
1149 /* Set the current and saving level for the registry */
1150 struct set_registry_levels_request
1152 REQUEST_HEADER; /* request header */
1153 IN int current; /* new current level */
1154 IN int saving; /* new saving level */
1155 IN int period; /* duration between periodic saves (milliseconds) */
1159 /* Create a waitable timer */
1160 struct create_timer_request
1162 REQUEST_HEADER; /* request header */
1163 IN int inherit; /* inherit flag */
1164 IN int manual; /* manual reset */
1165 OUT handle_t handle; /* handle to the timer */
1166 IN VARARG(name,unicode_str); /* object name */
1170 /* Open a waitable timer */
1171 struct open_timer_request
1173 REQUEST_HEADER; /* request header */
1174 IN unsigned int access; /* wanted access rights */
1175 IN int inherit; /* inherit flag */
1176 OUT handle_t handle; /* handle to the timer */
1177 IN VARARG(name,unicode_str); /* object name */
1180 /* Set a waitable timer */
1181 struct set_timer_request
1183 REQUEST_HEADER; /* request header */
1184 IN handle_t handle; /* handle to the timer */
1185 IN int sec; /* next expiration absolute time */
1186 IN int usec; /* next expiration absolute time */
1187 IN int period; /* timer period in ms */
1188 IN void* callback; /* callback function */
1189 IN void* arg; /* callback argument */
1192 /* Cancel a waitable timer */
1193 struct cancel_timer_request
1195 REQUEST_HEADER; /* request header */
1196 IN handle_t handle; /* handle to the timer */
1200 /* Retrieve the current context of a thread */
1201 struct get_thread_context_request
1203 REQUEST_HEADER; /* request header */
1204 IN handle_t handle; /* thread handle */
1205 IN unsigned int flags; /* context flags */
1206 OUT VARARG(context,context); /* thread context */
1210 /* Set the current context of a thread */
1211 struct set_thread_context_request
1213 REQUEST_HEADER; /* request header */
1214 IN handle_t handle; /* thread handle */
1215 IN unsigned int flags; /* context flags */
1216 IN VARARG(context,context); /* thread context */
1220 /* Fetch a selector entry for a thread */
1221 struct get_selector_entry_request
1223 REQUEST_HEADER; /* request header */
1224 IN handle_t handle; /* thread handle */
1225 IN int entry; /* LDT entry */
1226 OUT unsigned int base; /* selector base */
1227 OUT unsigned int limit; /* selector limit */
1228 OUT unsigned char flags; /* selector flags */
1232 /* Add an atom */
1233 struct add_atom_request
1235 REQUEST_HEADER; /* request header */
1236 IN int local; /* is atom in local process table? */
1237 OUT int atom; /* resulting atom */
1238 IN VARARG(name,unicode_str); /* atom name */
1242 /* Delete an atom */
1243 struct delete_atom_request
1245 REQUEST_HEADER; /* request header */
1246 IN int atom; /* atom handle */
1247 IN int local; /* is atom in local process table? */
1251 /* Find an atom */
1252 struct find_atom_request
1254 REQUEST_HEADER; /* request header */
1255 IN int local; /* is atom in local process table? */
1256 OUT int atom; /* atom handle */
1257 IN VARARG(name,unicode_str); /* atom name */
1261 /* Get an atom name */
1262 struct get_atom_name_request
1264 REQUEST_HEADER; /* request header */
1265 IN int atom; /* atom handle */
1266 IN int local; /* is atom in local process table? */
1267 OUT int count; /* atom lock count */
1268 OUT VARARG(name,unicode_str); /* atom name */
1272 /* Init the process atom table */
1273 struct init_atom_table_request
1275 REQUEST_HEADER; /* request header */
1276 IN int entries; /* number of entries */
1280 /* Get the message queue of the current thread */
1281 struct get_msg_queue_request
1283 REQUEST_HEADER; /* request header */
1284 OUT handle_t handle; /* handle to the queue */
1287 /* Wake up a message queue */
1288 struct wake_queue_request
1290 REQUEST_HEADER; /* request header */
1291 IN handle_t handle; /* handle to the queue */
1292 IN unsigned int bits; /* wake bits */
1295 /* Wait for a process to start waiting on input */
1296 struct wait_input_idle_request
1298 REQUEST_HEADER; /* request header */
1299 IN handle_t handle; /* process handle */
1300 IN int timeout; /* timeout */
1301 OUT handle_t event; /* handle to idle event */
1304 struct create_serial_request
1306 REQUEST_HEADER; /* request header */
1307 IN unsigned int access; /* wanted access rights */
1308 IN int inherit; /* inherit flag */
1309 IN unsigned int sharing; /* sharing flags */
1310 OUT handle_t handle; /* handle to the port */
1311 IN VARARG(name,string); /* file name */
1314 struct get_serial_info_request
1316 REQUEST_HEADER; /* request header */
1317 IN handle_t handle; /* handle to comm port */
1318 OUT unsigned int readinterval;
1319 OUT unsigned int readconst;
1320 OUT unsigned int readmult;
1321 OUT unsigned int writeconst;
1322 OUT unsigned int writemult;
1323 OUT unsigned int eventmask;
1324 OUT unsigned int commerror;
1327 struct set_serial_info_request
1329 REQUEST_HEADER; /* request header */
1330 IN handle_t handle; /* handle to comm port */
1331 IN int flags; /* bitmask to set values (see below) */
1332 IN unsigned int readinterval;
1333 IN unsigned int readconst;
1334 IN unsigned int readmult;
1335 IN unsigned int writeconst;
1336 IN unsigned int writemult;
1337 IN unsigned int eventmask;
1338 IN unsigned int commerror;
1340 #define SERIALINFO_SET_TIMEOUTS 0x01
1341 #define SERIALINFO_SET_MASK 0x02
1342 #define SERIALINFO_SET_ERROR 0x04
1344 struct create_async_request
1346 REQUEST_HEADER; /* request header */
1347 IN handle_t file_handle; /* handle to comm port */
1348 IN void* overlapped;
1349 IN void* buffer;
1350 IN int count;
1351 IN void* func;
1352 IN int type;
1353 OUT handle_t ov_handle;
1355 #define ASYNC_TYPE_READ 0x01
1356 #define ASYNC_TYPE_WRITE 0x02
1357 #define ASYNC_TYPE_WAIT 0x03
1360 * Used by service thread to tell the server that the current
1361 * operation has completed
1363 struct async_result_request
1365 REQUEST_HEADER; /* request header */
1366 IN handle_t ov_handle;
1367 IN int result; /* NT status code */
1370 /* Everything below this line is generated automatically by tools/make_requests */
1371 /* ### make_requests begin ### */
1373 enum request
1375 REQ_new_process,
1376 REQ_get_new_process_info,
1377 REQ_new_thread,
1378 REQ_boot_done,
1379 REQ_init_process,
1380 REQ_init_process_done,
1381 REQ_init_thread,
1382 REQ_get_thread_buffer,
1383 REQ_terminate_process,
1384 REQ_terminate_thread,
1385 REQ_get_process_info,
1386 REQ_set_process_info,
1387 REQ_get_thread_info,
1388 REQ_set_thread_info,
1389 REQ_suspend_thread,
1390 REQ_resume_thread,
1391 REQ_load_dll,
1392 REQ_unload_dll,
1393 REQ_queue_apc,
1394 REQ_get_apc,
1395 REQ_close_handle,
1396 REQ_set_handle_info,
1397 REQ_dup_handle,
1398 REQ_open_process,
1399 REQ_select,
1400 REQ_create_event,
1401 REQ_event_op,
1402 REQ_open_event,
1403 REQ_create_mutex,
1404 REQ_release_mutex,
1405 REQ_open_mutex,
1406 REQ_create_semaphore,
1407 REQ_release_semaphore,
1408 REQ_open_semaphore,
1409 REQ_create_file,
1410 REQ_alloc_file_handle,
1411 REQ_get_handle_fd,
1412 REQ_set_file_pointer,
1413 REQ_truncate_file,
1414 REQ_set_file_time,
1415 REQ_flush_file,
1416 REQ_get_file_info,
1417 REQ_lock_file,
1418 REQ_unlock_file,
1419 REQ_create_pipe,
1420 REQ_create_socket,
1421 REQ_accept_socket,
1422 REQ_set_socket_event,
1423 REQ_get_socket_event,
1424 REQ_enable_socket_event,
1425 REQ_alloc_console,
1426 REQ_free_console,
1427 REQ_open_console,
1428 REQ_set_console_fd,
1429 REQ_get_console_mode,
1430 REQ_set_console_mode,
1431 REQ_set_console_info,
1432 REQ_get_console_info,
1433 REQ_write_console_input,
1434 REQ_read_console_input,
1435 REQ_create_change_notification,
1436 REQ_create_mapping,
1437 REQ_open_mapping,
1438 REQ_get_mapping_info,
1439 REQ_create_device,
1440 REQ_create_snapshot,
1441 REQ_next_process,
1442 REQ_next_thread,
1443 REQ_next_module,
1444 REQ_wait_debug_event,
1445 REQ_queue_exception_event,
1446 REQ_get_exception_status,
1447 REQ_output_debug_string,
1448 REQ_continue_debug_event,
1449 REQ_debug_process,
1450 REQ_read_process_memory,
1451 REQ_write_process_memory,
1452 REQ_create_key,
1453 REQ_open_key,
1454 REQ_delete_key,
1455 REQ_enum_key,
1456 REQ_set_key_value,
1457 REQ_get_key_value,
1458 REQ_enum_key_value,
1459 REQ_delete_key_value,
1460 REQ_load_registry,
1461 REQ_save_registry,
1462 REQ_save_registry_atexit,
1463 REQ_set_registry_levels,
1464 REQ_create_timer,
1465 REQ_open_timer,
1466 REQ_set_timer,
1467 REQ_cancel_timer,
1468 REQ_get_thread_context,
1469 REQ_set_thread_context,
1470 REQ_get_selector_entry,
1471 REQ_add_atom,
1472 REQ_delete_atom,
1473 REQ_find_atom,
1474 REQ_get_atom_name,
1475 REQ_init_atom_table,
1476 REQ_get_msg_queue,
1477 REQ_wake_queue,
1478 REQ_wait_input_idle,
1479 REQ_create_serial,
1480 REQ_get_serial_info,
1481 REQ_set_serial_info,
1482 REQ_create_async,
1483 REQ_async_result,
1484 REQ_NB_REQUESTS
1487 union generic_request
1489 struct request_max_size max_size;
1490 struct request_header header;
1491 struct new_process_request new_process;
1492 struct get_new_process_info_request get_new_process_info;
1493 struct new_thread_request new_thread;
1494 struct boot_done_request boot_done;
1495 struct init_process_request init_process;
1496 struct init_process_done_request init_process_done;
1497 struct init_thread_request init_thread;
1498 struct get_thread_buffer_request get_thread_buffer;
1499 struct terminate_process_request terminate_process;
1500 struct terminate_thread_request terminate_thread;
1501 struct get_process_info_request get_process_info;
1502 struct set_process_info_request set_process_info;
1503 struct get_thread_info_request get_thread_info;
1504 struct set_thread_info_request set_thread_info;
1505 struct suspend_thread_request suspend_thread;
1506 struct resume_thread_request resume_thread;
1507 struct load_dll_request load_dll;
1508 struct unload_dll_request unload_dll;
1509 struct queue_apc_request queue_apc;
1510 struct get_apc_request get_apc;
1511 struct close_handle_request close_handle;
1512 struct set_handle_info_request set_handle_info;
1513 struct dup_handle_request dup_handle;
1514 struct open_process_request open_process;
1515 struct select_request select;
1516 struct create_event_request create_event;
1517 struct event_op_request event_op;
1518 struct open_event_request open_event;
1519 struct create_mutex_request create_mutex;
1520 struct release_mutex_request release_mutex;
1521 struct open_mutex_request open_mutex;
1522 struct create_semaphore_request create_semaphore;
1523 struct release_semaphore_request release_semaphore;
1524 struct open_semaphore_request open_semaphore;
1525 struct create_file_request create_file;
1526 struct alloc_file_handle_request alloc_file_handle;
1527 struct get_handle_fd_request get_handle_fd;
1528 struct set_file_pointer_request set_file_pointer;
1529 struct truncate_file_request truncate_file;
1530 struct set_file_time_request set_file_time;
1531 struct flush_file_request flush_file;
1532 struct get_file_info_request get_file_info;
1533 struct lock_file_request lock_file;
1534 struct unlock_file_request unlock_file;
1535 struct create_pipe_request create_pipe;
1536 struct create_socket_request create_socket;
1537 struct accept_socket_request accept_socket;
1538 struct set_socket_event_request set_socket_event;
1539 struct get_socket_event_request get_socket_event;
1540 struct enable_socket_event_request enable_socket_event;
1541 struct alloc_console_request alloc_console;
1542 struct free_console_request free_console;
1543 struct open_console_request open_console;
1544 struct set_console_fd_request set_console_fd;
1545 struct get_console_mode_request get_console_mode;
1546 struct set_console_mode_request set_console_mode;
1547 struct set_console_info_request set_console_info;
1548 struct get_console_info_request get_console_info;
1549 struct write_console_input_request write_console_input;
1550 struct read_console_input_request read_console_input;
1551 struct create_change_notification_request create_change_notification;
1552 struct create_mapping_request create_mapping;
1553 struct open_mapping_request open_mapping;
1554 struct get_mapping_info_request get_mapping_info;
1555 struct create_device_request create_device;
1556 struct create_snapshot_request create_snapshot;
1557 struct next_process_request next_process;
1558 struct next_thread_request next_thread;
1559 struct next_module_request next_module;
1560 struct wait_debug_event_request wait_debug_event;
1561 struct queue_exception_event_request queue_exception_event;
1562 struct get_exception_status_request get_exception_status;
1563 struct output_debug_string_request output_debug_string;
1564 struct continue_debug_event_request continue_debug_event;
1565 struct debug_process_request debug_process;
1566 struct read_process_memory_request read_process_memory;
1567 struct write_process_memory_request write_process_memory;
1568 struct create_key_request create_key;
1569 struct open_key_request open_key;
1570 struct delete_key_request delete_key;
1571 struct enum_key_request enum_key;
1572 struct set_key_value_request set_key_value;
1573 struct get_key_value_request get_key_value;
1574 struct enum_key_value_request enum_key_value;
1575 struct delete_key_value_request delete_key_value;
1576 struct load_registry_request load_registry;
1577 struct save_registry_request save_registry;
1578 struct save_registry_atexit_request save_registry_atexit;
1579 struct set_registry_levels_request set_registry_levels;
1580 struct create_timer_request create_timer;
1581 struct open_timer_request open_timer;
1582 struct set_timer_request set_timer;
1583 struct cancel_timer_request cancel_timer;
1584 struct get_thread_context_request get_thread_context;
1585 struct set_thread_context_request set_thread_context;
1586 struct get_selector_entry_request get_selector_entry;
1587 struct add_atom_request add_atom;
1588 struct delete_atom_request delete_atom;
1589 struct find_atom_request find_atom;
1590 struct get_atom_name_request get_atom_name;
1591 struct init_atom_table_request init_atom_table;
1592 struct get_msg_queue_request get_msg_queue;
1593 struct wake_queue_request wake_queue;
1594 struct wait_input_idle_request wait_input_idle;
1595 struct create_serial_request create_serial;
1596 struct get_serial_info_request get_serial_info;
1597 struct set_serial_info_request set_serial_info;
1598 struct create_async_request create_async;
1599 struct async_result_request async_result;
1602 #define SERVER_PROTOCOL_VERSION 40
1604 /* ### make_requests end ### */
1605 /* Everything above this line is generated automatically by tools/make_requests */
1607 #undef REQUEST_HEADER
1608 #undef VARARG
1610 /* client-side functions */
1612 #ifndef __WINE_SERVER__
1614 #include "thread.h"
1615 #include "ntddk.h"
1616 #include "wine/exception.h"
1618 /* client communication functions */
1620 extern unsigned int wine_server_call( union generic_request *req, size_t size );
1621 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1622 extern void server_protocol_perror( const char *err ) WINE_NORETURN;
1623 extern void wine_server_alloc_req( union generic_request *req, size_t size );
1624 extern void wine_server_send_fd( int fd );
1625 extern int wine_server_recv_fd( int handle, int cache );
1626 extern const char *get_config_dir(void);
1628 /* do a server call and set the last error code */
1629 inline static unsigned int __server_call_err( union generic_request *req, size_t size )
1631 unsigned int res = wine_server_call( req, size );
1632 if (res) SetLastError( RtlNtStatusToDosError(res) );
1633 return res;
1636 /* get a pointer to the variable part of the request */
1637 inline static void *server_data_ptr( const void *req )
1639 return (char *)NtCurrentTeb()->buffer + ((struct request_header *)req)->var_offset;
1642 /* get the size of the variable part of the request */
1643 inline static size_t server_data_size( const void *req )
1645 return ((struct request_header *)req)->var_size;
1649 /* exception support for server calls */
1651 extern DWORD __wine_server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1652 CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1654 struct __server_exception_frame
1656 EXCEPTION_FRAME frame;
1657 unsigned int buffer_pos; /* saved buffer position */
1661 /* macros for server requests */
1663 #define SERVER_START_REQ(type) \
1664 do { \
1665 union generic_request __req; \
1666 struct type##_request * const req = &__req.type; \
1667 __req.header.req = REQ_##type; \
1668 __req.header.var_size = 0; \
1671 #define SERVER_END_REQ \
1672 while(0); \
1673 } while(0)
1675 #define SERVER_START_VAR_REQ(type,size) \
1676 do { \
1677 struct __server_exception_frame __f; \
1678 union generic_request __req; \
1679 struct type##_request * const req = &__req.type; \
1680 __f.frame.Handler = __wine_server_exception_handler; \
1681 __f.buffer_pos = NtCurrentTeb()->buffer_pos; \
1682 __wine_push_frame( &__f.frame ); \
1683 __req.header.req = REQ_##type; \
1684 wine_server_alloc_req( &__req, (size) ); \
1687 #define SERVER_END_VAR_REQ \
1688 while(0); \
1689 NtCurrentTeb()->buffer_pos = __f.buffer_pos; \
1690 __wine_pop_frame( &__f.frame ); \
1691 } while(0)
1693 #define SERVER_CALL() (wine_server_call( &__req, sizeof(*req) ))
1694 #define SERVER_CALL_ERR() (__server_call_err( &__req, sizeof(*req) ))
1697 extern int CLIENT_InitServer(void);
1698 extern int CLIENT_BootDone( int debug_level );
1699 extern int CLIENT_IsBootThread(void);
1700 extern int CLIENT_InitThread(void);
1701 #endif /* __WINE_SERVER__ */
1703 #endif /* __WINE_SERVER_H */