2 * Wine server definitions
4 * Copyright (C) 1998 Alexandre Julliard
7 #ifndef __WINE_SERVER_H
8 #define __WINE_SERVER_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*/
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
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 */
116 int code; /* event code */
117 union debug_event_data info; /* event information */
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 int alloc_fd; /* create the fd pair right now? */
134 IN VARARG(filename,string); /* file name of main exe */
138 /* Wait for the new process to start */
139 struct wait_process_request
141 REQUEST_HEADER; /* request header */
142 IN int pinherit; /* process handle inherit flag */
143 IN int tinherit; /* thread handle inherit flag */
144 IN int timeout; /* wait timeout */
145 IN int cancel; /* cancel the process creation? */
146 OUT void* pid; /* process id */
147 OUT int phandle; /* process handle (in the current process) */
148 OUT void* tid; /* thread id */
149 OUT int thandle; /* thread handle (in the current process) */
150 OUT int event; /* event handle to signal startup */
154 /* Create a new thread from the context of the parent */
155 struct new_thread_request
157 REQUEST_HEADER; /* request header */
158 IN int suspend; /* new thread should be suspended on creation */
159 IN int inherit; /* inherit flag */
160 OUT void* tid; /* thread id */
161 OUT int handle; /* thread handle (in the current process) */
165 /* Signal that we are finished booting on the client side */
166 struct boot_done_request
168 REQUEST_HEADER; /* request header */
169 IN int debug_level; /* new debug level */
173 /* Initialize a process; called from the new process context */
174 struct init_process_request
176 REQUEST_HEADER; /* request header */
177 IN void* ldt_copy; /* addr of LDT copy */
178 IN int ppid; /* parent Unix pid */
179 OUT int start_flags; /* flags from startup info */
180 OUT unsigned int server_start; /* server start time (GetTickCount) */
181 OUT int exe_file; /* file handle for main exe */
182 OUT int hstdin; /* handle for stdin */
183 OUT int hstdout; /* handle for stdout */
184 OUT int hstderr; /* handle for stderr */
185 OUT int cmd_show; /* main window show mode */
186 OUT VARARG(filename,string); /* file name of main exe */
190 /* Signal the end of the process initialization */
191 struct init_process_done_request
193 REQUEST_HEADER; /* request header */
194 IN void* module; /* main module base address */
195 IN void* entry; /* process entry point */
196 IN void* name; /* ptr to ptr to name (in process addr space) */
197 IN int gui; /* is it a GUI process? */
198 OUT int debugged; /* being debugged? */
202 /* Initialize a thread; called from the child after fork()/clone() */
203 struct init_thread_request
205 REQUEST_HEADER; /* request header */
206 IN int unix_pid; /* Unix pid of new thread */
207 IN void* teb; /* TEB of new thread (in thread address space) */
208 IN void* entry; /* thread entry point (in thread address space) */
212 /* Retrieve the thread buffer file descriptor */
213 /* The reply to this request is the first thing a newly */
214 /* created thread gets (without having to request it) */
215 struct get_thread_buffer_request
217 REQUEST_HEADER; /* request header */
218 OUT void* pid; /* process id of the new thread's process */
219 OUT void* tid; /* thread id of the new thread */
220 OUT int boot; /* is this the boot thread? */
221 OUT int version; /* protocol version */
225 /* Terminate a process */
226 struct terminate_process_request
228 REQUEST_HEADER; /* request header */
229 IN int handle; /* process handle to terminate */
230 IN int exit_code; /* process exit code */
231 OUT int self; /* suicide? */
235 /* Terminate a thread */
236 struct terminate_thread_request
238 REQUEST_HEADER; /* request header */
239 IN int handle; /* thread handle to terminate */
240 IN int exit_code; /* thread exit code */
241 OUT int self; /* suicide? */
242 OUT int last; /* last thread in this process? */
246 /* Retrieve information about a process */
247 struct get_process_info_request
249 REQUEST_HEADER; /* request header */
250 IN int handle; /* process handle */
251 OUT void* pid; /* server process id */
252 OUT int debugged; /* debugged? */
253 OUT int exit_code; /* process exit code */
254 OUT int priority; /* priority class */
255 OUT int process_affinity; /* process affinity mask */
256 OUT int system_affinity; /* system affinity mask */
260 /* Set a process informations */
261 struct set_process_info_request
263 REQUEST_HEADER; /* request header */
264 IN int handle; /* process handle */
265 IN int mask; /* setting mask (see below) */
266 IN int priority; /* priority class */
267 IN int affinity; /* affinity mask */
269 #define SET_PROCESS_INFO_PRIORITY 0x01
270 #define SET_PROCESS_INFO_AFFINITY 0x02
273 /* Retrieve information about a thread */
274 struct get_thread_info_request
276 REQUEST_HEADER; /* request header */
277 IN int handle; /* thread handle */
278 IN void* tid_in; /* thread id (optional) */
279 OUT void* tid; /* server thread id */
280 OUT void* teb; /* thread teb pointer */
281 OUT int exit_code; /* thread exit code */
282 OUT int priority; /* thread priority level */
286 /* Set a thread informations */
287 struct set_thread_info_request
289 REQUEST_HEADER; /* request header */
290 IN int handle; /* thread handle */
291 IN int mask; /* setting mask (see below) */
292 IN int priority; /* priority class */
293 IN int affinity; /* affinity mask */
295 #define SET_THREAD_INFO_PRIORITY 0x01
296 #define SET_THREAD_INFO_AFFINITY 0x02
299 /* Suspend a thread */
300 struct suspend_thread_request
302 REQUEST_HEADER; /* request header */
303 IN int handle; /* thread handle */
304 OUT int count; /* new suspend count */
308 /* Resume a thread */
309 struct resume_thread_request
311 REQUEST_HEADER; /* request header */
312 IN int handle; /* thread handle */
313 OUT int count; /* new suspend count */
317 /* Notify the server that a dll has been loaded */
318 struct load_dll_request
320 REQUEST_HEADER; /* request header */
321 IN int handle; /* file handle */
322 IN void* base; /* base address */
323 IN int dbg_offset; /* debug info offset */
324 IN int dbg_size; /* debug info size */
325 IN void* name; /* ptr to ptr to name (in process addr space) */
329 /* Notify the server that a dll is being unloaded */
330 struct unload_dll_request
332 REQUEST_HEADER; /* request header */
333 IN void* base; /* base address */
337 /* Queue an APC for a thread */
338 struct queue_apc_request
340 REQUEST_HEADER; /* request header */
341 IN int handle; /* thread handle */
342 IN void* func; /* function to call */
343 IN void* param; /* param for function to call */
347 /* Get next APC to call */
348 struct get_apc_request
350 REQUEST_HEADER; /* request header */
351 OUT void* func; /* function to call */
352 OUT int type; /* function type */
353 OUT VARARG(args,ptrs); /* function arguments */
355 enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC };
358 /* Close a handle for the current process */
359 struct close_handle_request
361 REQUEST_HEADER; /* request header */
362 IN int handle; /* handle to close */
366 /* Get information about a handle */
367 struct get_handle_info_request
369 REQUEST_HEADER; /* request header */
370 IN int handle; /* handle we are interested in */
371 OUT int flags; /* handle flags */
375 /* Set a handle information */
376 struct set_handle_info_request
378 REQUEST_HEADER; /* request header */
379 IN int handle; /* handle we are interested in */
380 IN int flags; /* new handle flags */
381 IN int mask; /* mask for flags to set */
385 /* Duplicate a handle */
386 struct dup_handle_request
388 REQUEST_HEADER; /* request header */
389 IN int src_process; /* src process handle */
390 IN int src_handle; /* src handle to duplicate */
391 IN int dst_process; /* dst process handle */
392 IN unsigned int access; /* wanted access rights */
393 IN int inherit; /* inherit flag */
394 IN int options; /* duplicate options (see below) */
395 OUT int handle; /* duplicated handle in dst process */
397 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
398 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
399 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
402 /* Open a handle to a process */
403 struct open_process_request
405 REQUEST_HEADER; /* request header */
406 IN void* pid; /* process id to open */
407 IN unsigned int access; /* wanted access rights */
408 IN int inherit; /* inherit flag */
409 OUT int handle; /* handle to the process */
413 /* Wait for handles */
414 struct select_request
416 REQUEST_HEADER; /* request header */
417 IN int flags; /* wait flags (see below) */
418 IN int timeout; /* timeout in ms */
419 OUT int signaled; /* signaled handle */
420 IN VARARG(handles,ints); /* handles to select on */
423 #define SELECT_ALERTABLE 2
424 #define SELECT_TIMEOUT 4
427 /* Create an event */
428 struct create_event_request
430 REQUEST_HEADER; /* request header */
431 IN int manual_reset; /* manual reset event */
432 IN int initial_state; /* initial state of the event */
433 IN int inherit; /* inherit flag */
434 OUT int handle; /* handle to the event */
435 IN VARARG(name,unicode_str); /* object name */
438 /* Event operation */
439 struct event_op_request
441 REQUEST_HEADER; /* request header */
442 IN int handle; /* handle to event */
443 IN int op; /* event operation (see below) */
445 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
449 struct open_event_request
451 REQUEST_HEADER; /* request header */
452 IN unsigned int access; /* wanted access rights */
453 IN int inherit; /* inherit flag */
454 OUT int handle; /* handle to the event */
455 IN VARARG(name,unicode_str); /* object name */
460 struct create_mutex_request
462 REQUEST_HEADER; /* request header */
463 IN int owned; /* initially owned? */
464 IN int inherit; /* inherit flag */
465 OUT int handle; /* handle to the mutex */
466 IN VARARG(name,unicode_str); /* object name */
470 /* Release a mutex */
471 struct release_mutex_request
473 REQUEST_HEADER; /* request header */
474 IN int handle; /* handle to the mutex */
479 struct open_mutex_request
481 REQUEST_HEADER; /* request header */
482 IN unsigned int access; /* wanted access rights */
483 IN int inherit; /* inherit flag */
484 OUT int handle; /* handle to the mutex */
485 IN VARARG(name,unicode_str); /* object name */
489 /* Create a semaphore */
490 struct create_semaphore_request
492 REQUEST_HEADER; /* request header */
493 IN unsigned int initial; /* initial count */
494 IN unsigned int max; /* maximum count */
495 IN int inherit; /* inherit flag */
496 OUT int handle; /* handle to the semaphore */
497 IN VARARG(name,unicode_str); /* object name */
501 /* Release a semaphore */
502 struct release_semaphore_request
504 REQUEST_HEADER; /* request header */
505 IN int handle; /* handle to the semaphore */
506 IN unsigned int count; /* count to add to semaphore */
507 OUT unsigned int prev_count; /* previous semaphore count */
511 /* Open a semaphore */
512 struct open_semaphore_request
514 REQUEST_HEADER; /* request header */
515 IN unsigned int access; /* wanted access rights */
516 IN int inherit; /* inherit flag */
517 OUT int handle; /* handle to the semaphore */
518 IN VARARG(name,unicode_str); /* object name */
523 struct create_file_request
525 REQUEST_HEADER; /* request header */
526 IN unsigned int access; /* wanted access rights */
527 IN int inherit; /* inherit flag */
528 IN unsigned int sharing; /* sharing flags */
529 IN int create; /* file create action */
530 IN unsigned int attrs; /* file attributes for creation */
531 OUT int handle; /* handle to the file */
532 IN VARARG(filename,string); /* file name */
536 /* Allocate a file handle for a Unix fd */
537 struct alloc_file_handle_request
539 REQUEST_HEADER; /* request header */
540 IN unsigned int access; /* wanted access rights */
541 OUT int handle; /* handle to the file */
545 /* Get a Unix fd to read from a file */
546 struct get_read_fd_request
548 REQUEST_HEADER; /* request header */
549 IN int handle; /* handle to the file */
553 /* Get a Unix fd to write to a file */
554 struct get_write_fd_request
556 REQUEST_HEADER; /* request header */
557 IN int handle; /* handle to the file */
561 /* Set a file current position */
562 struct set_file_pointer_request
564 REQUEST_HEADER; /* request header */
565 IN int handle; /* handle to the file */
566 IN int low; /* position low word */
567 IN int high; /* position high word */
568 IN int whence; /* whence to seek */
569 OUT int new_low; /* new position low word */
570 OUT int new_high; /* new position high word */
574 /* Truncate (or extend) a file */
575 struct truncate_file_request
577 REQUEST_HEADER; /* request header */
578 IN int handle; /* handle to the file */
582 /* Set a file access and modification times */
583 struct set_file_time_request
585 REQUEST_HEADER; /* request header */
586 IN int handle; /* handle to the file */
587 IN time_t access_time; /* last access time */
588 IN time_t write_time; /* last write time */
592 /* Flush a file buffers */
593 struct flush_file_request
595 REQUEST_HEADER; /* request header */
596 IN int handle; /* handle to the file */
600 /* Get information about a file */
601 struct get_file_info_request
603 REQUEST_HEADER; /* request header */
604 IN int handle; /* handle to the file */
605 OUT int type; /* file type */
606 OUT int attr; /* file attributes */
607 OUT time_t access_time; /* last access time */
608 OUT time_t write_time; /* last write time */
609 OUT int size_high; /* file size */
610 OUT int size_low; /* file size */
611 OUT int links; /* number of links */
612 OUT int index_high; /* unique index */
613 OUT int index_low; /* unique index */
614 OUT unsigned int serial; /* volume serial number */
618 /* Lock a region of a file */
619 struct lock_file_request
621 REQUEST_HEADER; /* request header */
622 IN int handle; /* handle to the file */
623 IN unsigned int offset_low; /* offset of start of lock */
624 IN unsigned int offset_high; /* offset of start of lock */
625 IN unsigned int count_low; /* count of bytes to lock */
626 IN unsigned int count_high; /* count of bytes to lock */
630 /* Unlock a region of a file */
631 struct unlock_file_request
633 REQUEST_HEADER; /* request header */
634 IN int handle; /* handle to the file */
635 IN unsigned int offset_low; /* offset of start of unlock */
636 IN unsigned int offset_high; /* offset of start of unlock */
637 IN unsigned int count_low; /* count of bytes to unlock */
638 IN unsigned int count_high; /* count of bytes to unlock */
642 /* Create an anonymous pipe */
643 struct create_pipe_request
645 REQUEST_HEADER; /* request header */
646 IN int inherit; /* inherit flag */
647 OUT int handle_read; /* handle to the read-side of the pipe */
648 OUT int handle_write; /* handle to the write-side of the pipe */
652 /* Create a socket */
653 struct create_socket_request
655 REQUEST_HEADER; /* request header */
656 IN unsigned int access; /* wanted access rights */
657 IN int inherit; /* inherit flag */
658 IN int family; /* family, see socket manpage */
659 IN int type; /* type, see socket manpage */
660 IN int protocol; /* protocol, see socket manpage */
661 OUT int handle; /* handle to the new socket */
665 /* Accept a socket */
666 struct accept_socket_request
668 REQUEST_HEADER; /* request header */
669 IN int lhandle; /* handle to the listening socket */
670 IN unsigned int access; /* wanted access rights */
671 IN int inherit; /* inherit flag */
672 OUT int handle; /* handle to the new socket */
676 /* Set socket event parameters */
677 struct set_socket_event_request
679 REQUEST_HEADER; /* request header */
680 IN int handle; /* handle to the socket */
681 IN unsigned int mask; /* event mask */
682 IN int event; /* event object */
686 /* Get socket event parameters */
687 struct get_socket_event_request
689 REQUEST_HEADER; /* request header */
690 IN int handle; /* handle to the socket */
691 IN int service; /* clear pending? */
692 IN int s_event; /* "expected" event object */
693 IN int c_event; /* event to clear */
694 OUT unsigned int mask; /* event mask */
695 OUT unsigned int pmask; /* pending events */
696 OUT unsigned int state; /* status bits */
697 OUT VARARG(errors,ints); /* event errors */
701 /* Reenable pending socket events */
702 struct enable_socket_event_request
704 REQUEST_HEADER; /* request header */
705 IN int handle; /* handle to the socket */
706 IN unsigned int mask; /* events to re-enable */
707 IN unsigned int sstate; /* status bits to set */
708 IN unsigned int cstate; /* status bits to clear */
712 /* Allocate a console for the current process */
713 struct alloc_console_request
715 REQUEST_HEADER; /* request header */
716 IN unsigned int access; /* wanted access rights */
717 IN int inherit; /* inherit flag */
718 OUT int handle_in; /* handle to console input */
719 OUT int handle_out; /* handle to console output */
723 /* Free the console of the current process */
724 struct free_console_request
726 REQUEST_HEADER; /* request header */
730 /* Open a handle to the process console */
731 struct open_console_request
733 REQUEST_HEADER; /* request header */
734 IN int output; /* input or output? */
735 IN unsigned int access; /* wanted access rights */
736 IN int inherit; /* inherit flag */
737 OUT int handle; /* handle to the console */
741 /* Set a console file descriptor */
742 struct set_console_fd_request
744 REQUEST_HEADER; /* request header */
745 IN int handle; /* handle to the console */
746 IN int file_handle; /* handle of file to use as file descriptor */
747 IN int pid; /* pid of xterm (hack) */
751 /* Get a console mode (input or output) */
752 struct get_console_mode_request
754 REQUEST_HEADER; /* request header */
755 IN int handle; /* handle to the console */
756 OUT int mode; /* console mode */
760 /* Set a console mode (input or output) */
761 struct set_console_mode_request
763 REQUEST_HEADER; /* request header */
764 IN int handle; /* handle to the console */
765 IN int mode; /* console mode */
769 /* Set info about a console (output only) */
770 struct set_console_info_request
772 REQUEST_HEADER; /* request header */
773 IN int handle; /* handle to the console */
774 IN int mask; /* setting mask (see below) */
775 IN int cursor_size; /* size of cursor (percentage filled) */
776 IN int cursor_visible;/* cursor visibility flag */
777 IN VARARG(title,string); /* console title */
779 #define SET_CONSOLE_INFO_CURSOR 0x01
780 #define SET_CONSOLE_INFO_TITLE 0x02
782 /* Get info about a console (output only) */
783 struct get_console_info_request
785 REQUEST_HEADER; /* request header */
786 IN int handle; /* handle to the console */
787 OUT int cursor_size; /* size of cursor (percentage filled) */
788 OUT int cursor_visible;/* cursor visibility flag */
789 OUT int pid; /* pid of xterm (hack) */
790 OUT VARARG(title,string); /* console title */
794 /* Add input records to a console input queue */
795 struct write_console_input_request
797 REQUEST_HEADER; /* request header */
798 IN int handle; /* handle to the console input */
799 OUT int written; /* number of records written */
800 IN VARARG(rec,input_records); /* input records */
803 /* Fetch input records from a console input queue */
804 struct read_console_input_request
806 REQUEST_HEADER; /* request header */
807 IN int handle; /* handle to the console input */
808 IN int flush; /* flush the retrieved records from the queue? */
809 OUT int read; /* number of records read */
810 OUT VARARG(rec,input_records); /* input records */
814 /* Create a change notification */
815 struct create_change_notification_request
817 REQUEST_HEADER; /* request header */
818 IN int subtree; /* watch all the subtree */
819 IN int filter; /* notification filter */
820 OUT int handle; /* handle to the change notification */
824 /* Create a file mapping */
825 struct create_mapping_request
827 REQUEST_HEADER; /* request header */
828 IN int size_high; /* mapping size */
829 IN int size_low; /* mapping size */
830 IN int protect; /* protection flags (see below) */
831 IN int inherit; /* inherit flag */
832 IN int file_handle; /* file handle */
833 OUT int handle; /* handle to the mapping */
834 IN VARARG(name,unicode_str); /* object name */
836 /* protection flags */
837 #define VPROT_READ 0x01
838 #define VPROT_WRITE 0x02
839 #define VPROT_EXEC 0x04
840 #define VPROT_WRITECOPY 0x08
841 #define VPROT_GUARD 0x10
842 #define VPROT_NOCACHE 0x20
843 #define VPROT_COMMITTED 0x40
844 #define VPROT_IMAGE 0x80
848 struct open_mapping_request
850 REQUEST_HEADER; /* request header */
851 IN unsigned int access; /* wanted access rights */
852 IN int inherit; /* inherit flag */
853 OUT int handle; /* handle to the mapping */
854 IN VARARG(name,unicode_str); /* object name */
858 /* Get information about a file mapping */
859 struct get_mapping_info_request
861 REQUEST_HEADER; /* request header */
862 IN int handle; /* handle to the mapping */
863 OUT int size_high; /* mapping size */
864 OUT int size_low; /* mapping size */
865 OUT int protect; /* protection flags */
866 OUT int header_size; /* header size (for VPROT_IMAGE mapping) */
867 OUT void* base; /* default base addr (for VPROT_IMAGE mapping) */
868 OUT int shared_file; /* shared mapping file handle */
869 OUT int shared_size; /* shared mapping size */
873 /* Create a device */
874 struct create_device_request
876 REQUEST_HEADER; /* request header */
877 IN unsigned int access; /* wanted access rights */
878 IN int inherit; /* inherit flag */
879 IN int id; /* client private id */
880 OUT int handle; /* handle to the device */
884 /* Create a snapshot */
885 struct create_snapshot_request
887 REQUEST_HEADER; /* request header */
888 IN int inherit; /* inherit flag */
889 IN int flags; /* snapshot flags (TH32CS_*) */
890 IN void* pid; /* process id */
891 OUT int handle; /* handle to the snapshot */
895 /* Get the next process from a snapshot */
896 struct next_process_request
898 REQUEST_HEADER; /* request header */
899 IN int handle; /* handle to the snapshot */
900 IN int reset; /* reset snapshot position? */
901 OUT int count; /* process usage count */
902 OUT void* pid; /* process id */
903 OUT int threads; /* number of threads */
904 OUT int priority; /* process priority */
908 /* Get the next thread from a snapshot */
909 struct next_thread_request
911 REQUEST_HEADER; /* request header */
912 IN int handle; /* handle to the snapshot */
913 IN int reset; /* reset snapshot position? */
914 OUT int count; /* thread usage count */
915 OUT void* pid; /* process id */
916 OUT void* tid; /* thread id */
917 OUT int base_pri; /* base priority */
918 OUT int delta_pri; /* delta priority */
922 /* Get the next module from a snapshot */
923 struct next_module_request
925 REQUEST_HEADER; /* request header */
926 IN int handle; /* handle to the snapshot */
927 IN int reset; /* reset snapshot position? */
928 OUT void* pid; /* process id */
929 OUT void* base; /* module base address */
933 /* Wait for a debug event */
934 struct wait_debug_event_request
936 REQUEST_HEADER; /* request header */
937 IN int timeout; /* timeout in ms */
938 OUT void* pid; /* process id */
939 OUT void* tid; /* thread id */
940 OUT VARARG(event,debug_event); /* debug event data */
944 /* Send an exception event */
945 struct exception_event_request
947 REQUEST_HEADER; /* request header */
948 IN int first; /* first chance exception? */
949 OUT int status; /* event continuation status */
950 IN VARARG(record,exc_event); /* thread context followed by exception record */
951 OUT VARARG(context,context); /* modified thread context */
955 /* Send an output string to the debugger */
956 struct output_debug_string_request
958 REQUEST_HEADER; /* request header */
959 IN void* string; /* string to display (in debugged process address space) */
960 IN int unicode; /* is it Unicode? */
961 IN int length; /* string length */
965 /* Continue a debug event */
966 struct continue_debug_event_request
968 REQUEST_HEADER; /* request header */
969 IN void* pid; /* process id to continue */
970 IN void* tid; /* thread id to continue */
971 IN int status; /* continuation status */
975 /* Start debugging an existing process */
976 struct debug_process_request
978 REQUEST_HEADER; /* request header */
979 IN void* pid; /* id of the process to debug */
983 /* Read data from a process address space */
984 struct read_process_memory_request
986 REQUEST_HEADER; /* request header */
987 IN int handle; /* process handle */
988 IN void* addr; /* addr to read from (must be int-aligned) */
989 IN int len; /* number of ints to read */
990 OUT VARARG(data,bytes); /* result data */
994 /* Write data to a process address space */
995 struct write_process_memory_request
997 REQUEST_HEADER; /* request header */
998 IN int handle; /* process handle */
999 IN void* addr; /* addr to write to (must be int-aligned) */
1000 IN int len; /* number of ints to write */
1001 IN unsigned int first_mask; /* mask for first word */
1002 IN unsigned int last_mask; /* mask for last word */
1003 IN VARARG(data,bytes); /* result data */
1007 /* Create a registry key */
1008 struct create_key_request
1010 REQUEST_HEADER; /* request header */
1011 IN int parent; /* handle to the parent key */
1012 IN unsigned int access; /* desired access rights */
1013 IN unsigned int options; /* creation options */
1014 IN time_t modif; /* last modification time */
1015 OUT int hkey; /* handle to the created key */
1016 OUT int created; /* has it been newly created? */
1017 IN VARARG(name,unicode_len_str); /* key name */
1018 IN VARARG(class,unicode_str); /* class name */
1021 /* Open a registry key */
1022 struct open_key_request
1024 REQUEST_HEADER; /* request header */
1025 IN int parent; /* handle to the parent key */
1026 IN unsigned int access; /* desired access rights */
1027 OUT int hkey; /* handle to the open key */
1028 IN VARARG(name,unicode_str); /* key name */
1032 /* Delete a registry key */
1033 struct delete_key_request
1035 REQUEST_HEADER; /* request header */
1036 IN int hkey; /* handle to the key */
1040 /* Enumerate registry subkeys */
1041 struct enum_key_request
1043 REQUEST_HEADER; /* request header */
1044 IN int hkey; /* handle to registry key */
1045 IN int index; /* index of subkey (or -1 for current key) */
1046 IN int full; /* return the full info? */
1047 OUT int subkeys; /* number of subkeys */
1048 OUT int max_subkey; /* longest subkey name */
1049 OUT int max_class; /* longest class name */
1050 OUT int values; /* number of values */
1051 OUT int max_value; /* longest value name */
1052 OUT int max_data; /* longest value data */
1053 OUT time_t modif; /* last modification time */
1054 OUT VARARG(name,unicode_len_str); /* key name */
1055 OUT VARARG(class,unicode_str); /* class name */
1059 /* Set a value of a registry key */
1060 struct set_key_value_request
1062 REQUEST_HEADER; /* request header */
1063 IN int hkey; /* handle to registry key */
1064 IN int type; /* value type */
1065 IN unsigned int total; /* total value len */
1066 IN unsigned int offset; /* offset for setting data */
1067 IN VARARG(name,unicode_len_str); /* value name */
1068 IN VARARG(data,bytes); /* value data */
1072 /* Retrieve the value of a registry key */
1073 struct get_key_value_request
1075 REQUEST_HEADER; /* request header */
1076 IN int hkey; /* handle to registry key */
1077 IN unsigned int offset; /* offset for getting data */
1078 OUT int type; /* value type */
1079 OUT int len; /* value data len */
1080 IN VARARG(name,unicode_len_str); /* value name */
1081 OUT VARARG(data,bytes); /* value data */
1085 /* Enumerate a value of a registry key */
1086 struct enum_key_value_request
1088 REQUEST_HEADER; /* request header */
1089 IN int hkey; /* handle to registry key */
1090 IN int index; /* value index */
1091 IN unsigned int offset; /* offset for getting data */
1092 OUT int type; /* value type */
1093 OUT int len; /* value data len */
1094 OUT VARARG(name,unicode_len_str); /* value name */
1095 OUT VARARG(data,bytes); /* value data */
1099 /* Delete a value of a registry key */
1100 struct delete_key_value_request
1102 REQUEST_HEADER; /* request header */
1103 IN int hkey; /* handle to registry key */
1104 IN VARARG(name,unicode_str); /* value name */
1108 /* Load a registry branch from a file */
1109 struct load_registry_request
1111 REQUEST_HEADER; /* request header */
1112 IN int hkey; /* root key to load to */
1113 IN int file; /* file to load from */
1114 IN VARARG(name,unicode_str); /* subkey name */
1118 /* Save a registry branch to a file */
1119 struct save_registry_request
1121 REQUEST_HEADER; /* request header */
1122 IN int hkey; /* key to save */
1123 IN int file; /* file to save to */
1127 /* Save a registry branch at server exit */
1128 struct save_registry_atexit_request
1130 REQUEST_HEADER; /* request header */
1131 IN int hkey; /* key to save */
1132 IN VARARG(file,string); /* file to save to */
1136 /* Set the current and saving level for the registry */
1137 struct set_registry_levels_request
1139 REQUEST_HEADER; /* request header */
1140 IN int current; /* new current level */
1141 IN int saving; /* new saving level */
1142 IN int period; /* duration between periodic saves (milliseconds) */
1146 /* Create a waitable timer */
1147 struct create_timer_request
1149 REQUEST_HEADER; /* request header */
1150 IN int inherit; /* inherit flag */
1151 IN int manual; /* manual reset */
1152 OUT int handle; /* handle to the timer */
1153 IN VARARG(name,unicode_str); /* object name */
1157 /* Open a waitable timer */
1158 struct open_timer_request
1160 REQUEST_HEADER; /* request header */
1161 IN unsigned int access; /* wanted access rights */
1162 IN int inherit; /* inherit flag */
1163 OUT int handle; /* handle to the timer */
1164 IN VARARG(name,unicode_str); /* object name */
1167 /* Set a waitable timer */
1168 struct set_timer_request
1170 REQUEST_HEADER; /* request header */
1171 IN int handle; /* handle to the timer */
1172 IN int sec; /* next expiration absolute time */
1173 IN int usec; /* next expiration absolute time */
1174 IN int period; /* timer period in ms */
1175 IN void* callback; /* callback function */
1176 IN void* arg; /* callback argument */
1179 /* Cancel a waitable timer */
1180 struct cancel_timer_request
1182 REQUEST_HEADER; /* request header */
1183 IN int handle; /* handle to the timer */
1187 /* Retrieve the current context of a thread */
1188 struct get_thread_context_request
1190 REQUEST_HEADER; /* request header */
1191 IN int handle; /* thread handle */
1192 IN unsigned int flags; /* context flags */
1193 OUT VARARG(context,context); /* thread context */
1197 /* Set the current context of a thread */
1198 struct set_thread_context_request
1200 REQUEST_HEADER; /* request header */
1201 IN int handle; /* thread handle */
1202 IN unsigned int flags; /* context flags */
1203 IN VARARG(context,context); /* thread context */
1207 /* Fetch a selector entry for a thread */
1208 struct get_selector_entry_request
1210 REQUEST_HEADER; /* request header */
1211 IN int handle; /* thread handle */
1212 IN int entry; /* LDT entry */
1213 OUT unsigned int base; /* selector base */
1214 OUT unsigned int limit; /* selector limit */
1215 OUT unsigned char flags; /* selector flags */
1220 struct add_atom_request
1222 REQUEST_HEADER; /* request header */
1223 IN int local; /* is atom in local process table? */
1224 OUT int atom; /* resulting atom */
1225 IN VARARG(name,unicode_str); /* atom name */
1229 /* Delete an atom */
1230 struct delete_atom_request
1232 REQUEST_HEADER; /* request header */
1233 IN int atom; /* atom handle */
1234 IN int local; /* is atom in local process table? */
1239 struct find_atom_request
1241 REQUEST_HEADER; /* request header */
1242 IN int local; /* is atom in local process table? */
1243 OUT int atom; /* atom handle */
1244 IN VARARG(name,unicode_str); /* atom name */
1248 /* Get an atom name */
1249 struct get_atom_name_request
1251 REQUEST_HEADER; /* request header */
1252 IN int atom; /* atom handle */
1253 IN int local; /* is atom in local process table? */
1254 OUT int count; /* atom lock count */
1255 OUT VARARG(name,unicode_str); /* atom name */
1259 /* Init the process atom table */
1260 struct init_atom_table_request
1262 REQUEST_HEADER; /* request header */
1263 IN int entries; /* number of entries */
1267 /* Get the message queue of the current thread */
1268 struct get_msg_queue_request
1270 REQUEST_HEADER; /* request header */
1271 OUT int handle; /* handle to the queue */
1274 /* Wake up a message queue */
1275 struct wake_queue_request
1277 REQUEST_HEADER; /* request header */
1278 IN int handle; /* handle to the queue */
1279 IN unsigned int bits; /* wake bits */
1282 /* Wait for a process to start waiting on input */
1283 struct wait_input_idle_request
1285 REQUEST_HEADER; /* request header */
1286 IN int handle; /* process handle */
1287 IN int timeout; /* timeout */
1288 OUT int event; /* handle to idle event */
1291 struct create_serial_request
1293 REQUEST_HEADER; /* request header */
1294 IN unsigned int access; /* wanted access rights */
1295 IN int inherit; /* inherit flag */
1296 IN unsigned int sharing; /* sharing flags */
1297 OUT int handle; /* handle to the port */
1298 IN VARARG(name,string); /* file name */
1301 struct get_serial_info_request
1303 REQUEST_HEADER; /* request header */
1304 IN int handle; /* handle to comm port */
1305 OUT unsigned int readinterval;
1306 OUT unsigned int readconst;
1307 OUT unsigned int readmult;
1308 OUT unsigned int writeconst;
1309 OUT unsigned int writemult;
1310 OUT unsigned int eventmask;
1311 OUT unsigned int commerror;
1314 struct set_serial_info_request
1316 REQUEST_HEADER; /* request header */
1317 IN int handle; /* handle to comm port */
1318 IN int flags; /* bitmask to set values (see below) */
1319 IN unsigned int readinterval;
1320 IN unsigned int readconst;
1321 IN unsigned int readmult;
1322 IN unsigned int writeconst;
1323 IN unsigned int writemult;
1324 IN unsigned int eventmask;
1325 IN unsigned int commerror;
1327 #define SERIALINFO_SET_TIMEOUTS 0x01
1328 #define SERIALINFO_SET_MASK 0x02
1329 #define SERIALINFO_SET_ERROR 0x04
1331 struct create_async_request
1333 REQUEST_HEADER; /* request header */
1334 IN int file_handle; /* handle to comm port */
1335 IN void* overlapped;
1342 #define ASYNC_TYPE_READ 0x01
1343 #define ASYNC_TYPE_WRITE 0x02
1344 #define ASYNC_TYPE_WAIT 0x03
1347 * Used by service thread to tell the server that the current
1348 * operation has completed
1350 struct async_result_request
1352 REQUEST_HEADER; /* request header */
1354 IN int result; /* NT status code */
1357 /* Everything below this line is generated automatically by tools/make_requests */
1358 /* ### make_requests begin ### */
1367 REQ_INIT_PROCESS_DONE,
1369 REQ_GET_THREAD_BUFFER,
1370 REQ_TERMINATE_PROCESS,
1371 REQ_TERMINATE_THREAD,
1372 REQ_GET_PROCESS_INFO,
1373 REQ_SET_PROCESS_INFO,
1374 REQ_GET_THREAD_INFO,
1375 REQ_SET_THREAD_INFO,
1383 REQ_GET_HANDLE_INFO,
1384 REQ_SET_HANDLE_INFO,
1394 REQ_CREATE_SEMAPHORE,
1395 REQ_RELEASE_SEMAPHORE,
1398 REQ_ALLOC_FILE_HANDLE,
1401 REQ_SET_FILE_POINTER,
1411 REQ_SET_SOCKET_EVENT,
1412 REQ_GET_SOCKET_EVENT,
1413 REQ_ENABLE_SOCKET_EVENT,
1418 REQ_GET_CONSOLE_MODE,
1419 REQ_SET_CONSOLE_MODE,
1420 REQ_SET_CONSOLE_INFO,
1421 REQ_GET_CONSOLE_INFO,
1422 REQ_WRITE_CONSOLE_INPUT,
1423 REQ_READ_CONSOLE_INPUT,
1424 REQ_CREATE_CHANGE_NOTIFICATION,
1427 REQ_GET_MAPPING_INFO,
1429 REQ_CREATE_SNAPSHOT,
1433 REQ_WAIT_DEBUG_EVENT,
1434 REQ_EXCEPTION_EVENT,
1435 REQ_OUTPUT_DEBUG_STRING,
1436 REQ_CONTINUE_DEBUG_EVENT,
1438 REQ_READ_PROCESS_MEMORY,
1439 REQ_WRITE_PROCESS_MEMORY,
1447 REQ_DELETE_KEY_VALUE,
1450 REQ_SAVE_REGISTRY_ATEXIT,
1451 REQ_SET_REGISTRY_LEVELS,
1456 REQ_GET_THREAD_CONTEXT,
1457 REQ_SET_THREAD_CONTEXT,
1458 REQ_GET_SELECTOR_ENTRY,
1463 REQ_INIT_ATOM_TABLE,
1466 REQ_WAIT_INPUT_IDLE,
1468 REQ_GET_SERIAL_INFO,
1469 REQ_SET_SERIAL_INFO,
1475 union generic_request
1477 struct request_max_size max_size;
1478 struct request_header header;
1479 struct new_process_request new_process;
1480 struct wait_process_request wait_process;
1481 struct new_thread_request new_thread;
1482 struct boot_done_request boot_done;
1483 struct init_process_request init_process;
1484 struct init_process_done_request init_process_done;
1485 struct init_thread_request init_thread;
1486 struct get_thread_buffer_request get_thread_buffer;
1487 struct terminate_process_request terminate_process;
1488 struct terminate_thread_request terminate_thread;
1489 struct get_process_info_request get_process_info;
1490 struct set_process_info_request set_process_info;
1491 struct get_thread_info_request get_thread_info;
1492 struct set_thread_info_request set_thread_info;
1493 struct suspend_thread_request suspend_thread;
1494 struct resume_thread_request resume_thread;
1495 struct load_dll_request load_dll;
1496 struct unload_dll_request unload_dll;
1497 struct queue_apc_request queue_apc;
1498 struct get_apc_request get_apc;
1499 struct close_handle_request close_handle;
1500 struct get_handle_info_request get_handle_info;
1501 struct set_handle_info_request set_handle_info;
1502 struct dup_handle_request dup_handle;
1503 struct open_process_request open_process;
1504 struct select_request select;
1505 struct create_event_request create_event;
1506 struct event_op_request event_op;
1507 struct open_event_request open_event;
1508 struct create_mutex_request create_mutex;
1509 struct release_mutex_request release_mutex;
1510 struct open_mutex_request open_mutex;
1511 struct create_semaphore_request create_semaphore;
1512 struct release_semaphore_request release_semaphore;
1513 struct open_semaphore_request open_semaphore;
1514 struct create_file_request create_file;
1515 struct alloc_file_handle_request alloc_file_handle;
1516 struct get_read_fd_request get_read_fd;
1517 struct get_write_fd_request get_write_fd;
1518 struct set_file_pointer_request set_file_pointer;
1519 struct truncate_file_request truncate_file;
1520 struct set_file_time_request set_file_time;
1521 struct flush_file_request flush_file;
1522 struct get_file_info_request get_file_info;
1523 struct lock_file_request lock_file;
1524 struct unlock_file_request unlock_file;
1525 struct create_pipe_request create_pipe;
1526 struct create_socket_request create_socket;
1527 struct accept_socket_request accept_socket;
1528 struct set_socket_event_request set_socket_event;
1529 struct get_socket_event_request get_socket_event;
1530 struct enable_socket_event_request enable_socket_event;
1531 struct alloc_console_request alloc_console;
1532 struct free_console_request free_console;
1533 struct open_console_request open_console;
1534 struct set_console_fd_request set_console_fd;
1535 struct get_console_mode_request get_console_mode;
1536 struct set_console_mode_request set_console_mode;
1537 struct set_console_info_request set_console_info;
1538 struct get_console_info_request get_console_info;
1539 struct write_console_input_request write_console_input;
1540 struct read_console_input_request read_console_input;
1541 struct create_change_notification_request create_change_notification;
1542 struct create_mapping_request create_mapping;
1543 struct open_mapping_request open_mapping;
1544 struct get_mapping_info_request get_mapping_info;
1545 struct create_device_request create_device;
1546 struct create_snapshot_request create_snapshot;
1547 struct next_process_request next_process;
1548 struct next_thread_request next_thread;
1549 struct next_module_request next_module;
1550 struct wait_debug_event_request wait_debug_event;
1551 struct exception_event_request exception_event;
1552 struct output_debug_string_request output_debug_string;
1553 struct continue_debug_event_request continue_debug_event;
1554 struct debug_process_request debug_process;
1555 struct read_process_memory_request read_process_memory;
1556 struct write_process_memory_request write_process_memory;
1557 struct create_key_request create_key;
1558 struct open_key_request open_key;
1559 struct delete_key_request delete_key;
1560 struct enum_key_request enum_key;
1561 struct set_key_value_request set_key_value;
1562 struct get_key_value_request get_key_value;
1563 struct enum_key_value_request enum_key_value;
1564 struct delete_key_value_request delete_key_value;
1565 struct load_registry_request load_registry;
1566 struct save_registry_request save_registry;
1567 struct save_registry_atexit_request save_registry_atexit;
1568 struct set_registry_levels_request set_registry_levels;
1569 struct create_timer_request create_timer;
1570 struct open_timer_request open_timer;
1571 struct set_timer_request set_timer;
1572 struct cancel_timer_request cancel_timer;
1573 struct get_thread_context_request get_thread_context;
1574 struct set_thread_context_request set_thread_context;
1575 struct get_selector_entry_request get_selector_entry;
1576 struct add_atom_request add_atom;
1577 struct delete_atom_request delete_atom;
1578 struct find_atom_request find_atom;
1579 struct get_atom_name_request get_atom_name;
1580 struct init_atom_table_request init_atom_table;
1581 struct get_msg_queue_request get_msg_queue;
1582 struct wake_queue_request wake_queue;
1583 struct wait_input_idle_request wait_input_idle;
1584 struct create_serial_request create_serial;
1585 struct get_serial_info_request get_serial_info;
1586 struct set_serial_info_request set_serial_info;
1587 struct create_async_request create_async;
1588 struct async_result_request async_result;
1591 #define SERVER_PROTOCOL_VERSION 29
1593 /* ### make_requests end ### */
1594 /* Everything above this line is generated automatically by tools/make_requests */
1596 #undef REQUEST_HEADER
1599 /* format of the server buffer */
1600 struct server_buffer_info
1602 volatile unsigned int cur_req; /* offset of the current request */
1603 volatile unsigned int cur_pos; /* first available position in buffer */
1606 /* client-side functions */
1608 #ifndef __WINE_SERVER__
1612 #include "wine/exception.h"
1614 /* client communication functions */
1616 extern unsigned int wine_server_call( enum request req );
1617 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1618 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1619 extern void *wine_server_alloc_req( size_t fixed_size, size_t var_size );
1620 extern const char *get_config_dir(void);
1622 /* compatibility macros */
1623 #define server_alloc_req(f,v) wine_server_alloc_req(f,v)
1624 #define server_call_noerr(req) wine_server_call(req)
1626 /* get a pointer to the request buffer */
1627 static inline void WINE_UNUSED *get_req_buffer(void)
1629 return NtCurrentTeb()->buffer;
1632 /* maximum remaining size in the server buffer */
1633 static inline int WINE_UNUSED server_remaining( const void *ptr )
1635 return (char *)NtCurrentTeb()->buffer_info - (char *)ptr;
1638 /* do a server call and set the last error code */
1639 inline static unsigned int server_call( enum request req )
1641 unsigned int res = wine_server_call( req );
1642 if (res) SetLastError( RtlNtStatusToDosError(res) );
1646 /* get a pointer to the variable part of the request */
1647 inline static void *server_data_ptr( const void *req )
1649 return (union generic_request *)req + 1;
1652 /* get the size of the variable part of the request */
1653 inline static size_t server_data_size( const void *req )
1655 return ((struct request_header *)req)->var_size;
1659 /* exception support for server calls */
1661 extern DWORD __wine_server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1662 CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1664 struct __server_exception_frame
1666 EXCEPTION_FRAME frame;
1667 struct server_buffer_info info; /* saved buffer information */
1670 #define SERVER_START_REQ \
1672 struct __server_exception_frame __f; \
1673 __f.frame.Handler = __wine_server_exception_handler; \
1674 __f.info = *NtCurrentTeb()->buffer_info; \
1675 __wine_push_frame( &__f.frame ); \
1678 #define SERVER_END_REQ \
1680 *NtCurrentTeb()->buffer_info = __f.info; \
1681 __wine_pop_frame( &__f.frame ); \
1684 extern int CLIENT_InitServer(void);
1685 extern int CLIENT_BootDone( int debug_level );
1686 extern int CLIENT_IsBootThread(void);
1687 extern int CLIENT_InitThread(void);
1688 #endif /* __WINE_SERVER__ */
1690 #endif /* __WINE_SERVER_H */