Code cleanup.
[wine/multimedia.git] / include / server.h
bloba9fbd62815c8abe06d802353b7f6f919916b403f
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
47 /* a path name for server requests (Unicode) */
48 typedef WCHAR path_t[MAX_PATH+1];
51 /* definitions of the event data depending on the event code */
52 struct debug_event_exception
54 EXCEPTION_RECORD record; /* exception record */
55 int first; /* first chance exception? */
57 struct debug_event_create_thread
59 int handle; /* handle to the new thread */
60 void *teb; /* thread teb (in debugged process address space) */
61 void *start; /* thread startup routine */
63 struct debug_event_create_process
65 int file; /* handle to the process exe file */
66 int process; /* handle to the new process */
67 int thread; /* handle to the new thread */
68 void *base; /* base of executable image */
69 int dbg_offset; /* offset of debug info in file */
70 int dbg_size; /* size of debug info */
71 void *teb; /* thread teb (in debugged process address space) */
72 void *start; /* thread startup routine */
73 void *name; /* image name (optional) */
74 int unicode; /* is it Unicode? */
76 struct debug_event_exit
78 int exit_code; /* thread or process exit code */
80 struct debug_event_load_dll
82 int handle; /* file handle for the dll */
83 void *base; /* base address of the dll */
84 int dbg_offset; /* offset of debug info in file */
85 int dbg_size; /* size of debug info */
86 void *name; /* image name (optional) */
87 int unicode; /* is it Unicode? */
89 struct debug_event_unload_dll
91 void *base; /* base address of the dll */
93 struct debug_event_output_string
95 void *string; /* string to display (in debugged process address space) */
96 int unicode; /* is it Unicode? */
97 int length; /* string length */
99 struct debug_event_rip_info
101 int error; /* ??? */
102 int type; /* ??? */
104 union debug_event_data
106 struct debug_event_exception exception;
107 struct debug_event_create_thread create_thread;
108 struct debug_event_create_process create_process;
109 struct debug_event_exit exit;
110 struct debug_event_load_dll load_dll;
111 struct debug_event_unload_dll unload_dll;
112 struct debug_event_output_string output_string;
113 struct debug_event_rip_info rip_info;
116 /* debug event data */
117 typedef struct
119 int code; /* event code */
120 union debug_event_data info; /* event information */
121 } debug_event_t;
124 /* Create a new process from the context of the parent */
125 struct new_process_request
127 REQUEST_HEADER; /* request header */
128 IN int inherit_all; /* inherit all handles from parent */
129 IN int create_flags; /* creation flags */
130 IN int start_flags; /* flags from startup info */
131 IN int exe_file; /* file handle for main exe */
132 IN int hstdin; /* handle for stdin */
133 IN int hstdout; /* handle for stdout */
134 IN int hstderr; /* handle for stderr */
135 IN int cmd_show; /* main window show mode */
136 IN int alloc_fd; /* create the fd pair right now? */
137 IN VARARG(filename,string); /* file name of main exe */
141 /* Wait for the new process to start */
142 struct wait_process_request
144 REQUEST_HEADER; /* request header */
145 IN int pinherit; /* process handle inherit flag */
146 IN int tinherit; /* thread handle inherit flag */
147 IN int timeout; /* wait timeout */
148 IN int cancel; /* cancel the process creation? */
149 OUT void* pid; /* process id */
150 OUT int phandle; /* process handle (in the current process) */
151 OUT void* tid; /* thread id */
152 OUT int thandle; /* thread handle (in the current process) */
153 OUT int event; /* event handle to signal startup */
157 /* Create a new thread from the context of the parent */
158 struct new_thread_request
160 REQUEST_HEADER; /* request header */
161 IN int suspend; /* new thread should be suspended on creation */
162 IN int inherit; /* inherit flag */
163 OUT void* tid; /* thread id */
164 OUT int handle; /* thread handle (in the current process) */
168 /* Signal that we are finished booting on the client side */
169 struct boot_done_request
171 REQUEST_HEADER; /* request header */
172 IN int debug_level; /* new debug level */
176 /* Initialize a process; called from the new process context */
177 struct init_process_request
179 REQUEST_HEADER; /* request header */
180 IN void* ldt_copy; /* addr of LDT copy */
181 IN void* ldt_flags; /* addr of LDT flags */
182 IN int ppid; /* parent Unix pid */
183 OUT int start_flags; /* flags from startup info */
184 OUT unsigned int server_start; /* server start time (GetTickCount) */
185 OUT int exe_file; /* file handle for main exe */
186 OUT int hstdin; /* handle for stdin */
187 OUT int hstdout; /* handle for stdout */
188 OUT int hstderr; /* handle for stderr */
189 OUT int cmd_show; /* main window show mode */
190 OUT VARARG(filename,string); /* file name of main exe */
194 /* Signal the end of the process initialization */
195 struct init_process_done_request
197 REQUEST_HEADER; /* request header */
198 IN void* module; /* main module base address */
199 IN void* entry; /* process entry point */
200 IN void* name; /* ptr to ptr to name (in process addr space) */
201 IN int gui; /* is it a GUI process? */
202 OUT int debugged; /* being debugged? */
206 /* Initialize a thread; called from the child after fork()/clone() */
207 struct init_thread_request
209 REQUEST_HEADER; /* request header */
210 IN int unix_pid; /* Unix pid of new thread */
211 IN void* teb; /* TEB of new thread (in thread address space) */
212 IN void* entry; /* thread entry point (in thread address space) */
216 /* Retrieve the thread buffer file descriptor */
217 /* The reply to this request is the first thing a newly */
218 /* created thread gets (without having to request it) */
219 struct get_thread_buffer_request
221 REQUEST_HEADER; /* request header */
222 OUT void* pid; /* process id of the new thread's process */
223 OUT void* tid; /* thread id of the new thread */
224 OUT int boot; /* is this the boot thread? */
225 OUT int version; /* protocol version */
229 /* Terminate a process */
230 struct terminate_process_request
232 REQUEST_HEADER; /* request header */
233 IN int handle; /* process handle to terminate */
234 IN int exit_code; /* process exit code */
235 OUT int self; /* suicide? */
239 /* Terminate a thread */
240 struct terminate_thread_request
242 REQUEST_HEADER; /* request header */
243 IN int handle; /* thread handle to terminate */
244 IN int exit_code; /* thread exit code */
245 OUT int self; /* suicide? */
246 OUT int last; /* last thread in this process? */
250 /* Retrieve information about a process */
251 struct get_process_info_request
253 REQUEST_HEADER; /* request header */
254 IN int handle; /* process handle */
255 OUT void* pid; /* server process id */
256 OUT int debugged; /* debugged? */
257 OUT int exit_code; /* process exit code */
258 OUT int priority; /* priority class */
259 OUT int process_affinity; /* process affinity mask */
260 OUT int system_affinity; /* system affinity mask */
264 /* Set a process informations */
265 struct set_process_info_request
267 REQUEST_HEADER; /* request header */
268 IN int handle; /* process handle */
269 IN int mask; /* setting mask (see below) */
270 IN int priority; /* priority class */
271 IN int affinity; /* affinity mask */
273 #define SET_PROCESS_INFO_PRIORITY 0x01
274 #define SET_PROCESS_INFO_AFFINITY 0x02
277 /* Retrieve information about a thread */
278 struct get_thread_info_request
280 REQUEST_HEADER; /* request header */
281 IN int handle; /* thread handle */
282 IN void* tid_in; /* thread id (optional) */
283 OUT void* tid; /* server thread id */
284 OUT void* teb; /* thread teb pointer */
285 OUT int exit_code; /* thread exit code */
286 OUT int priority; /* thread priority level */
290 /* Set a thread informations */
291 struct set_thread_info_request
293 REQUEST_HEADER; /* request header */
294 IN int handle; /* thread handle */
295 IN int mask; /* setting mask (see below) */
296 IN int priority; /* priority class */
297 IN int affinity; /* affinity mask */
299 #define SET_THREAD_INFO_PRIORITY 0x01
300 #define SET_THREAD_INFO_AFFINITY 0x02
303 /* Suspend a thread */
304 struct suspend_thread_request
306 REQUEST_HEADER; /* request header */
307 IN int handle; /* thread handle */
308 OUT int count; /* new suspend count */
312 /* Resume a thread */
313 struct resume_thread_request
315 REQUEST_HEADER; /* request header */
316 IN int handle; /* thread handle */
317 OUT int count; /* new suspend count */
321 /* Notify the server that a dll has been loaded */
322 struct load_dll_request
324 REQUEST_HEADER; /* request header */
325 IN int handle; /* file handle */
326 IN void* base; /* base address */
327 IN int dbg_offset; /* debug info offset */
328 IN int dbg_size; /* debug info size */
329 IN void* name; /* ptr to ptr to name (in process addr space) */
333 /* Notify the server that a dll is being unloaded */
334 struct unload_dll_request
336 REQUEST_HEADER; /* request header */
337 IN void* base; /* base address */
341 /* Queue an APC for a thread */
342 struct queue_apc_request
344 REQUEST_HEADER; /* request header */
345 IN int handle; /* thread handle */
346 IN void* func; /* function to call */
347 IN void* param; /* param for function to call */
351 /* Get next APC to call */
352 struct get_apc_request
354 REQUEST_HEADER; /* request header */
355 OUT void* func; /* function to call */
356 OUT int type; /* function type */
357 OUT VARARG(args,ptrs); /* function arguments */
359 enum apc_type { APC_NONE, APC_USER, APC_TIMER };
362 /* Close a handle for the current process */
363 struct close_handle_request
365 REQUEST_HEADER; /* request header */
366 IN int handle; /* handle to close */
370 /* Get information about a handle */
371 struct get_handle_info_request
373 REQUEST_HEADER; /* request header */
374 IN int handle; /* handle we are interested in */
375 OUT int flags; /* handle flags */
379 /* Set a handle information */
380 struct set_handle_info_request
382 REQUEST_HEADER; /* request header */
383 IN int handle; /* handle we are interested in */
384 IN int flags; /* new handle flags */
385 IN int mask; /* mask for flags to set */
389 /* Duplicate a handle */
390 struct dup_handle_request
392 REQUEST_HEADER; /* request header */
393 IN int src_process; /* src process handle */
394 IN int src_handle; /* src handle to duplicate */
395 IN int dst_process; /* dst process handle */
396 IN unsigned int access; /* wanted access rights */
397 IN int inherit; /* inherit flag */
398 IN int options; /* duplicate options (see below) */
399 OUT int handle; /* duplicated handle in dst process */
401 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
402 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
403 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
406 /* Open a handle to a process */
407 struct open_process_request
409 REQUEST_HEADER; /* request header */
410 IN void* pid; /* process id to open */
411 IN unsigned int access; /* wanted access rights */
412 IN int inherit; /* inherit flag */
413 OUT int handle; /* handle to the process */
417 /* Wait for handles */
418 struct select_request
420 REQUEST_HEADER; /* request header */
421 IN int flags; /* wait flags (see below) */
422 IN int timeout; /* timeout in ms */
423 OUT int signaled; /* signaled handle */
424 IN VARARG(handles,ints); /* handles to select on */
426 #define SELECT_ALL 1
427 #define SELECT_ALERTABLE 2
428 #define SELECT_TIMEOUT 4
431 /* Create an event */
432 struct create_event_request
434 REQUEST_HEADER; /* request header */
435 IN int manual_reset; /* manual reset event */
436 IN int initial_state; /* initial state of the event */
437 IN int inherit; /* inherit flag */
438 OUT int handle; /* handle to the event */
439 IN VARARG(name,unicode_str); /* object name */
442 /* Event operation */
443 struct event_op_request
445 REQUEST_HEADER; /* request header */
446 IN int handle; /* handle to event */
447 IN int op; /* event operation (see below) */
449 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
452 /* Open an event */
453 struct open_event_request
455 REQUEST_HEADER; /* request header */
456 IN unsigned int access; /* wanted access rights */
457 IN int inherit; /* inherit flag */
458 OUT int handle; /* handle to the event */
459 IN VARARG(name,unicode_str); /* object name */
463 /* Create a mutex */
464 struct create_mutex_request
466 REQUEST_HEADER; /* request header */
467 IN int owned; /* initially owned? */
468 IN int inherit; /* inherit flag */
469 OUT int handle; /* handle to the mutex */
470 IN VARARG(name,unicode_str); /* object name */
474 /* Release a mutex */
475 struct release_mutex_request
477 REQUEST_HEADER; /* request header */
478 IN int handle; /* handle to the mutex */
482 /* Open a mutex */
483 struct open_mutex_request
485 REQUEST_HEADER; /* request header */
486 IN unsigned int access; /* wanted access rights */
487 IN int inherit; /* inherit flag */
488 OUT int handle; /* handle to the mutex */
489 IN VARARG(name,unicode_str); /* object name */
493 /* Create a semaphore */
494 struct create_semaphore_request
496 REQUEST_HEADER; /* request header */
497 IN unsigned int initial; /* initial count */
498 IN unsigned int max; /* maximum count */
499 IN int inherit; /* inherit flag */
500 OUT int handle; /* handle to the semaphore */
501 IN VARARG(name,unicode_str); /* object name */
505 /* Release a semaphore */
506 struct release_semaphore_request
508 REQUEST_HEADER; /* request header */
509 IN int handle; /* handle to the semaphore */
510 IN unsigned int count; /* count to add to semaphore */
511 OUT unsigned int prev_count; /* previous semaphore count */
515 /* Open a semaphore */
516 struct open_semaphore_request
518 REQUEST_HEADER; /* request header */
519 IN unsigned int access; /* wanted access rights */
520 IN int inherit; /* inherit flag */
521 OUT int handle; /* handle to the semaphore */
522 IN VARARG(name,unicode_str); /* object name */
526 /* Create a file */
527 struct create_file_request
529 REQUEST_HEADER; /* request header */
530 IN unsigned int access; /* wanted access rights */
531 IN int inherit; /* inherit flag */
532 IN unsigned int sharing; /* sharing flags */
533 IN int create; /* file create action */
534 IN unsigned int attrs; /* file attributes for creation */
535 OUT int handle; /* handle to the file */
536 IN VARARG(filename,string); /* file name */
540 /* Allocate a file handle for a Unix fd */
541 struct alloc_file_handle_request
543 REQUEST_HEADER; /* request header */
544 IN unsigned int access; /* wanted access rights */
545 OUT int handle; /* handle to the file */
549 /* Get a Unix fd to read from a file */
550 struct get_read_fd_request
552 REQUEST_HEADER; /* request header */
553 IN int handle; /* handle to the file */
557 /* Get a Unix fd to write to a file */
558 struct get_write_fd_request
560 REQUEST_HEADER; /* request header */
561 IN int handle; /* handle to the file */
565 /* Set a file current position */
566 struct set_file_pointer_request
568 REQUEST_HEADER; /* request header */
569 IN int handle; /* handle to the file */
570 IN int low; /* position low word */
571 IN int high; /* position high word */
572 IN int whence; /* whence to seek */
573 OUT int new_low; /* new position low word */
574 OUT int new_high; /* new position high word */
578 /* Truncate (or extend) a file */
579 struct truncate_file_request
581 REQUEST_HEADER; /* request header */
582 IN int handle; /* handle to the file */
586 /* Set a file access and modification times */
587 struct set_file_time_request
589 REQUEST_HEADER; /* request header */
590 IN int handle; /* handle to the file */
591 IN time_t access_time; /* last access time */
592 IN time_t write_time; /* last write time */
596 /* Flush a file buffers */
597 struct flush_file_request
599 REQUEST_HEADER; /* request header */
600 IN int handle; /* handle to the file */
604 /* Get information about a file */
605 struct get_file_info_request
607 REQUEST_HEADER; /* request header */
608 IN int handle; /* handle to the file */
609 OUT int type; /* file type */
610 OUT int attr; /* file attributes */
611 OUT time_t access_time; /* last access time */
612 OUT time_t write_time; /* last write time */
613 OUT int size_high; /* file size */
614 OUT int size_low; /* file size */
615 OUT int links; /* number of links */
616 OUT int index_high; /* unique index */
617 OUT int index_low; /* unique index */
618 OUT unsigned int serial; /* volume serial number */
622 /* Lock a region of a file */
623 struct lock_file_request
625 REQUEST_HEADER; /* request header */
626 IN int handle; /* handle to the file */
627 IN unsigned int offset_low; /* offset of start of lock */
628 IN unsigned int offset_high; /* offset of start of lock */
629 IN unsigned int count_low; /* count of bytes to lock */
630 IN unsigned int count_high; /* count of bytes to lock */
634 /* Unlock a region of a file */
635 struct unlock_file_request
637 REQUEST_HEADER; /* request header */
638 IN int handle; /* handle to the file */
639 IN unsigned int offset_low; /* offset of start of unlock */
640 IN unsigned int offset_high; /* offset of start of unlock */
641 IN unsigned int count_low; /* count of bytes to unlock */
642 IN unsigned int count_high; /* count of bytes to unlock */
646 /* Create an anonymous pipe */
647 struct create_pipe_request
649 REQUEST_HEADER; /* request header */
650 IN int inherit; /* inherit flag */
651 OUT int handle_read; /* handle to the read-side of the pipe */
652 OUT int handle_write; /* handle to the write-side of the pipe */
656 /* Create a socket */
657 struct create_socket_request
659 REQUEST_HEADER; /* request header */
660 IN unsigned int access; /* wanted access rights */
661 IN int inherit; /* inherit flag */
662 IN int family; /* family, see socket manpage */
663 IN int type; /* type, see socket manpage */
664 IN int protocol; /* protocol, see socket manpage */
665 OUT int handle; /* handle to the new socket */
669 /* Accept a socket */
670 struct accept_socket_request
672 REQUEST_HEADER; /* request header */
673 IN int lhandle; /* handle to the listening socket */
674 IN unsigned int access; /* wanted access rights */
675 IN int inherit; /* inherit flag */
676 OUT int handle; /* handle to the new socket */
680 /* Set socket event parameters */
681 struct set_socket_event_request
683 REQUEST_HEADER; /* request header */
684 IN int handle; /* handle to the socket */
685 IN unsigned int mask; /* event mask */
686 IN int event; /* event object */
690 /* Get socket event parameters */
691 struct get_socket_event_request
693 REQUEST_HEADER; /* request header */
694 IN int handle; /* handle to the socket */
695 IN int service; /* clear pending? */
696 IN int s_event; /* "expected" event object */
697 IN int c_event; /* event to clear */
698 OUT unsigned int mask; /* event mask */
699 OUT unsigned int pmask; /* pending events */
700 OUT unsigned int state; /* status bits */
701 OUT VARARG(errors,ints); /* event errors */
705 /* Reenable pending socket events */
706 struct enable_socket_event_request
708 REQUEST_HEADER; /* request header */
709 IN int handle; /* handle to the socket */
710 IN unsigned int mask; /* events to re-enable */
711 IN unsigned int sstate; /* status bits to set */
712 IN unsigned int cstate; /* status bits to clear */
716 /* Allocate a console for the current process */
717 struct alloc_console_request
719 REQUEST_HEADER; /* request header */
720 IN unsigned int access; /* wanted access rights */
721 IN int inherit; /* inherit flag */
722 OUT int handle_in; /* handle to console input */
723 OUT int handle_out; /* handle to console output */
727 /* Free the console of the current process */
728 struct free_console_request
730 REQUEST_HEADER; /* request header */
734 /* Open a handle to the process console */
735 struct open_console_request
737 REQUEST_HEADER; /* request header */
738 IN int output; /* input or output? */
739 IN unsigned int access; /* wanted access rights */
740 IN int inherit; /* inherit flag */
741 OUT int handle; /* handle to the console */
745 /* Set a console file descriptor */
746 struct set_console_fd_request
748 REQUEST_HEADER; /* request header */
749 IN int handle; /* handle to the console */
750 IN int file_handle; /* handle of file to use as file descriptor */
751 IN int pid; /* pid of xterm (hack) */
755 /* Get a console mode (input or output) */
756 struct get_console_mode_request
758 REQUEST_HEADER; /* request header */
759 IN int handle; /* handle to the console */
760 OUT int mode; /* console mode */
764 /* Set a console mode (input or output) */
765 struct set_console_mode_request
767 REQUEST_HEADER; /* request header */
768 IN int handle; /* handle to the console */
769 IN int mode; /* console mode */
773 /* Set info about a console (output only) */
774 struct set_console_info_request
776 REQUEST_HEADER; /* request header */
777 IN int handle; /* handle to the console */
778 IN int mask; /* setting mask (see below) */
779 IN int cursor_size; /* size of cursor (percentage filled) */
780 IN int cursor_visible;/* cursor visibility flag */
781 IN VARARG(title,string); /* console title */
783 #define SET_CONSOLE_INFO_CURSOR 0x01
784 #define SET_CONSOLE_INFO_TITLE 0x02
786 /* Get info about a console (output only) */
787 struct get_console_info_request
789 REQUEST_HEADER; /* request header */
790 IN int handle; /* handle to the console */
791 OUT int cursor_size; /* size of cursor (percentage filled) */
792 OUT int cursor_visible;/* cursor visibility flag */
793 OUT int pid; /* pid of xterm (hack) */
794 OUT VARARG(title,string); /* console title */
798 /* Add input records to a console input queue */
799 struct write_console_input_request
801 REQUEST_HEADER; /* request header */
802 IN int handle; /* handle to the console input */
803 OUT int written; /* number of records written */
804 IN VARARG(rec,input_records); /* input records */
807 /* Fetch input records from a console input queue */
808 struct read_console_input_request
810 REQUEST_HEADER; /* request header */
811 IN int handle; /* handle to the console input */
812 IN int flush; /* flush the retrieved records from the queue? */
813 OUT int read; /* number of records read */
814 OUT VARARG(rec,input_records); /* input records */
818 /* Create a change notification */
819 struct create_change_notification_request
821 REQUEST_HEADER; /* request header */
822 IN int subtree; /* watch all the subtree */
823 IN int filter; /* notification filter */
824 OUT int handle; /* handle to the change notification */
828 /* Create a file mapping */
829 struct create_mapping_request
831 REQUEST_HEADER; /* request header */
832 IN int size_high; /* mapping size */
833 IN int size_low; /* mapping size */
834 IN int protect; /* protection flags (see below) */
835 IN int inherit; /* inherit flag */
836 IN int file_handle; /* file handle */
837 OUT int handle; /* handle to the mapping */
838 IN VARARG(name,unicode_str); /* object name */
840 /* protection flags */
841 #define VPROT_READ 0x01
842 #define VPROT_WRITE 0x02
843 #define VPROT_EXEC 0x04
844 #define VPROT_WRITECOPY 0x08
845 #define VPROT_GUARD 0x10
846 #define VPROT_NOCACHE 0x20
847 #define VPROT_COMMITTED 0x40
848 #define VPROT_IMAGE 0x80
851 /* Open a mapping */
852 struct open_mapping_request
854 REQUEST_HEADER; /* request header */
855 IN unsigned int access; /* wanted access rights */
856 IN int inherit; /* inherit flag */
857 OUT int handle; /* handle to the mapping */
858 IN VARARG(name,unicode_str); /* object name */
862 /* Get information about a file mapping */
863 struct get_mapping_info_request
865 REQUEST_HEADER; /* request header */
866 IN int handle; /* handle to the mapping */
867 OUT int size_high; /* mapping size */
868 OUT int size_low; /* mapping size */
869 OUT int protect; /* protection flags */
870 OUT int header_size; /* header size (for VPROT_IMAGE mapping) */
871 OUT void* base; /* default base addr (for VPROT_IMAGE mapping) */
872 OUT int shared_file; /* shared mapping file handle */
873 OUT int shared_size; /* shared mapping size */
877 /* Create a device */
878 struct create_device_request
880 REQUEST_HEADER; /* request header */
881 IN unsigned int access; /* wanted access rights */
882 IN int inherit; /* inherit flag */
883 IN int id; /* client private id */
884 OUT int handle; /* handle to the device */
888 /* Create a snapshot */
889 struct create_snapshot_request
891 REQUEST_HEADER; /* request header */
892 IN int inherit; /* inherit flag */
893 IN int flags; /* snapshot flags (TH32CS_*) */
894 IN void* pid; /* process id */
895 OUT int handle; /* handle to the snapshot */
899 /* Get the next process from a snapshot */
900 struct next_process_request
902 REQUEST_HEADER; /* request header */
903 IN int handle; /* handle to the snapshot */
904 IN int reset; /* reset snapshot position? */
905 OUT int count; /* process usage count */
906 OUT void* pid; /* process id */
907 OUT int threads; /* number of threads */
908 OUT int priority; /* process priority */
912 /* Get the next thread from a snapshot */
913 struct next_thread_request
915 REQUEST_HEADER; /* request header */
916 IN int handle; /* handle to the snapshot */
917 IN int reset; /* reset snapshot position? */
918 OUT int count; /* thread usage count */
919 OUT void* pid; /* process id */
920 OUT void* tid; /* thread id */
921 OUT int base_pri; /* base priority */
922 OUT int delta_pri; /* delta priority */
926 /* Get the next module from a snapshot */
927 struct next_module_request
929 REQUEST_HEADER; /* request header */
930 IN int handle; /* handle to the snapshot */
931 IN int reset; /* reset snapshot position? */
932 OUT void* pid; /* process id */
933 OUT void* base; /* module base address */
937 /* Wait for a debug event */
938 struct wait_debug_event_request
940 REQUEST_HEADER; /* request header */
941 IN int timeout; /* timeout in ms */
942 OUT void* pid; /* process id */
943 OUT void* tid; /* thread id */
944 OUT VARARG(event,debug_event); /* debug event data */
948 /* Send an exception event */
949 struct exception_event_request
951 REQUEST_HEADER; /* request header */
952 IN int first; /* first chance exception? */
953 OUT int status; /* event continuation status */
954 IN VARARG(record,exc_event); /* thread context followed by exception record */
955 OUT VARARG(context,context); /* modified thread context */
959 /* Send an output string to the debugger */
960 struct output_debug_string_request
962 REQUEST_HEADER; /* request header */
963 IN void* string; /* string to display (in debugged process address space) */
964 IN int unicode; /* is it Unicode? */
965 IN int length; /* string length */
969 /* Continue a debug event */
970 struct continue_debug_event_request
972 REQUEST_HEADER; /* request header */
973 IN void* pid; /* process id to continue */
974 IN void* tid; /* thread id to continue */
975 IN int status; /* continuation status */
979 /* Start debugging an existing process */
980 struct debug_process_request
982 REQUEST_HEADER; /* request header */
983 IN void* pid; /* id of the process to debug */
987 /* Read data from a process address space */
988 struct read_process_memory_request
990 REQUEST_HEADER; /* request header */
991 IN int handle; /* process handle */
992 IN void* addr; /* addr to read from (must be int-aligned) */
993 IN int len; /* number of ints to read */
994 OUT unsigned int data[1]; /* result data */
998 /* Write data to a process address space */
999 struct write_process_memory_request
1001 REQUEST_HEADER; /* request header */
1002 IN int handle; /* process handle */
1003 IN void* addr; /* addr to write to (must be int-aligned) */
1004 IN int len; /* number of ints to write */
1005 IN unsigned int first_mask; /* mask for first word */
1006 IN unsigned int last_mask; /* mask for last word */
1007 IN unsigned int data[1]; /* data to write */
1011 /* Create a registry key */
1012 struct create_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 IN unsigned int options; /* creation options */
1018 IN time_t modif; /* last modification time */
1019 OUT int hkey; /* handle to the created key */
1020 OUT int created; /* has it been newly created? */
1021 IN path_t name; /* key name */
1022 IN WCHAR class[1]; /* class name */
1026 /* Open a registry key */
1027 struct open_key_request
1029 REQUEST_HEADER; /* request header */
1030 IN int parent; /* handle to the parent key */
1031 IN unsigned int access; /* desired access rights */
1032 OUT int hkey; /* handle to the open key */
1033 IN path_t name; /* key name */
1037 /* Delete a registry key */
1038 struct delete_key_request
1040 REQUEST_HEADER; /* request header */
1041 IN int hkey; /* handle to the parent key */
1042 IN path_t name; /* key name */
1046 /* Close a registry key */
1047 struct close_key_request
1049 REQUEST_HEADER; /* request header */
1050 IN int hkey; /* key to close */
1054 /* Enumerate registry subkeys */
1055 struct enum_key_request
1057 REQUEST_HEADER; /* request header */
1058 IN int hkey; /* handle to registry key */
1059 IN int index; /* index of subkey */
1060 OUT time_t modif; /* last modification time */
1061 OUT path_t name; /* subkey name */
1062 OUT WCHAR class[1]; /* class name */
1066 /* Query information about a registry key */
1067 struct query_key_info_request
1069 REQUEST_HEADER; /* request header */
1070 IN int hkey; /* handle to registry key */
1071 OUT int subkeys; /* number of subkeys */
1072 OUT int max_subkey; /* longest subkey name */
1073 OUT int max_class; /* longest class name */
1074 OUT int values; /* number of values */
1075 OUT int max_value; /* longest value name */
1076 OUT int max_data; /* longest value data */
1077 OUT time_t modif; /* last modification time */
1078 OUT path_t name; /* key name */
1079 OUT WCHAR class[1]; /* class name */
1083 /* Set a value of a registry key */
1084 struct set_key_value_request
1086 REQUEST_HEADER; /* request header */
1087 IN int hkey; /* handle to registry key */
1088 IN int type; /* value type */
1089 IN unsigned int total; /* total value len */
1090 IN unsigned int offset; /* offset for setting data */
1091 IN unsigned int len; /* value data len */
1092 IN path_t name; /* value name */
1093 IN unsigned char data[1]; /* value data */
1097 /* Retrieve the value of a registry key */
1098 struct get_key_value_request
1100 REQUEST_HEADER; /* request header */
1101 IN int hkey; /* handle to registry key */
1102 IN unsigned int offset; /* offset for getting data */
1103 OUT int type; /* value type */
1104 OUT int len; /* value data len */
1105 IN WCHAR name[1]; /* value name */
1106 OUT unsigned char data[1]; /* value data */
1110 /* Enumerate a value of a registry key */
1111 struct enum_key_value_request
1113 REQUEST_HEADER; /* request header */
1114 IN int hkey; /* handle to registry key */
1115 IN int index; /* value index */
1116 IN unsigned int offset; /* offset for getting data */
1117 OUT int type; /* value type */
1118 OUT int len; /* value data len */
1119 OUT path_t name; /* value name */
1120 OUT unsigned char data[1]; /* value data */
1124 /* Delete a value of a registry key */
1125 struct delete_key_value_request
1127 REQUEST_HEADER; /* request header */
1128 IN int hkey; /* handle to registry key */
1129 IN path_t name; /* value name */
1133 /* Load a registry branch from a file */
1134 struct load_registry_request
1136 REQUEST_HEADER; /* request header */
1137 IN int hkey; /* root key to load to */
1138 IN int file; /* file to load from */
1139 IN path_t name; /* subkey name */
1143 /* Save a registry branch to a file */
1144 struct save_registry_request
1146 REQUEST_HEADER; /* request header */
1147 IN int hkey; /* key to save */
1148 IN int file; /* file to save to */
1152 /* Save a registry branch at server exit */
1153 struct save_registry_atexit_request
1155 REQUEST_HEADER; /* request header */
1156 IN int hkey; /* key to save */
1157 IN char file[1]; /* file to save to */
1161 /* Set the current and saving level for the registry */
1162 struct set_registry_levels_request
1164 REQUEST_HEADER; /* request header */
1165 IN int current; /* new current level */
1166 IN int saving; /* new saving level */
1167 IN int period; /* duration between periodic saves (milliseconds) */
1171 /* Create a waitable timer */
1172 struct create_timer_request
1174 REQUEST_HEADER; /* request header */
1175 IN int inherit; /* inherit flag */
1176 IN int manual; /* manual reset */
1177 OUT int handle; /* handle to the timer */
1178 IN VARARG(name,unicode_str); /* object name */
1182 /* Open a waitable timer */
1183 struct open_timer_request
1185 REQUEST_HEADER; /* request header */
1186 IN unsigned int access; /* wanted access rights */
1187 IN int inherit; /* inherit flag */
1188 OUT int handle; /* handle to the timer */
1189 IN VARARG(name,unicode_str); /* object name */
1192 /* Set a waitable timer */
1193 struct set_timer_request
1195 REQUEST_HEADER; /* request header */
1196 IN int handle; /* handle to the timer */
1197 IN int sec; /* next expiration absolute time */
1198 IN int usec; /* next expiration absolute time */
1199 IN int period; /* timer period in ms */
1200 IN void* callback; /* callback function */
1201 IN void* arg; /* callback argument */
1204 /* Cancel a waitable timer */
1205 struct cancel_timer_request
1207 REQUEST_HEADER; /* request header */
1208 IN int handle; /* handle to the timer */
1212 /* Retrieve the current context of a thread */
1213 struct get_thread_context_request
1215 REQUEST_HEADER; /* request header */
1216 IN int handle; /* thread handle */
1217 IN unsigned int flags; /* context flags */
1218 OUT VARARG(context,context); /* thread context */
1222 /* Set the current context of a thread */
1223 struct set_thread_context_request
1225 REQUEST_HEADER; /* request header */
1226 IN int handle; /* thread handle */
1227 IN unsigned int flags; /* context flags */
1228 IN VARARG(context,context); /* thread context */
1232 /* Fetch a selector entry for a thread */
1233 struct get_selector_entry_request
1235 REQUEST_HEADER; /* request header */
1236 IN int handle; /* thread handle */
1237 IN int entry; /* LDT entry */
1238 OUT unsigned int base; /* selector base */
1239 OUT unsigned int limit; /* selector limit */
1240 OUT unsigned char flags; /* selector flags */
1244 /* Add an atom */
1245 struct add_atom_request
1247 REQUEST_HEADER; /* request header */
1248 IN int local; /* is atom in local process table? */
1249 OUT int atom; /* resulting atom */
1250 IN VARARG(name,unicode_str); /* atom name */
1254 /* Delete an atom */
1255 struct delete_atom_request
1257 REQUEST_HEADER; /* request header */
1258 IN int atom; /* atom handle */
1259 IN int local; /* is atom in local process table? */
1263 /* Find an atom */
1264 struct find_atom_request
1266 REQUEST_HEADER; /* request header */
1267 IN int local; /* is atom in local process table? */
1268 OUT int atom; /* atom handle */
1269 IN VARARG(name,unicode_str); /* atom name */
1273 /* Get an atom name */
1274 struct get_atom_name_request
1276 REQUEST_HEADER; /* request header */
1277 IN int atom; /* atom handle */
1278 IN int local; /* is atom in local process table? */
1279 OUT int count; /* atom lock count */
1280 OUT VARARG(name,unicode_str); /* atom name */
1284 /* Init the process atom table */
1285 struct init_atom_table_request
1287 REQUEST_HEADER; /* request header */
1288 IN int entries; /* number of entries */
1292 /* Get the message queue of the current thread */
1293 struct get_msg_queue_request
1295 REQUEST_HEADER; /* request header */
1296 OUT int handle; /* handle to the queue */
1299 /* Wake up a message queue */
1300 struct wake_queue_request
1302 REQUEST_HEADER; /* request header */
1303 IN int handle; /* handle to the queue */
1304 IN unsigned int bits; /* wake bits */
1307 /* Wait for a process to start waiting on input */
1308 struct wait_input_idle_request
1310 REQUEST_HEADER; /* request header */
1311 IN int handle; /* process handle */
1312 IN int timeout; /* timeout */
1313 OUT int event; /* handle to idle event */
1316 struct create_serial_request
1318 REQUEST_HEADER; /* request header */
1319 IN unsigned int access; /* wanted access rights */
1320 IN int inherit; /* inherit flag */
1321 IN unsigned int sharing; /* sharing flags */
1322 OUT int handle; /* handle to the port */
1323 IN char name[1]; /* file name */
1326 struct get_serial_info_request
1328 REQUEST_HEADER; /* request header */
1329 IN int handle; /* handle to comm port */
1330 OUT unsigned int readinterval;
1331 OUT unsigned int readconst;
1332 OUT unsigned int readmult;
1333 OUT unsigned int writeconst;
1334 OUT unsigned int writemult;
1335 OUT unsigned int eventmask;
1336 OUT unsigned int commerror;
1339 struct set_serial_info_request
1341 REQUEST_HEADER; /* request header */
1342 IN int handle; /* handle to comm port */
1343 IN int flags; /* bitmask to set values (see below) */
1344 IN unsigned int readinterval;
1345 IN unsigned int readconst;
1346 IN unsigned int readmult;
1347 IN unsigned int writeconst;
1348 IN unsigned int writemult;
1349 IN unsigned int eventmask;
1350 IN unsigned int commerror;
1352 #define SERIALINFO_SET_TIMEOUTS 0x01
1353 #define SERIALINFO_SET_MASK 0x02
1354 #define SERIALINFO_SET_ERROR 0x04
1356 /* Everything below this line is generated automatically by tools/make_requests */
1357 /* ### make_requests begin ### */
1359 enum request
1361 REQ_NEW_PROCESS,
1362 REQ_WAIT_PROCESS,
1363 REQ_NEW_THREAD,
1364 REQ_BOOT_DONE,
1365 REQ_INIT_PROCESS,
1366 REQ_INIT_PROCESS_DONE,
1367 REQ_INIT_THREAD,
1368 REQ_GET_THREAD_BUFFER,
1369 REQ_TERMINATE_PROCESS,
1370 REQ_TERMINATE_THREAD,
1371 REQ_GET_PROCESS_INFO,
1372 REQ_SET_PROCESS_INFO,
1373 REQ_GET_THREAD_INFO,
1374 REQ_SET_THREAD_INFO,
1375 REQ_SUSPEND_THREAD,
1376 REQ_RESUME_THREAD,
1377 REQ_LOAD_DLL,
1378 REQ_UNLOAD_DLL,
1379 REQ_QUEUE_APC,
1380 REQ_GET_APC,
1381 REQ_CLOSE_HANDLE,
1382 REQ_GET_HANDLE_INFO,
1383 REQ_SET_HANDLE_INFO,
1384 REQ_DUP_HANDLE,
1385 REQ_OPEN_PROCESS,
1386 REQ_SELECT,
1387 REQ_CREATE_EVENT,
1388 REQ_EVENT_OP,
1389 REQ_OPEN_EVENT,
1390 REQ_CREATE_MUTEX,
1391 REQ_RELEASE_MUTEX,
1392 REQ_OPEN_MUTEX,
1393 REQ_CREATE_SEMAPHORE,
1394 REQ_RELEASE_SEMAPHORE,
1395 REQ_OPEN_SEMAPHORE,
1396 REQ_CREATE_FILE,
1397 REQ_ALLOC_FILE_HANDLE,
1398 REQ_GET_READ_FD,
1399 REQ_GET_WRITE_FD,
1400 REQ_SET_FILE_POINTER,
1401 REQ_TRUNCATE_FILE,
1402 REQ_SET_FILE_TIME,
1403 REQ_FLUSH_FILE,
1404 REQ_GET_FILE_INFO,
1405 REQ_LOCK_FILE,
1406 REQ_UNLOCK_FILE,
1407 REQ_CREATE_PIPE,
1408 REQ_CREATE_SOCKET,
1409 REQ_ACCEPT_SOCKET,
1410 REQ_SET_SOCKET_EVENT,
1411 REQ_GET_SOCKET_EVENT,
1412 REQ_ENABLE_SOCKET_EVENT,
1413 REQ_ALLOC_CONSOLE,
1414 REQ_FREE_CONSOLE,
1415 REQ_OPEN_CONSOLE,
1416 REQ_SET_CONSOLE_FD,
1417 REQ_GET_CONSOLE_MODE,
1418 REQ_SET_CONSOLE_MODE,
1419 REQ_SET_CONSOLE_INFO,
1420 REQ_GET_CONSOLE_INFO,
1421 REQ_WRITE_CONSOLE_INPUT,
1422 REQ_READ_CONSOLE_INPUT,
1423 REQ_CREATE_CHANGE_NOTIFICATION,
1424 REQ_CREATE_MAPPING,
1425 REQ_OPEN_MAPPING,
1426 REQ_GET_MAPPING_INFO,
1427 REQ_CREATE_DEVICE,
1428 REQ_CREATE_SNAPSHOT,
1429 REQ_NEXT_PROCESS,
1430 REQ_NEXT_THREAD,
1431 REQ_NEXT_MODULE,
1432 REQ_WAIT_DEBUG_EVENT,
1433 REQ_EXCEPTION_EVENT,
1434 REQ_OUTPUT_DEBUG_STRING,
1435 REQ_CONTINUE_DEBUG_EVENT,
1436 REQ_DEBUG_PROCESS,
1437 REQ_READ_PROCESS_MEMORY,
1438 REQ_WRITE_PROCESS_MEMORY,
1439 REQ_CREATE_KEY,
1440 REQ_OPEN_KEY,
1441 REQ_DELETE_KEY,
1442 REQ_CLOSE_KEY,
1443 REQ_ENUM_KEY,
1444 REQ_QUERY_KEY_INFO,
1445 REQ_SET_KEY_VALUE,
1446 REQ_GET_KEY_VALUE,
1447 REQ_ENUM_KEY_VALUE,
1448 REQ_DELETE_KEY_VALUE,
1449 REQ_LOAD_REGISTRY,
1450 REQ_SAVE_REGISTRY,
1451 REQ_SAVE_REGISTRY_ATEXIT,
1452 REQ_SET_REGISTRY_LEVELS,
1453 REQ_CREATE_TIMER,
1454 REQ_OPEN_TIMER,
1455 REQ_SET_TIMER,
1456 REQ_CANCEL_TIMER,
1457 REQ_GET_THREAD_CONTEXT,
1458 REQ_SET_THREAD_CONTEXT,
1459 REQ_GET_SELECTOR_ENTRY,
1460 REQ_ADD_ATOM,
1461 REQ_DELETE_ATOM,
1462 REQ_FIND_ATOM,
1463 REQ_GET_ATOM_NAME,
1464 REQ_INIT_ATOM_TABLE,
1465 REQ_GET_MSG_QUEUE,
1466 REQ_WAKE_QUEUE,
1467 REQ_WAIT_INPUT_IDLE,
1468 REQ_CREATE_SERIAL,
1469 REQ_GET_SERIAL_INFO,
1470 REQ_SET_SERIAL_INFO,
1471 REQ_NB_REQUESTS
1474 union generic_request
1476 struct request_max_size max_size;
1477 struct request_header header;
1478 struct new_process_request new_process;
1479 struct wait_process_request wait_process;
1480 struct new_thread_request new_thread;
1481 struct boot_done_request boot_done;
1482 struct init_process_request init_process;
1483 struct init_process_done_request init_process_done;
1484 struct init_thread_request init_thread;
1485 struct get_thread_buffer_request get_thread_buffer;
1486 struct terminate_process_request terminate_process;
1487 struct terminate_thread_request terminate_thread;
1488 struct get_process_info_request get_process_info;
1489 struct set_process_info_request set_process_info;
1490 struct get_thread_info_request get_thread_info;
1491 struct set_thread_info_request set_thread_info;
1492 struct suspend_thread_request suspend_thread;
1493 struct resume_thread_request resume_thread;
1494 struct load_dll_request load_dll;
1495 struct unload_dll_request unload_dll;
1496 struct queue_apc_request queue_apc;
1497 struct get_apc_request get_apc;
1498 struct close_handle_request close_handle;
1499 struct get_handle_info_request get_handle_info;
1500 struct set_handle_info_request set_handle_info;
1501 struct dup_handle_request dup_handle;
1502 struct open_process_request open_process;
1503 struct select_request select;
1504 struct create_event_request create_event;
1505 struct event_op_request event_op;
1506 struct open_event_request open_event;
1507 struct create_mutex_request create_mutex;
1508 struct release_mutex_request release_mutex;
1509 struct open_mutex_request open_mutex;
1510 struct create_semaphore_request create_semaphore;
1511 struct release_semaphore_request release_semaphore;
1512 struct open_semaphore_request open_semaphore;
1513 struct create_file_request create_file;
1514 struct alloc_file_handle_request alloc_file_handle;
1515 struct get_read_fd_request get_read_fd;
1516 struct get_write_fd_request get_write_fd;
1517 struct set_file_pointer_request set_file_pointer;
1518 struct truncate_file_request truncate_file;
1519 struct set_file_time_request set_file_time;
1520 struct flush_file_request flush_file;
1521 struct get_file_info_request get_file_info;
1522 struct lock_file_request lock_file;
1523 struct unlock_file_request unlock_file;
1524 struct create_pipe_request create_pipe;
1525 struct create_socket_request create_socket;
1526 struct accept_socket_request accept_socket;
1527 struct set_socket_event_request set_socket_event;
1528 struct get_socket_event_request get_socket_event;
1529 struct enable_socket_event_request enable_socket_event;
1530 struct alloc_console_request alloc_console;
1531 struct free_console_request free_console;
1532 struct open_console_request open_console;
1533 struct set_console_fd_request set_console_fd;
1534 struct get_console_mode_request get_console_mode;
1535 struct set_console_mode_request set_console_mode;
1536 struct set_console_info_request set_console_info;
1537 struct get_console_info_request get_console_info;
1538 struct write_console_input_request write_console_input;
1539 struct read_console_input_request read_console_input;
1540 struct create_change_notification_request create_change_notification;
1541 struct create_mapping_request create_mapping;
1542 struct open_mapping_request open_mapping;
1543 struct get_mapping_info_request get_mapping_info;
1544 struct create_device_request create_device;
1545 struct create_snapshot_request create_snapshot;
1546 struct next_process_request next_process;
1547 struct next_thread_request next_thread;
1548 struct next_module_request next_module;
1549 struct wait_debug_event_request wait_debug_event;
1550 struct exception_event_request exception_event;
1551 struct output_debug_string_request output_debug_string;
1552 struct continue_debug_event_request continue_debug_event;
1553 struct debug_process_request debug_process;
1554 struct read_process_memory_request read_process_memory;
1555 struct write_process_memory_request write_process_memory;
1556 struct create_key_request create_key;
1557 struct open_key_request open_key;
1558 struct delete_key_request delete_key;
1559 struct close_key_request close_key;
1560 struct enum_key_request enum_key;
1561 struct query_key_info_request query_key_info;
1562 struct set_key_value_request set_key_value;
1563 struct get_key_value_request get_key_value;
1564 struct enum_key_value_request enum_key_value;
1565 struct delete_key_value_request delete_key_value;
1566 struct load_registry_request load_registry;
1567 struct save_registry_request save_registry;
1568 struct save_registry_atexit_request save_registry_atexit;
1569 struct set_registry_levels_request set_registry_levels;
1570 struct create_timer_request create_timer;
1571 struct open_timer_request open_timer;
1572 struct set_timer_request set_timer;
1573 struct cancel_timer_request cancel_timer;
1574 struct get_thread_context_request get_thread_context;
1575 struct set_thread_context_request set_thread_context;
1576 struct get_selector_entry_request get_selector_entry;
1577 struct add_atom_request add_atom;
1578 struct delete_atom_request delete_atom;
1579 struct find_atom_request find_atom;
1580 struct get_atom_name_request get_atom_name;
1581 struct init_atom_table_request init_atom_table;
1582 struct get_msg_queue_request get_msg_queue;
1583 struct wake_queue_request wake_queue;
1584 struct wait_input_idle_request wait_input_idle;
1585 struct create_serial_request create_serial;
1586 struct get_serial_info_request get_serial_info;
1587 struct set_serial_info_request set_serial_info;
1590 #define SERVER_PROTOCOL_VERSION 23
1592 /* ### make_requests end ### */
1593 /* Everything above this line is generated automatically by tools/make_requests */
1595 #undef REQUEST_HEADER
1596 #undef VARARG
1598 /* format of the server buffer */
1599 struct server_buffer_info
1601 volatile unsigned int cur_req; /* offset of the current request */
1602 volatile unsigned int cur_pos; /* first available position in buffer */
1605 /* client-side functions */
1607 #ifndef __WINE_SERVER__
1609 #include "thread.h"
1610 #include "ntddk.h"
1611 #include "wine/exception.h"
1613 /* client communication functions */
1615 extern unsigned int server_call_noerr( enum request req );
1616 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1617 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1618 extern void *server_alloc_req( size_t fixed_size, size_t var_size );
1619 extern const char *get_config_dir(void);
1621 /* get a pointer to the request buffer */
1622 static inline void WINE_UNUSED *get_req_buffer(void)
1624 return NtCurrentTeb()->buffer;
1627 /* maximum remaining size in the server buffer */
1628 static inline int WINE_UNUSED server_remaining( const void *ptr )
1630 return (char *)NtCurrentTeb()->buffer_info - (char *)ptr;
1633 /* do a server call and set the last error code */
1634 static inline int server_call( enum request req )
1636 unsigned int res = server_call_noerr( req );
1637 if (res) SetLastError( RtlNtStatusToDosError(res) );
1638 return res;
1641 /* copy a Unicode string to the server buffer */
1642 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1644 if (src)
1646 WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1647 while ((dst < end) && *src) *dst++ = *src++;
1649 *dst = 0;
1652 /* copy and convert an ASCII string to the server buffer */
1653 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1655 if (src)
1657 WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1658 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1660 *dst = 0;
1663 /* get a pointer to the variable part of the request */
1664 inline static void *server_data_ptr( void *req )
1666 return (union generic_request *)req + 1;
1669 /* get the size of the variable part of the request */
1670 inline static size_t server_data_size( void *req )
1672 return ((struct request_header *)req)->var_size;
1676 /* exception support for server calls */
1678 extern DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1679 CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1681 struct __server_exception_frame
1683 EXCEPTION_FRAME frame;
1684 struct server_buffer_info info; /* saved buffer information */
1687 #define SERVER_START_REQ \
1688 do { \
1689 struct __server_exception_frame __f; \
1690 __f.frame.Handler = server_exception_handler; \
1691 __f.info = *NtCurrentTeb()->buffer_info; \
1692 __wine_push_frame( &__f.frame ); \
1693 do {
1695 #define SERVER_END_REQ \
1696 } while(0); \
1697 *NtCurrentTeb()->buffer_info = __f.info; \
1698 __wine_pop_frame( &__f.frame ); \
1699 } while(0);
1701 extern int CLIENT_InitServer(void);
1702 extern int CLIENT_BootDone( int debug_level );
1703 extern int CLIENT_IsBootThread(void);
1704 extern int CLIENT_InitThread(void);
1705 #endif /* __WINE_SERVER__ */
1707 #endif /* __WINE_SERVER_H */