Added one safety check to AFM parsing.
[wine/multimedia.git] / include / server.h
blobd7c7075f393f4f0250d1d06408bd6be1c0510eb8
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 fixed_size; /* size of the fixed 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
48 /* definitions of the event data depending on the event code */
49 struct debug_event_exception
51 EXCEPTION_RECORD record; /* exception record */
52 int first; /* first chance exception? */
54 struct debug_event_create_thread
56 int handle; /* handle to the new thread */
57 void *teb; /* thread teb (in debugged process address space) */
58 void *start; /* thread startup routine */
60 struct debug_event_create_process
62 int file; /* handle to the process exe file */
63 int process; /* handle to the new process */
64 int thread; /* handle to the new thread */
65 void *base; /* base of executable image */
66 int dbg_offset; /* offset of debug info in file */
67 int dbg_size; /* size of debug info */
68 void *teb; /* thread teb (in debugged process address space) */
69 void *start; /* thread startup routine */
70 void *name; /* image name (optional) */
71 int unicode; /* is it Unicode? */
73 struct debug_event_exit
75 int exit_code; /* thread or process exit code */
77 struct debug_event_load_dll
79 int handle; /* file handle for the dll */
80 void *base; /* base address of the dll */
81 int dbg_offset; /* offset of debug info in file */
82 int dbg_size; /* size of debug info */
83 void *name; /* image name (optional) */
84 int unicode; /* is it Unicode? */
86 struct debug_event_unload_dll
88 void *base; /* base address of the dll */
90 struct debug_event_output_string
92 void *string; /* string to display (in debugged process address space) */
93 int unicode; /* is it Unicode? */
94 int length; /* string length */
96 struct debug_event_rip_info
98 int error; /* ??? */
99 int type; /* ??? */
101 union debug_event_data
103 struct debug_event_exception exception;
104 struct debug_event_create_thread create_thread;
105 struct debug_event_create_process create_process;
106 struct debug_event_exit exit;
107 struct debug_event_load_dll load_dll;
108 struct debug_event_unload_dll unload_dll;
109 struct debug_event_output_string output_string;
110 struct debug_event_rip_info rip_info;
113 /* debug event data */
114 typedef struct
116 int code; /* event code */
117 union debug_event_data info; /* event information */
118 } debug_event_t;
121 /* Create a new process from the context of the parent */
122 struct new_process_request
124 REQUEST_HEADER; /* request header */
125 IN int inherit_all; /* inherit all handles from parent */
126 IN int create_flags; /* creation flags */
127 IN int start_flags; /* flags from startup info */
128 IN int exe_file; /* file handle for main exe */
129 IN int hstdin; /* handle for stdin */
130 IN int hstdout; /* handle for stdout */
131 IN int hstderr; /* handle for stderr */
132 IN int cmd_show; /* main window show mode */
133 IN VARARG(filename,string); /* file name of main exe */
137 /* Wait for the new process to start */
138 struct wait_process_request
140 REQUEST_HEADER; /* request header */
141 IN int pinherit; /* process handle inherit flag */
142 IN int tinherit; /* thread handle inherit flag */
143 IN int timeout; /* wait timeout */
144 IN int cancel; /* cancel the process creation? */
145 OUT void* pid; /* process id */
146 OUT int phandle; /* process handle (in the current process) */
147 OUT void* tid; /* thread id */
148 OUT int thandle; /* thread handle (in the current process) */
149 OUT int event; /* event handle to signal startup */
153 /* Create a new thread from the context of the parent */
154 struct new_thread_request
156 REQUEST_HEADER; /* request header */
157 IN int suspend; /* new thread should be suspended on creation */
158 IN int inherit; /* inherit flag */
159 OUT void* tid; /* thread id */
160 OUT int handle; /* thread handle (in the current process) */
164 /* Signal that we are finished booting on the client side */
165 struct boot_done_request
167 REQUEST_HEADER; /* request header */
168 IN int debug_level; /* new debug level */
172 /* Initialize a process; called from the new process context */
173 struct init_process_request
175 REQUEST_HEADER; /* request header */
176 IN void* ldt_copy; /* addr of LDT copy */
177 IN int ppid; /* parent Unix pid */
178 OUT int start_flags; /* flags from startup info */
179 OUT unsigned int server_start; /* server start time (GetTickCount) */
180 OUT int exe_file; /* file handle for main exe */
181 OUT int hstdin; /* handle for stdin */
182 OUT int hstdout; /* handle for stdout */
183 OUT int hstderr; /* handle for stderr */
184 OUT int cmd_show; /* main window show mode */
185 OUT VARARG(filename,string); /* file name of main exe */
189 /* Signal the end of the process initialization */
190 struct init_process_done_request
192 REQUEST_HEADER; /* request header */
193 IN void* module; /* main module base address */
194 IN void* entry; /* process entry point */
195 IN void* name; /* ptr to ptr to name (in process addr space) */
196 IN int gui; /* is it a GUI process? */
197 OUT int debugged; /* being debugged? */
201 /* Initialize a thread; called from the child after fork()/clone() */
202 struct init_thread_request
204 REQUEST_HEADER; /* request header */
205 IN int unix_pid; /* Unix pid of new thread */
206 IN void* teb; /* TEB of new thread (in thread address space) */
207 IN void* entry; /* thread entry point (in thread address space) */
211 /* Retrieve the thread buffer file descriptor */
212 /* The reply to this request is the first thing a newly */
213 /* created thread gets (without having to request it) */
214 struct get_thread_buffer_request
216 REQUEST_HEADER; /* request header */
217 OUT void* pid; /* process id of the new thread's process */
218 OUT void* tid; /* thread id of the new thread */
219 OUT int boot; /* is this the boot thread? */
220 OUT int version; /* protocol version */
224 /* Terminate a process */
225 struct terminate_process_request
227 REQUEST_HEADER; /* request header */
228 IN int handle; /* process handle to terminate */
229 IN int exit_code; /* process exit code */
230 OUT int self; /* suicide? */
234 /* Terminate a thread */
235 struct terminate_thread_request
237 REQUEST_HEADER; /* request header */
238 IN int handle; /* thread handle to terminate */
239 IN int exit_code; /* thread exit code */
240 OUT int self; /* suicide? */
241 OUT int last; /* last thread in this process? */
245 /* Retrieve information about a process */
246 struct get_process_info_request
248 REQUEST_HEADER; /* request header */
249 IN int handle; /* process handle */
250 OUT void* pid; /* server process id */
251 OUT int debugged; /* debugged? */
252 OUT int exit_code; /* process exit code */
253 OUT int priority; /* priority class */
254 OUT int process_affinity; /* process affinity mask */
255 OUT int system_affinity; /* system affinity mask */
259 /* Set a process informations */
260 struct set_process_info_request
262 REQUEST_HEADER; /* request header */
263 IN int handle; /* process handle */
264 IN int mask; /* setting mask (see below) */
265 IN int priority; /* priority class */
266 IN int affinity; /* affinity mask */
268 #define SET_PROCESS_INFO_PRIORITY 0x01
269 #define SET_PROCESS_INFO_AFFINITY 0x02
272 /* Retrieve information about a thread */
273 struct get_thread_info_request
275 REQUEST_HEADER; /* request header */
276 IN int handle; /* thread handle */
277 IN void* tid_in; /* thread id (optional) */
278 OUT void* tid; /* server thread id */
279 OUT void* teb; /* thread teb pointer */
280 OUT int exit_code; /* thread exit code */
281 OUT int priority; /* thread priority level */
285 /* Set a thread informations */
286 struct set_thread_info_request
288 REQUEST_HEADER; /* request header */
289 IN int handle; /* thread handle */
290 IN int mask; /* setting mask (see below) */
291 IN int priority; /* priority class */
292 IN int affinity; /* affinity mask */
294 #define SET_THREAD_INFO_PRIORITY 0x01
295 #define SET_THREAD_INFO_AFFINITY 0x02
298 /* Suspend a thread */
299 struct suspend_thread_request
301 REQUEST_HEADER; /* request header */
302 IN int handle; /* thread handle */
303 OUT int count; /* new suspend count */
307 /* Resume a thread */
308 struct resume_thread_request
310 REQUEST_HEADER; /* request header */
311 IN int handle; /* thread handle */
312 OUT int count; /* new suspend count */
316 /* Notify the server that a dll has been loaded */
317 struct load_dll_request
319 REQUEST_HEADER; /* request header */
320 IN int handle; /* file handle */
321 IN void* base; /* base address */
322 IN int dbg_offset; /* debug info offset */
323 IN int dbg_size; /* debug info size */
324 IN void* name; /* ptr to ptr to name (in process addr space) */
328 /* Notify the server that a dll is being unloaded */
329 struct unload_dll_request
331 REQUEST_HEADER; /* request header */
332 IN void* base; /* base address */
336 /* Queue an APC for a thread */
337 struct queue_apc_request
339 REQUEST_HEADER; /* request header */
340 IN int handle; /* thread handle */
341 IN void* func; /* function to call */
342 IN void* param; /* param for function to call */
346 /* Get next APC to call */
347 struct get_apc_request
349 REQUEST_HEADER; /* request header */
350 OUT void* func; /* function to call */
351 OUT int type; /* function type */
352 OUT VARARG(args,ptrs); /* function arguments */
354 enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC };
357 /* Close a handle for the current process */
358 struct close_handle_request
360 REQUEST_HEADER; /* request header */
361 IN int handle; /* handle to close */
362 OUT int fd; /* associated fd to close */
366 /* Set a handle information */
367 struct set_handle_info_request
369 REQUEST_HEADER; /* request header */
370 IN int handle; /* handle we are interested in */
371 IN int flags; /* new handle flags */
372 IN int mask; /* mask for flags to set */
373 IN int fd; /* file descriptor or -1 */
374 OUT int old_flags; /* old flag value */
375 OUT int cur_fd; /* current file descriptor */
379 /* Duplicate a handle */
380 struct dup_handle_request
382 REQUEST_HEADER; /* request header */
383 IN int src_process; /* src process handle */
384 IN int src_handle; /* src handle to duplicate */
385 IN int dst_process; /* dst process handle */
386 IN unsigned int access; /* wanted access rights */
387 IN int inherit; /* inherit flag */
388 IN int options; /* duplicate options (see below) */
389 OUT int handle; /* duplicated handle in dst process */
390 OUT int fd; /* associated fd to close */
392 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
393 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
394 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
397 /* Open a handle to a process */
398 struct open_process_request
400 REQUEST_HEADER; /* request header */
401 IN void* pid; /* process id to open */
402 IN unsigned int access; /* wanted access rights */
403 IN int inherit; /* inherit flag */
404 OUT int handle; /* handle to the process */
408 /* Wait for handles */
409 struct select_request
411 REQUEST_HEADER; /* request header */
412 IN int flags; /* wait flags (see below) */
413 IN int timeout; /* timeout in ms */
414 OUT int signaled; /* signaled handle */
415 IN VARARG(handles,ints); /* handles to select on */
417 #define SELECT_ALL 1
418 #define SELECT_ALERTABLE 2
419 #define SELECT_TIMEOUT 4
422 /* Create an event */
423 struct create_event_request
425 REQUEST_HEADER; /* request header */
426 IN int manual_reset; /* manual reset event */
427 IN int initial_state; /* initial state of the event */
428 IN int inherit; /* inherit flag */
429 OUT int handle; /* handle to the event */
430 IN VARARG(name,unicode_str); /* object name */
433 /* Event operation */
434 struct event_op_request
436 REQUEST_HEADER; /* request header */
437 IN int handle; /* handle to event */
438 IN int op; /* event operation (see below) */
440 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
443 /* Open an event */
444 struct open_event_request
446 REQUEST_HEADER; /* request header */
447 IN unsigned int access; /* wanted access rights */
448 IN int inherit; /* inherit flag */
449 OUT int handle; /* handle to the event */
450 IN VARARG(name,unicode_str); /* object name */
454 /* Create a mutex */
455 struct create_mutex_request
457 REQUEST_HEADER; /* request header */
458 IN int owned; /* initially owned? */
459 IN int inherit; /* inherit flag */
460 OUT int handle; /* handle to the mutex */
461 IN VARARG(name,unicode_str); /* object name */
465 /* Release a mutex */
466 struct release_mutex_request
468 REQUEST_HEADER; /* request header */
469 IN int handle; /* handle to the mutex */
473 /* Open a mutex */
474 struct open_mutex_request
476 REQUEST_HEADER; /* request header */
477 IN unsigned int access; /* wanted access rights */
478 IN int inherit; /* inherit flag */
479 OUT int handle; /* handle to the mutex */
480 IN VARARG(name,unicode_str); /* object name */
484 /* Create a semaphore */
485 struct create_semaphore_request
487 REQUEST_HEADER; /* request header */
488 IN unsigned int initial; /* initial count */
489 IN unsigned int max; /* maximum count */
490 IN int inherit; /* inherit flag */
491 OUT int handle; /* handle to the semaphore */
492 IN VARARG(name,unicode_str); /* object name */
496 /* Release a semaphore */
497 struct release_semaphore_request
499 REQUEST_HEADER; /* request header */
500 IN int handle; /* handle to the semaphore */
501 IN unsigned int count; /* count to add to semaphore */
502 OUT unsigned int prev_count; /* previous semaphore count */
506 /* Open a semaphore */
507 struct open_semaphore_request
509 REQUEST_HEADER; /* request header */
510 IN unsigned int access; /* wanted access rights */
511 IN int inherit; /* inherit flag */
512 OUT int handle; /* handle to the semaphore */
513 IN VARARG(name,unicode_str); /* object name */
517 /* Create a file */
518 struct create_file_request
520 REQUEST_HEADER; /* request header */
521 IN unsigned int access; /* wanted access rights */
522 IN int inherit; /* inherit flag */
523 IN unsigned int sharing; /* sharing flags */
524 IN int create; /* file create action */
525 IN unsigned int attrs; /* file attributes for creation */
526 OUT int handle; /* handle to the file */
527 IN VARARG(filename,string); /* file name */
531 /* Allocate a file handle for a Unix fd */
532 struct alloc_file_handle_request
534 REQUEST_HEADER; /* request header */
535 IN unsigned int access; /* wanted access rights */
536 OUT int handle; /* handle to the file */
540 /* Get a Unix fd to access a file */
541 struct get_handle_fd_request
543 REQUEST_HEADER; /* request header */
544 IN int handle; /* handle to the file */
545 IN unsigned int access; /* wanted access rights */
546 OUT int fd; /* file descriptor */
550 /* Set a file current position */
551 struct set_file_pointer_request
553 REQUEST_HEADER; /* request header */
554 IN int handle; /* handle to the file */
555 IN int low; /* position low word */
556 IN int high; /* position high word */
557 IN int whence; /* whence to seek */
558 OUT int new_low; /* new position low word */
559 OUT int new_high; /* new position high word */
563 /* Truncate (or extend) a file */
564 struct truncate_file_request
566 REQUEST_HEADER; /* request header */
567 IN int handle; /* handle to the file */
571 /* Set a file access and modification times */
572 struct set_file_time_request
574 REQUEST_HEADER; /* request header */
575 IN int handle; /* handle to the file */
576 IN time_t access_time; /* last access time */
577 IN time_t write_time; /* last write time */
581 /* Flush a file buffers */
582 struct flush_file_request
584 REQUEST_HEADER; /* request header */
585 IN int handle; /* handle to the file */
589 /* Get information about a file */
590 struct get_file_info_request
592 REQUEST_HEADER; /* request header */
593 IN int handle; /* handle to the file */
594 OUT int type; /* file type */
595 OUT int attr; /* file attributes */
596 OUT time_t access_time; /* last access time */
597 OUT time_t write_time; /* last write time */
598 OUT int size_high; /* file size */
599 OUT int size_low; /* file size */
600 OUT int links; /* number of links */
601 OUT int index_high; /* unique index */
602 OUT int index_low; /* unique index */
603 OUT unsigned int serial; /* volume serial number */
607 /* Lock a region of a file */
608 struct lock_file_request
610 REQUEST_HEADER; /* request header */
611 IN int handle; /* handle to the file */
612 IN unsigned int offset_low; /* offset of start of lock */
613 IN unsigned int offset_high; /* offset of start of lock */
614 IN unsigned int count_low; /* count of bytes to lock */
615 IN unsigned int count_high; /* count of bytes to lock */
619 /* Unlock a region of a file */
620 struct unlock_file_request
622 REQUEST_HEADER; /* request header */
623 IN int handle; /* handle to the file */
624 IN unsigned int offset_low; /* offset of start of unlock */
625 IN unsigned int offset_high; /* offset of start of unlock */
626 IN unsigned int count_low; /* count of bytes to unlock */
627 IN unsigned int count_high; /* count of bytes to unlock */
631 /* Create an anonymous pipe */
632 struct create_pipe_request
634 REQUEST_HEADER; /* request header */
635 IN int inherit; /* inherit flag */
636 OUT int handle_read; /* handle to the read-side of the pipe */
637 OUT int handle_write; /* handle to the write-side of the pipe */
641 /* Create a socket */
642 struct create_socket_request
644 REQUEST_HEADER; /* request header */
645 IN unsigned int access; /* wanted access rights */
646 IN int inherit; /* inherit flag */
647 IN int family; /* family, see socket manpage */
648 IN int type; /* type, see socket manpage */
649 IN int protocol; /* protocol, see socket manpage */
650 OUT int handle; /* handle to the new socket */
654 /* Accept a socket */
655 struct accept_socket_request
657 REQUEST_HEADER; /* request header */
658 IN int lhandle; /* handle to the listening socket */
659 IN unsigned int access; /* wanted access rights */
660 IN int inherit; /* inherit flag */
661 OUT int handle; /* handle to the new socket */
665 /* Set socket event parameters */
666 struct set_socket_event_request
668 REQUEST_HEADER; /* request header */
669 IN int handle; /* handle to the socket */
670 IN unsigned int mask; /* event mask */
671 IN int event; /* event object */
675 /* Get socket event parameters */
676 struct get_socket_event_request
678 REQUEST_HEADER; /* request header */
679 IN int handle; /* handle to the socket */
680 IN int service; /* clear pending? */
681 IN int s_event; /* "expected" event object */
682 IN int c_event; /* event to clear */
683 OUT unsigned int mask; /* event mask */
684 OUT unsigned int pmask; /* pending events */
685 OUT unsigned int state; /* status bits */
686 OUT VARARG(errors,ints); /* event errors */
690 /* Reenable pending socket events */
691 struct enable_socket_event_request
693 REQUEST_HEADER; /* request header */
694 IN int handle; /* handle to the socket */
695 IN unsigned int mask; /* events to re-enable */
696 IN unsigned int sstate; /* status bits to set */
697 IN unsigned int cstate; /* status bits to clear */
701 /* Allocate a console for the current process */
702 struct alloc_console_request
704 REQUEST_HEADER; /* request header */
705 IN unsigned int access; /* wanted access rights */
706 IN int inherit; /* inherit flag */
707 OUT int handle_in; /* handle to console input */
708 OUT int handle_out; /* handle to console output */
712 /* Free the console of the current process */
713 struct free_console_request
715 REQUEST_HEADER; /* request header */
719 /* Open a handle to the process console */
720 struct open_console_request
722 REQUEST_HEADER; /* request header */
723 IN int output; /* input or output? */
724 IN unsigned int access; /* wanted access rights */
725 IN int inherit; /* inherit flag */
726 OUT int handle; /* handle to the console */
730 /* Set a console file descriptor */
731 struct set_console_fd_request
733 REQUEST_HEADER; /* request header */
734 IN int handle; /* handle to the console */
735 IN int file_handle; /* handle of file to use as file descriptor */
736 IN int pid; /* pid of xterm (hack) */
740 /* Get a console mode (input or output) */
741 struct get_console_mode_request
743 REQUEST_HEADER; /* request header */
744 IN int handle; /* handle to the console */
745 OUT int mode; /* console mode */
749 /* Set a console mode (input or output) */
750 struct set_console_mode_request
752 REQUEST_HEADER; /* request header */
753 IN int handle; /* handle to the console */
754 IN int mode; /* console mode */
758 /* Set info about a console (output only) */
759 struct set_console_info_request
761 REQUEST_HEADER; /* request header */
762 IN int handle; /* handle to the console */
763 IN int mask; /* setting mask (see below) */
764 IN int cursor_size; /* size of cursor (percentage filled) */
765 IN int cursor_visible;/* cursor visibility flag */
766 IN VARARG(title,string); /* console title */
768 #define SET_CONSOLE_INFO_CURSOR 0x01
769 #define SET_CONSOLE_INFO_TITLE 0x02
771 /* Get info about a console (output only) */
772 struct get_console_info_request
774 REQUEST_HEADER; /* request header */
775 IN int handle; /* handle to the console */
776 OUT int cursor_size; /* size of cursor (percentage filled) */
777 OUT int cursor_visible;/* cursor visibility flag */
778 OUT int pid; /* pid of xterm (hack) */
779 OUT VARARG(title,string); /* console title */
783 /* Add input records to a console input queue */
784 struct write_console_input_request
786 REQUEST_HEADER; /* request header */
787 IN int handle; /* handle to the console input */
788 OUT int written; /* number of records written */
789 IN VARARG(rec,input_records); /* input records */
792 /* Fetch input records from a console input queue */
793 struct read_console_input_request
795 REQUEST_HEADER; /* request header */
796 IN int handle; /* handle to the console input */
797 IN int flush; /* flush the retrieved records from the queue? */
798 OUT int read; /* number of records read */
799 OUT VARARG(rec,input_records); /* input records */
803 /* Create a change notification */
804 struct create_change_notification_request
806 REQUEST_HEADER; /* request header */
807 IN int subtree; /* watch all the subtree */
808 IN int filter; /* notification filter */
809 OUT int handle; /* handle to the change notification */
813 /* Create a file mapping */
814 struct create_mapping_request
816 REQUEST_HEADER; /* request header */
817 IN int size_high; /* mapping size */
818 IN int size_low; /* mapping size */
819 IN int protect; /* protection flags (see below) */
820 IN int inherit; /* inherit flag */
821 IN int file_handle; /* file handle */
822 OUT int handle; /* handle to the mapping */
823 IN VARARG(name,unicode_str); /* object name */
825 /* protection flags */
826 #define VPROT_READ 0x01
827 #define VPROT_WRITE 0x02
828 #define VPROT_EXEC 0x04
829 #define VPROT_WRITECOPY 0x08
830 #define VPROT_GUARD 0x10
831 #define VPROT_NOCACHE 0x20
832 #define VPROT_COMMITTED 0x40
833 #define VPROT_IMAGE 0x80
836 /* Open a mapping */
837 struct open_mapping_request
839 REQUEST_HEADER; /* request header */
840 IN unsigned int access; /* wanted access rights */
841 IN int inherit; /* inherit flag */
842 OUT int handle; /* handle to the mapping */
843 IN VARARG(name,unicode_str); /* object name */
847 /* Get information about a file mapping */
848 struct get_mapping_info_request
850 REQUEST_HEADER; /* request header */
851 IN int handle; /* handle to the mapping */
852 OUT int size_high; /* mapping size */
853 OUT int size_low; /* mapping size */
854 OUT int protect; /* protection flags */
855 OUT int header_size; /* header size (for VPROT_IMAGE mapping) */
856 OUT void* base; /* default base addr (for VPROT_IMAGE mapping) */
857 OUT int shared_file; /* shared mapping file handle */
858 OUT int shared_size; /* shared mapping size */
859 OUT int anonymous; /* anonymous mapping? */
863 /* Create a device */
864 struct create_device_request
866 REQUEST_HEADER; /* request header */
867 IN unsigned int access; /* wanted access rights */
868 IN int inherit; /* inherit flag */
869 IN int id; /* client private id */
870 OUT int handle; /* handle to the device */
874 /* Create a snapshot */
875 struct create_snapshot_request
877 REQUEST_HEADER; /* request header */
878 IN int inherit; /* inherit flag */
879 IN int flags; /* snapshot flags (TH32CS_*) */
880 IN void* pid; /* process id */
881 OUT int handle; /* handle to the snapshot */
885 /* Get the next process from a snapshot */
886 struct next_process_request
888 REQUEST_HEADER; /* request header */
889 IN int handle; /* handle to the snapshot */
890 IN int reset; /* reset snapshot position? */
891 OUT int count; /* process usage count */
892 OUT void* pid; /* process id */
893 OUT int threads; /* number of threads */
894 OUT int priority; /* process priority */
898 /* Get the next thread from a snapshot */
899 struct next_thread_request
901 REQUEST_HEADER; /* request header */
902 IN int handle; /* handle to the snapshot */
903 IN int reset; /* reset snapshot position? */
904 OUT int count; /* thread usage count */
905 OUT void* pid; /* process id */
906 OUT void* tid; /* thread id */
907 OUT int base_pri; /* base priority */
908 OUT int delta_pri; /* delta priority */
912 /* Get the next module from a snapshot */
913 struct next_module_request
915 REQUEST_HEADER; /* request header */
916 IN int handle; /* handle to the snapshot */
917 IN int reset; /* reset snapshot position? */
918 OUT void* pid; /* process id */
919 OUT void* base; /* module base address */
923 /* Wait for a debug event */
924 struct wait_debug_event_request
926 REQUEST_HEADER; /* request header */
927 IN int timeout; /* timeout in ms */
928 OUT void* pid; /* process id */
929 OUT void* tid; /* thread id */
930 OUT VARARG(event,debug_event); /* debug event data */
934 /* Send an exception event */
935 struct exception_event_request
937 REQUEST_HEADER; /* request header */
938 IN int first; /* first chance exception? */
939 OUT int status; /* event continuation status */
940 IN VARARG(record,exc_event); /* thread context followed by exception record */
941 OUT VARARG(context,context); /* modified thread context */
945 /* Send an output string to the debugger */
946 struct output_debug_string_request
948 REQUEST_HEADER; /* request header */
949 IN void* string; /* string to display (in debugged process address space) */
950 IN int unicode; /* is it Unicode? */
951 IN int length; /* string length */
955 /* Continue a debug event */
956 struct continue_debug_event_request
958 REQUEST_HEADER; /* request header */
959 IN void* pid; /* process id to continue */
960 IN void* tid; /* thread id to continue */
961 IN int status; /* continuation status */
965 /* Start debugging an existing process */
966 struct debug_process_request
968 REQUEST_HEADER; /* request header */
969 IN void* pid; /* id of the process to debug */
973 /* Read data from a process address space */
974 struct read_process_memory_request
976 REQUEST_HEADER; /* request header */
977 IN int handle; /* process handle */
978 IN void* addr; /* addr to read from (must be int-aligned) */
979 IN int len; /* number of ints to read */
980 OUT VARARG(data,bytes); /* result data */
984 /* Write data to a process address space */
985 struct write_process_memory_request
987 REQUEST_HEADER; /* request header */
988 IN int handle; /* process handle */
989 IN void* addr; /* addr to write to (must be int-aligned) */
990 IN int len; /* number of ints to write */
991 IN unsigned int first_mask; /* mask for first word */
992 IN unsigned int last_mask; /* mask for last word */
993 IN VARARG(data,bytes); /* result data */
997 /* Create a registry key */
998 struct create_key_request
1000 REQUEST_HEADER; /* request header */
1001 IN int parent; /* handle to the parent key */
1002 IN unsigned int access; /* desired access rights */
1003 IN unsigned int options; /* creation options */
1004 IN time_t modif; /* last modification time */
1005 OUT int hkey; /* handle to the created key */
1006 OUT int created; /* has it been newly created? */
1007 IN VARARG(name,unicode_len_str); /* key name */
1008 IN VARARG(class,unicode_str); /* class name */
1011 /* Open a registry key */
1012 struct open_key_request
1014 REQUEST_HEADER; /* request header */
1015 IN int parent; /* handle to the parent key */
1016 IN unsigned int access; /* desired access rights */
1017 OUT int hkey; /* handle to the open key */
1018 IN VARARG(name,unicode_str); /* key name */
1022 /* Delete a registry key */
1023 struct delete_key_request
1025 REQUEST_HEADER; /* request header */
1026 IN int hkey; /* handle to the key */
1030 /* Enumerate registry subkeys */
1031 struct enum_key_request
1033 REQUEST_HEADER; /* request header */
1034 IN int hkey; /* handle to registry key */
1035 IN int index; /* index of subkey (or -1 for current key) */
1036 IN int full; /* return the full info? */
1037 OUT int subkeys; /* number of subkeys */
1038 OUT int max_subkey; /* longest subkey name */
1039 OUT int max_class; /* longest class name */
1040 OUT int values; /* number of values */
1041 OUT int max_value; /* longest value name */
1042 OUT int max_data; /* longest value data */
1043 OUT time_t modif; /* last modification time */
1044 OUT VARARG(name,unicode_len_str); /* key name */
1045 OUT VARARG(class,unicode_str); /* class name */
1049 /* Set a value of a registry key */
1050 struct set_key_value_request
1052 REQUEST_HEADER; /* request header */
1053 IN int hkey; /* handle to registry key */
1054 IN int type; /* value type */
1055 IN unsigned int total; /* total value len */
1056 IN unsigned int offset; /* offset for setting data */
1057 IN VARARG(name,unicode_len_str); /* value name */
1058 IN VARARG(data,bytes); /* value data */
1062 /* Retrieve the value of a registry key */
1063 struct get_key_value_request
1065 REQUEST_HEADER; /* request header */
1066 IN int hkey; /* handle to registry key */
1067 IN unsigned int offset; /* offset for getting data */
1068 OUT int type; /* value type */
1069 OUT int len; /* value data len */
1070 IN VARARG(name,unicode_len_str); /* value name */
1071 OUT VARARG(data,bytes); /* value data */
1075 /* Enumerate a value of a registry key */
1076 struct enum_key_value_request
1078 REQUEST_HEADER; /* request header */
1079 IN int hkey; /* handle to registry key */
1080 IN int index; /* value index */
1081 IN unsigned int offset; /* offset for getting data */
1082 OUT int type; /* value type */
1083 OUT int len; /* value data len */
1084 OUT VARARG(name,unicode_len_str); /* value name */
1085 OUT VARARG(data,bytes); /* value data */
1089 /* Delete a value of a registry key */
1090 struct delete_key_value_request
1092 REQUEST_HEADER; /* request header */
1093 IN int hkey; /* handle to registry key */
1094 IN VARARG(name,unicode_str); /* value name */
1098 /* Load a registry branch from a file */
1099 struct load_registry_request
1101 REQUEST_HEADER; /* request header */
1102 IN int hkey; /* root key to load to */
1103 IN int file; /* file to load from */
1104 IN VARARG(name,unicode_str); /* subkey name */
1108 /* Save a registry branch to a file */
1109 struct save_registry_request
1111 REQUEST_HEADER; /* request header */
1112 IN int hkey; /* key to save */
1113 IN int file; /* file to save to */
1117 /* Save a registry branch at server exit */
1118 struct save_registry_atexit_request
1120 REQUEST_HEADER; /* request header */
1121 IN int hkey; /* key to save */
1122 IN VARARG(file,string); /* file to save to */
1126 /* Set the current and saving level for the registry */
1127 struct set_registry_levels_request
1129 REQUEST_HEADER; /* request header */
1130 IN int current; /* new current level */
1131 IN int saving; /* new saving level */
1132 IN int period; /* duration between periodic saves (milliseconds) */
1136 /* Create a waitable timer */
1137 struct create_timer_request
1139 REQUEST_HEADER; /* request header */
1140 IN int inherit; /* inherit flag */
1141 IN int manual; /* manual reset */
1142 OUT int handle; /* handle to the timer */
1143 IN VARARG(name,unicode_str); /* object name */
1147 /* Open a waitable timer */
1148 struct open_timer_request
1150 REQUEST_HEADER; /* request header */
1151 IN unsigned int access; /* wanted access rights */
1152 IN int inherit; /* inherit flag */
1153 OUT int handle; /* handle to the timer */
1154 IN VARARG(name,unicode_str); /* object name */
1157 /* Set a waitable timer */
1158 struct set_timer_request
1160 REQUEST_HEADER; /* request header */
1161 IN int handle; /* handle to the timer */
1162 IN int sec; /* next expiration absolute time */
1163 IN int usec; /* next expiration absolute time */
1164 IN int period; /* timer period in ms */
1165 IN void* callback; /* callback function */
1166 IN void* arg; /* callback argument */
1169 /* Cancel a waitable timer */
1170 struct cancel_timer_request
1172 REQUEST_HEADER; /* request header */
1173 IN int handle; /* handle to the timer */
1177 /* Retrieve the current context of a thread */
1178 struct get_thread_context_request
1180 REQUEST_HEADER; /* request header */
1181 IN int handle; /* thread handle */
1182 IN unsigned int flags; /* context flags */
1183 OUT VARARG(context,context); /* thread context */
1187 /* Set the current context of a thread */
1188 struct set_thread_context_request
1190 REQUEST_HEADER; /* request header */
1191 IN int handle; /* thread handle */
1192 IN unsigned int flags; /* context flags */
1193 IN VARARG(context,context); /* thread context */
1197 /* Fetch a selector entry for a thread */
1198 struct get_selector_entry_request
1200 REQUEST_HEADER; /* request header */
1201 IN int handle; /* thread handle */
1202 IN int entry; /* LDT entry */
1203 OUT unsigned int base; /* selector base */
1204 OUT unsigned int limit; /* selector limit */
1205 OUT unsigned char flags; /* selector flags */
1209 /* Add an atom */
1210 struct add_atom_request
1212 REQUEST_HEADER; /* request header */
1213 IN int local; /* is atom in local process table? */
1214 OUT int atom; /* resulting atom */
1215 IN VARARG(name,unicode_str); /* atom name */
1219 /* Delete an atom */
1220 struct delete_atom_request
1222 REQUEST_HEADER; /* request header */
1223 IN int atom; /* atom handle */
1224 IN int local; /* is atom in local process table? */
1228 /* Find an atom */
1229 struct find_atom_request
1231 REQUEST_HEADER; /* request header */
1232 IN int local; /* is atom in local process table? */
1233 OUT int atom; /* atom handle */
1234 IN VARARG(name,unicode_str); /* atom name */
1238 /* Get an atom name */
1239 struct get_atom_name_request
1241 REQUEST_HEADER; /* request header */
1242 IN int atom; /* atom handle */
1243 IN int local; /* is atom in local process table? */
1244 OUT int count; /* atom lock count */
1245 OUT VARARG(name,unicode_str); /* atom name */
1249 /* Init the process atom table */
1250 struct init_atom_table_request
1252 REQUEST_HEADER; /* request header */
1253 IN int entries; /* number of entries */
1257 /* Get the message queue of the current thread */
1258 struct get_msg_queue_request
1260 REQUEST_HEADER; /* request header */
1261 OUT int handle; /* handle to the queue */
1264 /* Wake up a message queue */
1265 struct wake_queue_request
1267 REQUEST_HEADER; /* request header */
1268 IN int handle; /* handle to the queue */
1269 IN unsigned int bits; /* wake bits */
1272 /* Wait for a process to start waiting on input */
1273 struct wait_input_idle_request
1275 REQUEST_HEADER; /* request header */
1276 IN int handle; /* process handle */
1277 IN int timeout; /* timeout */
1278 OUT int event; /* handle to idle event */
1281 struct create_serial_request
1283 REQUEST_HEADER; /* request header */
1284 IN unsigned int access; /* wanted access rights */
1285 IN int inherit; /* inherit flag */
1286 IN unsigned int sharing; /* sharing flags */
1287 OUT int handle; /* handle to the port */
1288 IN VARARG(name,string); /* file name */
1291 struct get_serial_info_request
1293 REQUEST_HEADER; /* request header */
1294 IN int handle; /* handle to comm port */
1295 OUT unsigned int readinterval;
1296 OUT unsigned int readconst;
1297 OUT unsigned int readmult;
1298 OUT unsigned int writeconst;
1299 OUT unsigned int writemult;
1300 OUT unsigned int eventmask;
1301 OUT unsigned int commerror;
1304 struct set_serial_info_request
1306 REQUEST_HEADER; /* request header */
1307 IN int handle; /* handle to comm port */
1308 IN int flags; /* bitmask to set values (see below) */
1309 IN unsigned int readinterval;
1310 IN unsigned int readconst;
1311 IN unsigned int readmult;
1312 IN unsigned int writeconst;
1313 IN unsigned int writemult;
1314 IN unsigned int eventmask;
1315 IN unsigned int commerror;
1317 #define SERIALINFO_SET_TIMEOUTS 0x01
1318 #define SERIALINFO_SET_MASK 0x02
1319 #define SERIALINFO_SET_ERROR 0x04
1321 struct create_async_request
1323 REQUEST_HEADER; /* request header */
1324 IN int file_handle; /* handle to comm port */
1325 IN void* overlapped;
1326 IN void* buffer;
1327 IN int count;
1328 IN void* func;
1329 IN int type;
1330 OUT int ov_handle;
1332 #define ASYNC_TYPE_READ 0x01
1333 #define ASYNC_TYPE_WRITE 0x02
1334 #define ASYNC_TYPE_WAIT 0x03
1337 * Used by service thread to tell the server that the current
1338 * operation has completed
1340 struct async_result_request
1342 REQUEST_HEADER; /* request header */
1343 IN int ov_handle;
1344 IN int result; /* NT status code */
1347 /* Everything below this line is generated automatically by tools/make_requests */
1348 /* ### make_requests begin ### */
1350 enum request
1352 REQ_NEW_PROCESS,
1353 REQ_WAIT_PROCESS,
1354 REQ_NEW_THREAD,
1355 REQ_BOOT_DONE,
1356 REQ_INIT_PROCESS,
1357 REQ_INIT_PROCESS_DONE,
1358 REQ_INIT_THREAD,
1359 REQ_GET_THREAD_BUFFER,
1360 REQ_TERMINATE_PROCESS,
1361 REQ_TERMINATE_THREAD,
1362 REQ_GET_PROCESS_INFO,
1363 REQ_SET_PROCESS_INFO,
1364 REQ_GET_THREAD_INFO,
1365 REQ_SET_THREAD_INFO,
1366 REQ_SUSPEND_THREAD,
1367 REQ_RESUME_THREAD,
1368 REQ_LOAD_DLL,
1369 REQ_UNLOAD_DLL,
1370 REQ_QUEUE_APC,
1371 REQ_GET_APC,
1372 REQ_CLOSE_HANDLE,
1373 REQ_SET_HANDLE_INFO,
1374 REQ_DUP_HANDLE,
1375 REQ_OPEN_PROCESS,
1376 REQ_SELECT,
1377 REQ_CREATE_EVENT,
1378 REQ_EVENT_OP,
1379 REQ_OPEN_EVENT,
1380 REQ_CREATE_MUTEX,
1381 REQ_RELEASE_MUTEX,
1382 REQ_OPEN_MUTEX,
1383 REQ_CREATE_SEMAPHORE,
1384 REQ_RELEASE_SEMAPHORE,
1385 REQ_OPEN_SEMAPHORE,
1386 REQ_CREATE_FILE,
1387 REQ_ALLOC_FILE_HANDLE,
1388 REQ_GET_HANDLE_FD,
1389 REQ_SET_FILE_POINTER,
1390 REQ_TRUNCATE_FILE,
1391 REQ_SET_FILE_TIME,
1392 REQ_FLUSH_FILE,
1393 REQ_GET_FILE_INFO,
1394 REQ_LOCK_FILE,
1395 REQ_UNLOCK_FILE,
1396 REQ_CREATE_PIPE,
1397 REQ_CREATE_SOCKET,
1398 REQ_ACCEPT_SOCKET,
1399 REQ_SET_SOCKET_EVENT,
1400 REQ_GET_SOCKET_EVENT,
1401 REQ_ENABLE_SOCKET_EVENT,
1402 REQ_ALLOC_CONSOLE,
1403 REQ_FREE_CONSOLE,
1404 REQ_OPEN_CONSOLE,
1405 REQ_SET_CONSOLE_FD,
1406 REQ_GET_CONSOLE_MODE,
1407 REQ_SET_CONSOLE_MODE,
1408 REQ_SET_CONSOLE_INFO,
1409 REQ_GET_CONSOLE_INFO,
1410 REQ_WRITE_CONSOLE_INPUT,
1411 REQ_READ_CONSOLE_INPUT,
1412 REQ_CREATE_CHANGE_NOTIFICATION,
1413 REQ_CREATE_MAPPING,
1414 REQ_OPEN_MAPPING,
1415 REQ_GET_MAPPING_INFO,
1416 REQ_CREATE_DEVICE,
1417 REQ_CREATE_SNAPSHOT,
1418 REQ_NEXT_PROCESS,
1419 REQ_NEXT_THREAD,
1420 REQ_NEXT_MODULE,
1421 REQ_WAIT_DEBUG_EVENT,
1422 REQ_EXCEPTION_EVENT,
1423 REQ_OUTPUT_DEBUG_STRING,
1424 REQ_CONTINUE_DEBUG_EVENT,
1425 REQ_DEBUG_PROCESS,
1426 REQ_READ_PROCESS_MEMORY,
1427 REQ_WRITE_PROCESS_MEMORY,
1428 REQ_CREATE_KEY,
1429 REQ_OPEN_KEY,
1430 REQ_DELETE_KEY,
1431 REQ_ENUM_KEY,
1432 REQ_SET_KEY_VALUE,
1433 REQ_GET_KEY_VALUE,
1434 REQ_ENUM_KEY_VALUE,
1435 REQ_DELETE_KEY_VALUE,
1436 REQ_LOAD_REGISTRY,
1437 REQ_SAVE_REGISTRY,
1438 REQ_SAVE_REGISTRY_ATEXIT,
1439 REQ_SET_REGISTRY_LEVELS,
1440 REQ_CREATE_TIMER,
1441 REQ_OPEN_TIMER,
1442 REQ_SET_TIMER,
1443 REQ_CANCEL_TIMER,
1444 REQ_GET_THREAD_CONTEXT,
1445 REQ_SET_THREAD_CONTEXT,
1446 REQ_GET_SELECTOR_ENTRY,
1447 REQ_ADD_ATOM,
1448 REQ_DELETE_ATOM,
1449 REQ_FIND_ATOM,
1450 REQ_GET_ATOM_NAME,
1451 REQ_INIT_ATOM_TABLE,
1452 REQ_GET_MSG_QUEUE,
1453 REQ_WAKE_QUEUE,
1454 REQ_WAIT_INPUT_IDLE,
1455 REQ_CREATE_SERIAL,
1456 REQ_GET_SERIAL_INFO,
1457 REQ_SET_SERIAL_INFO,
1458 REQ_CREATE_ASYNC,
1459 REQ_ASYNC_RESULT,
1460 REQ_NB_REQUESTS
1463 union generic_request
1465 struct request_max_size max_size;
1466 struct request_header header;
1467 struct new_process_request new_process;
1468 struct wait_process_request wait_process;
1469 struct new_thread_request new_thread;
1470 struct boot_done_request boot_done;
1471 struct init_process_request init_process;
1472 struct init_process_done_request init_process_done;
1473 struct init_thread_request init_thread;
1474 struct get_thread_buffer_request get_thread_buffer;
1475 struct terminate_process_request terminate_process;
1476 struct terminate_thread_request terminate_thread;
1477 struct get_process_info_request get_process_info;
1478 struct set_process_info_request set_process_info;
1479 struct get_thread_info_request get_thread_info;
1480 struct set_thread_info_request set_thread_info;
1481 struct suspend_thread_request suspend_thread;
1482 struct resume_thread_request resume_thread;
1483 struct load_dll_request load_dll;
1484 struct unload_dll_request unload_dll;
1485 struct queue_apc_request queue_apc;
1486 struct get_apc_request get_apc;
1487 struct close_handle_request close_handle;
1488 struct set_handle_info_request set_handle_info;
1489 struct dup_handle_request dup_handle;
1490 struct open_process_request open_process;
1491 struct select_request select;
1492 struct create_event_request create_event;
1493 struct event_op_request event_op;
1494 struct open_event_request open_event;
1495 struct create_mutex_request create_mutex;
1496 struct release_mutex_request release_mutex;
1497 struct open_mutex_request open_mutex;
1498 struct create_semaphore_request create_semaphore;
1499 struct release_semaphore_request release_semaphore;
1500 struct open_semaphore_request open_semaphore;
1501 struct create_file_request create_file;
1502 struct alloc_file_handle_request alloc_file_handle;
1503 struct get_handle_fd_request get_handle_fd;
1504 struct set_file_pointer_request set_file_pointer;
1505 struct truncate_file_request truncate_file;
1506 struct set_file_time_request set_file_time;
1507 struct flush_file_request flush_file;
1508 struct get_file_info_request get_file_info;
1509 struct lock_file_request lock_file;
1510 struct unlock_file_request unlock_file;
1511 struct create_pipe_request create_pipe;
1512 struct create_socket_request create_socket;
1513 struct accept_socket_request accept_socket;
1514 struct set_socket_event_request set_socket_event;
1515 struct get_socket_event_request get_socket_event;
1516 struct enable_socket_event_request enable_socket_event;
1517 struct alloc_console_request alloc_console;
1518 struct free_console_request free_console;
1519 struct open_console_request open_console;
1520 struct set_console_fd_request set_console_fd;
1521 struct get_console_mode_request get_console_mode;
1522 struct set_console_mode_request set_console_mode;
1523 struct set_console_info_request set_console_info;
1524 struct get_console_info_request get_console_info;
1525 struct write_console_input_request write_console_input;
1526 struct read_console_input_request read_console_input;
1527 struct create_change_notification_request create_change_notification;
1528 struct create_mapping_request create_mapping;
1529 struct open_mapping_request open_mapping;
1530 struct get_mapping_info_request get_mapping_info;
1531 struct create_device_request create_device;
1532 struct create_snapshot_request create_snapshot;
1533 struct next_process_request next_process;
1534 struct next_thread_request next_thread;
1535 struct next_module_request next_module;
1536 struct wait_debug_event_request wait_debug_event;
1537 struct exception_event_request exception_event;
1538 struct output_debug_string_request output_debug_string;
1539 struct continue_debug_event_request continue_debug_event;
1540 struct debug_process_request debug_process;
1541 struct read_process_memory_request read_process_memory;
1542 struct write_process_memory_request write_process_memory;
1543 struct create_key_request create_key;
1544 struct open_key_request open_key;
1545 struct delete_key_request delete_key;
1546 struct enum_key_request enum_key;
1547 struct set_key_value_request set_key_value;
1548 struct get_key_value_request get_key_value;
1549 struct enum_key_value_request enum_key_value;
1550 struct delete_key_value_request delete_key_value;
1551 struct load_registry_request load_registry;
1552 struct save_registry_request save_registry;
1553 struct save_registry_atexit_request save_registry_atexit;
1554 struct set_registry_levels_request set_registry_levels;
1555 struct create_timer_request create_timer;
1556 struct open_timer_request open_timer;
1557 struct set_timer_request set_timer;
1558 struct cancel_timer_request cancel_timer;
1559 struct get_thread_context_request get_thread_context;
1560 struct set_thread_context_request set_thread_context;
1561 struct get_selector_entry_request get_selector_entry;
1562 struct add_atom_request add_atom;
1563 struct delete_atom_request delete_atom;
1564 struct find_atom_request find_atom;
1565 struct get_atom_name_request get_atom_name;
1566 struct init_atom_table_request init_atom_table;
1567 struct get_msg_queue_request get_msg_queue;
1568 struct wake_queue_request wake_queue;
1569 struct wait_input_idle_request wait_input_idle;
1570 struct create_serial_request create_serial;
1571 struct get_serial_info_request get_serial_info;
1572 struct set_serial_info_request set_serial_info;
1573 struct create_async_request create_async;
1574 struct async_result_request async_result;
1577 #define SERVER_PROTOCOL_VERSION 31
1579 /* ### make_requests end ### */
1580 /* Everything above this line is generated automatically by tools/make_requests */
1582 #undef REQUEST_HEADER
1583 #undef VARARG
1585 /* format of the server buffer */
1586 struct server_buffer_info
1588 volatile unsigned int cur_req; /* offset of the current request */
1589 volatile unsigned int cur_pos; /* first available position in buffer */
1592 /* client-side functions */
1594 #ifndef __WINE_SERVER__
1596 #include "thread.h"
1597 #include "ntddk.h"
1598 #include "wine/exception.h"
1600 /* client communication functions */
1602 extern unsigned int wine_server_call( enum request req );
1603 extern unsigned int server_call_fd( enum request req, int fd_out );
1604 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1605 extern void *wine_server_alloc_req( size_t fixed_size, size_t var_size );
1606 extern int wine_server_recv_fd( int handle, int cache );
1607 extern const char *get_config_dir(void);
1609 /* compatibility macros */
1610 #define server_alloc_req(f,v) wine_server_alloc_req(f,v)
1611 #define server_call_noerr(req) wine_server_call(req)
1613 /* get a pointer to the request buffer */
1614 static inline void WINE_UNUSED *get_req_buffer(void)
1616 return NtCurrentTeb()->buffer;
1619 /* maximum remaining size in the server buffer */
1620 static inline int WINE_UNUSED server_remaining( const void *ptr )
1622 return (char *)NtCurrentTeb()->buffer_info - (char *)ptr;
1625 /* do a server call and set the last error code */
1626 inline static unsigned int server_call( enum request req )
1628 unsigned int res = wine_server_call( req );
1629 if (res) SetLastError( RtlNtStatusToDosError(res) );
1630 return res;
1633 /* get a pointer to the variable part of the request */
1634 inline static void *server_data_ptr( const void *req )
1636 return (union generic_request *)req + 1;
1639 /* get the size of the variable part of the request */
1640 inline static size_t server_data_size( const void *req )
1642 return ((struct request_header *)req)->var_size;
1646 /* exception support for server calls */
1648 extern DWORD __wine_server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1649 CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1651 struct __server_exception_frame
1653 EXCEPTION_FRAME frame;
1654 struct server_buffer_info info; /* saved buffer information */
1657 #define SERVER_START_REQ \
1658 do { \
1659 struct __server_exception_frame __f; \
1660 __f.frame.Handler = __wine_server_exception_handler; \
1661 __f.info = *NtCurrentTeb()->buffer_info; \
1662 __wine_push_frame( &__f.frame ); \
1663 do {
1665 #define SERVER_END_REQ \
1666 } while(0); \
1667 *NtCurrentTeb()->buffer_info = __f.info; \
1668 __wine_pop_frame( &__f.frame ); \
1669 } while(0);
1671 extern int CLIENT_InitServer(void);
1672 extern int CLIENT_BootDone( int debug_level );
1673 extern int CLIENT_IsBootThread(void);
1674 extern int CLIENT_InitThread(void);
1675 #endif /* __WINE_SERVER__ */
1677 #endif /* __WINE_SERVER_H */