Added some STN_xxx macros.
[wine/wine-kai.git] / include / server.h
blobc6c7d5778bf3a5dcb181a7aeb91cd51c54db9b7c
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 VARARG(data,bytes); /* 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 VARARG(data,bytes); /* result data */
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 VARARG(name,unicode_len_str); /* key name */
1022 IN VARARG(class,unicode_str); /* class name */
1025 /* Open a registry key */
1026 struct open_key_request
1028 REQUEST_HEADER; /* request header */
1029 IN int parent; /* handle to the parent key */
1030 IN unsigned int access; /* desired access rights */
1031 OUT int hkey; /* handle to the open key */
1032 IN VARARG(name,unicode_str); /* key name */
1036 /* Delete a registry key */
1037 struct delete_key_request
1039 REQUEST_HEADER; /* request header */
1040 IN int hkey; /* handle to the key */
1044 /* Enumerate registry subkeys */
1045 struct enum_key_request
1047 REQUEST_HEADER; /* request header */
1048 IN int hkey; /* handle to registry key */
1049 IN int index; /* index of subkey (or -1 for current key) */
1050 IN int full; /* return the full info? */
1051 OUT int subkeys; /* number of subkeys */
1052 OUT int max_subkey; /* longest subkey name */
1053 OUT int max_class; /* longest class name */
1054 OUT int values; /* number of values */
1055 OUT int max_value; /* longest value name */
1056 OUT int max_data; /* longest value data */
1057 OUT time_t modif; /* last modification time */
1058 OUT VARARG(name,unicode_len_str); /* key name */
1059 OUT VARARG(class,unicode_str); /* class name */
1063 /* Set a value of a registry key */
1064 struct set_key_value_request
1066 REQUEST_HEADER; /* request header */
1067 IN int hkey; /* handle to registry key */
1068 IN int type; /* value type */
1069 IN unsigned int total; /* total value len */
1070 IN unsigned int offset; /* offset for setting data */
1071 IN VARARG(name,unicode_len_str); /* value name */
1072 IN VARARG(data,bytes); /* value data */
1076 /* Retrieve the value of a registry key */
1077 struct get_key_value_request
1079 REQUEST_HEADER; /* request header */
1080 IN int hkey; /* handle to registry key */
1081 IN unsigned int offset; /* offset for getting data */
1082 OUT int type; /* value type */
1083 OUT int len; /* value data len */
1084 IN VARARG(name,unicode_len_str); /* value name */
1085 OUT VARARG(data,bytes); /* value data */
1089 /* Enumerate a value of a registry key */
1090 struct enum_key_value_request
1092 REQUEST_HEADER; /* request header */
1093 IN int hkey; /* handle to registry key */
1094 IN int index; /* value index */
1095 IN unsigned int offset; /* offset for getting data */
1096 OUT int type; /* value type */
1097 OUT int len; /* value data len */
1098 OUT path_t name; /* value name */
1099 OUT unsigned char data[1]; /* value data */
1103 /* Delete a value of a registry key */
1104 struct delete_key_value_request
1106 REQUEST_HEADER; /* request header */
1107 IN int hkey; /* handle to registry key */
1108 IN VARARG(name,unicode_str); /* value name */
1112 /* Load a registry branch from a file */
1113 struct load_registry_request
1115 REQUEST_HEADER; /* request header */
1116 IN int hkey; /* root key to load to */
1117 IN int file; /* file to load from */
1118 IN VARARG(name,unicode_str); /* subkey name */
1122 /* Save a registry branch to a file */
1123 struct save_registry_request
1125 REQUEST_HEADER; /* request header */
1126 IN int hkey; /* key to save */
1127 IN int file; /* file to save to */
1131 /* Save a registry branch at server exit */
1132 struct save_registry_atexit_request
1134 REQUEST_HEADER; /* request header */
1135 IN int hkey; /* key to save */
1136 IN VARARG(file,string); /* file to save to */
1140 /* Set the current and saving level for the registry */
1141 struct set_registry_levels_request
1143 REQUEST_HEADER; /* request header */
1144 IN int current; /* new current level */
1145 IN int saving; /* new saving level */
1146 IN int period; /* duration between periodic saves (milliseconds) */
1150 /* Create a waitable timer */
1151 struct create_timer_request
1153 REQUEST_HEADER; /* request header */
1154 IN int inherit; /* inherit flag */
1155 IN int manual; /* manual reset */
1156 OUT int handle; /* handle to the timer */
1157 IN VARARG(name,unicode_str); /* object name */
1161 /* Open a waitable timer */
1162 struct open_timer_request
1164 REQUEST_HEADER; /* request header */
1165 IN unsigned int access; /* wanted access rights */
1166 IN int inherit; /* inherit flag */
1167 OUT int handle; /* handle to the timer */
1168 IN VARARG(name,unicode_str); /* object name */
1171 /* Set a waitable timer */
1172 struct set_timer_request
1174 REQUEST_HEADER; /* request header */
1175 IN int handle; /* handle to the timer */
1176 IN int sec; /* next expiration absolute time */
1177 IN int usec; /* next expiration absolute time */
1178 IN int period; /* timer period in ms */
1179 IN void* callback; /* callback function */
1180 IN void* arg; /* callback argument */
1183 /* Cancel a waitable timer */
1184 struct cancel_timer_request
1186 REQUEST_HEADER; /* request header */
1187 IN int handle; /* handle to the timer */
1191 /* Retrieve the current context of a thread */
1192 struct get_thread_context_request
1194 REQUEST_HEADER; /* request header */
1195 IN int handle; /* thread handle */
1196 IN unsigned int flags; /* context flags */
1197 OUT VARARG(context,context); /* thread context */
1201 /* Set the current context of a thread */
1202 struct set_thread_context_request
1204 REQUEST_HEADER; /* request header */
1205 IN int handle; /* thread handle */
1206 IN unsigned int flags; /* context flags */
1207 IN VARARG(context,context); /* thread context */
1211 /* Fetch a selector entry for a thread */
1212 struct get_selector_entry_request
1214 REQUEST_HEADER; /* request header */
1215 IN int handle; /* thread handle */
1216 IN int entry; /* LDT entry */
1217 OUT unsigned int base; /* selector base */
1218 OUT unsigned int limit; /* selector limit */
1219 OUT unsigned char flags; /* selector flags */
1223 /* Add an atom */
1224 struct add_atom_request
1226 REQUEST_HEADER; /* request header */
1227 IN int local; /* is atom in local process table? */
1228 OUT int atom; /* resulting atom */
1229 IN VARARG(name,unicode_str); /* atom name */
1233 /* Delete an atom */
1234 struct delete_atom_request
1236 REQUEST_HEADER; /* request header */
1237 IN int atom; /* atom handle */
1238 IN int local; /* is atom in local process table? */
1242 /* Find an atom */
1243 struct find_atom_request
1245 REQUEST_HEADER; /* request header */
1246 IN int local; /* is atom in local process table? */
1247 OUT int atom; /* atom handle */
1248 IN VARARG(name,unicode_str); /* atom name */
1252 /* Get an atom name */
1253 struct get_atom_name_request
1255 REQUEST_HEADER; /* request header */
1256 IN int atom; /* atom handle */
1257 IN int local; /* is atom in local process table? */
1258 OUT int count; /* atom lock count */
1259 OUT VARARG(name,unicode_str); /* atom name */
1263 /* Init the process atom table */
1264 struct init_atom_table_request
1266 REQUEST_HEADER; /* request header */
1267 IN int entries; /* number of entries */
1271 /* Get the message queue of the current thread */
1272 struct get_msg_queue_request
1274 REQUEST_HEADER; /* request header */
1275 OUT int handle; /* handle to the queue */
1278 /* Wake up a message queue */
1279 struct wake_queue_request
1281 REQUEST_HEADER; /* request header */
1282 IN int handle; /* handle to the queue */
1283 IN unsigned int bits; /* wake bits */
1286 /* Wait for a process to start waiting on input */
1287 struct wait_input_idle_request
1289 REQUEST_HEADER; /* request header */
1290 IN int handle; /* process handle */
1291 IN int timeout; /* timeout */
1292 OUT int event; /* handle to idle event */
1295 struct create_serial_request
1297 REQUEST_HEADER; /* request header */
1298 IN unsigned int access; /* wanted access rights */
1299 IN int inherit; /* inherit flag */
1300 IN unsigned int sharing; /* sharing flags */
1301 OUT int handle; /* handle to the port */
1302 IN VARARG(name,string); /* file name */
1305 struct get_serial_info_request
1307 REQUEST_HEADER; /* request header */
1308 IN int handle; /* handle to comm port */
1309 OUT unsigned int readinterval;
1310 OUT unsigned int readconst;
1311 OUT unsigned int readmult;
1312 OUT unsigned int writeconst;
1313 OUT unsigned int writemult;
1314 OUT unsigned int eventmask;
1315 OUT unsigned int commerror;
1318 struct set_serial_info_request
1320 REQUEST_HEADER; /* request header */
1321 IN int handle; /* handle to comm port */
1322 IN int flags; /* bitmask to set values (see below) */
1323 IN unsigned int readinterval;
1324 IN unsigned int readconst;
1325 IN unsigned int readmult;
1326 IN unsigned int writeconst;
1327 IN unsigned int writemult;
1328 IN unsigned int eventmask;
1329 IN unsigned int commerror;
1331 #define SERIALINFO_SET_TIMEOUTS 0x01
1332 #define SERIALINFO_SET_MASK 0x02
1333 #define SERIALINFO_SET_ERROR 0x04
1335 /* Everything below this line is generated automatically by tools/make_requests */
1336 /* ### make_requests begin ### */
1338 enum request
1340 REQ_NEW_PROCESS,
1341 REQ_WAIT_PROCESS,
1342 REQ_NEW_THREAD,
1343 REQ_BOOT_DONE,
1344 REQ_INIT_PROCESS,
1345 REQ_INIT_PROCESS_DONE,
1346 REQ_INIT_THREAD,
1347 REQ_GET_THREAD_BUFFER,
1348 REQ_TERMINATE_PROCESS,
1349 REQ_TERMINATE_THREAD,
1350 REQ_GET_PROCESS_INFO,
1351 REQ_SET_PROCESS_INFO,
1352 REQ_GET_THREAD_INFO,
1353 REQ_SET_THREAD_INFO,
1354 REQ_SUSPEND_THREAD,
1355 REQ_RESUME_THREAD,
1356 REQ_LOAD_DLL,
1357 REQ_UNLOAD_DLL,
1358 REQ_QUEUE_APC,
1359 REQ_GET_APC,
1360 REQ_CLOSE_HANDLE,
1361 REQ_GET_HANDLE_INFO,
1362 REQ_SET_HANDLE_INFO,
1363 REQ_DUP_HANDLE,
1364 REQ_OPEN_PROCESS,
1365 REQ_SELECT,
1366 REQ_CREATE_EVENT,
1367 REQ_EVENT_OP,
1368 REQ_OPEN_EVENT,
1369 REQ_CREATE_MUTEX,
1370 REQ_RELEASE_MUTEX,
1371 REQ_OPEN_MUTEX,
1372 REQ_CREATE_SEMAPHORE,
1373 REQ_RELEASE_SEMAPHORE,
1374 REQ_OPEN_SEMAPHORE,
1375 REQ_CREATE_FILE,
1376 REQ_ALLOC_FILE_HANDLE,
1377 REQ_GET_READ_FD,
1378 REQ_GET_WRITE_FD,
1379 REQ_SET_FILE_POINTER,
1380 REQ_TRUNCATE_FILE,
1381 REQ_SET_FILE_TIME,
1382 REQ_FLUSH_FILE,
1383 REQ_GET_FILE_INFO,
1384 REQ_LOCK_FILE,
1385 REQ_UNLOCK_FILE,
1386 REQ_CREATE_PIPE,
1387 REQ_CREATE_SOCKET,
1388 REQ_ACCEPT_SOCKET,
1389 REQ_SET_SOCKET_EVENT,
1390 REQ_GET_SOCKET_EVENT,
1391 REQ_ENABLE_SOCKET_EVENT,
1392 REQ_ALLOC_CONSOLE,
1393 REQ_FREE_CONSOLE,
1394 REQ_OPEN_CONSOLE,
1395 REQ_SET_CONSOLE_FD,
1396 REQ_GET_CONSOLE_MODE,
1397 REQ_SET_CONSOLE_MODE,
1398 REQ_SET_CONSOLE_INFO,
1399 REQ_GET_CONSOLE_INFO,
1400 REQ_WRITE_CONSOLE_INPUT,
1401 REQ_READ_CONSOLE_INPUT,
1402 REQ_CREATE_CHANGE_NOTIFICATION,
1403 REQ_CREATE_MAPPING,
1404 REQ_OPEN_MAPPING,
1405 REQ_GET_MAPPING_INFO,
1406 REQ_CREATE_DEVICE,
1407 REQ_CREATE_SNAPSHOT,
1408 REQ_NEXT_PROCESS,
1409 REQ_NEXT_THREAD,
1410 REQ_NEXT_MODULE,
1411 REQ_WAIT_DEBUG_EVENT,
1412 REQ_EXCEPTION_EVENT,
1413 REQ_OUTPUT_DEBUG_STRING,
1414 REQ_CONTINUE_DEBUG_EVENT,
1415 REQ_DEBUG_PROCESS,
1416 REQ_READ_PROCESS_MEMORY,
1417 REQ_WRITE_PROCESS_MEMORY,
1418 REQ_CREATE_KEY,
1419 REQ_OPEN_KEY,
1420 REQ_DELETE_KEY,
1421 REQ_ENUM_KEY,
1422 REQ_SET_KEY_VALUE,
1423 REQ_GET_KEY_VALUE,
1424 REQ_ENUM_KEY_VALUE,
1425 REQ_DELETE_KEY_VALUE,
1426 REQ_LOAD_REGISTRY,
1427 REQ_SAVE_REGISTRY,
1428 REQ_SAVE_REGISTRY_ATEXIT,
1429 REQ_SET_REGISTRY_LEVELS,
1430 REQ_CREATE_TIMER,
1431 REQ_OPEN_TIMER,
1432 REQ_SET_TIMER,
1433 REQ_CANCEL_TIMER,
1434 REQ_GET_THREAD_CONTEXT,
1435 REQ_SET_THREAD_CONTEXT,
1436 REQ_GET_SELECTOR_ENTRY,
1437 REQ_ADD_ATOM,
1438 REQ_DELETE_ATOM,
1439 REQ_FIND_ATOM,
1440 REQ_GET_ATOM_NAME,
1441 REQ_INIT_ATOM_TABLE,
1442 REQ_GET_MSG_QUEUE,
1443 REQ_WAKE_QUEUE,
1444 REQ_WAIT_INPUT_IDLE,
1445 REQ_CREATE_SERIAL,
1446 REQ_GET_SERIAL_INFO,
1447 REQ_SET_SERIAL_INFO,
1448 REQ_NB_REQUESTS
1451 union generic_request
1453 struct request_max_size max_size;
1454 struct request_header header;
1455 struct new_process_request new_process;
1456 struct wait_process_request wait_process;
1457 struct new_thread_request new_thread;
1458 struct boot_done_request boot_done;
1459 struct init_process_request init_process;
1460 struct init_process_done_request init_process_done;
1461 struct init_thread_request init_thread;
1462 struct get_thread_buffer_request get_thread_buffer;
1463 struct terminate_process_request terminate_process;
1464 struct terminate_thread_request terminate_thread;
1465 struct get_process_info_request get_process_info;
1466 struct set_process_info_request set_process_info;
1467 struct get_thread_info_request get_thread_info;
1468 struct set_thread_info_request set_thread_info;
1469 struct suspend_thread_request suspend_thread;
1470 struct resume_thread_request resume_thread;
1471 struct load_dll_request load_dll;
1472 struct unload_dll_request unload_dll;
1473 struct queue_apc_request queue_apc;
1474 struct get_apc_request get_apc;
1475 struct close_handle_request close_handle;
1476 struct get_handle_info_request get_handle_info;
1477 struct set_handle_info_request set_handle_info;
1478 struct dup_handle_request dup_handle;
1479 struct open_process_request open_process;
1480 struct select_request select;
1481 struct create_event_request create_event;
1482 struct event_op_request event_op;
1483 struct open_event_request open_event;
1484 struct create_mutex_request create_mutex;
1485 struct release_mutex_request release_mutex;
1486 struct open_mutex_request open_mutex;
1487 struct create_semaphore_request create_semaphore;
1488 struct release_semaphore_request release_semaphore;
1489 struct open_semaphore_request open_semaphore;
1490 struct create_file_request create_file;
1491 struct alloc_file_handle_request alloc_file_handle;
1492 struct get_read_fd_request get_read_fd;
1493 struct get_write_fd_request get_write_fd;
1494 struct set_file_pointer_request set_file_pointer;
1495 struct truncate_file_request truncate_file;
1496 struct set_file_time_request set_file_time;
1497 struct flush_file_request flush_file;
1498 struct get_file_info_request get_file_info;
1499 struct lock_file_request lock_file;
1500 struct unlock_file_request unlock_file;
1501 struct create_pipe_request create_pipe;
1502 struct create_socket_request create_socket;
1503 struct accept_socket_request accept_socket;
1504 struct set_socket_event_request set_socket_event;
1505 struct get_socket_event_request get_socket_event;
1506 struct enable_socket_event_request enable_socket_event;
1507 struct alloc_console_request alloc_console;
1508 struct free_console_request free_console;
1509 struct open_console_request open_console;
1510 struct set_console_fd_request set_console_fd;
1511 struct get_console_mode_request get_console_mode;
1512 struct set_console_mode_request set_console_mode;
1513 struct set_console_info_request set_console_info;
1514 struct get_console_info_request get_console_info;
1515 struct write_console_input_request write_console_input;
1516 struct read_console_input_request read_console_input;
1517 struct create_change_notification_request create_change_notification;
1518 struct create_mapping_request create_mapping;
1519 struct open_mapping_request open_mapping;
1520 struct get_mapping_info_request get_mapping_info;
1521 struct create_device_request create_device;
1522 struct create_snapshot_request create_snapshot;
1523 struct next_process_request next_process;
1524 struct next_thread_request next_thread;
1525 struct next_module_request next_module;
1526 struct wait_debug_event_request wait_debug_event;
1527 struct exception_event_request exception_event;
1528 struct output_debug_string_request output_debug_string;
1529 struct continue_debug_event_request continue_debug_event;
1530 struct debug_process_request debug_process;
1531 struct read_process_memory_request read_process_memory;
1532 struct write_process_memory_request write_process_memory;
1533 struct create_key_request create_key;
1534 struct open_key_request open_key;
1535 struct delete_key_request delete_key;
1536 struct enum_key_request enum_key;
1537 struct set_key_value_request set_key_value;
1538 struct get_key_value_request get_key_value;
1539 struct enum_key_value_request enum_key_value;
1540 struct delete_key_value_request delete_key_value;
1541 struct load_registry_request load_registry;
1542 struct save_registry_request save_registry;
1543 struct save_registry_atexit_request save_registry_atexit;
1544 struct set_registry_levels_request set_registry_levels;
1545 struct create_timer_request create_timer;
1546 struct open_timer_request open_timer;
1547 struct set_timer_request set_timer;
1548 struct cancel_timer_request cancel_timer;
1549 struct get_thread_context_request get_thread_context;
1550 struct set_thread_context_request set_thread_context;
1551 struct get_selector_entry_request get_selector_entry;
1552 struct add_atom_request add_atom;
1553 struct delete_atom_request delete_atom;
1554 struct find_atom_request find_atom;
1555 struct get_atom_name_request get_atom_name;
1556 struct init_atom_table_request init_atom_table;
1557 struct get_msg_queue_request get_msg_queue;
1558 struct wake_queue_request wake_queue;
1559 struct wait_input_idle_request wait_input_idle;
1560 struct create_serial_request create_serial;
1561 struct get_serial_info_request get_serial_info;
1562 struct set_serial_info_request set_serial_info;
1565 #define SERVER_PROTOCOL_VERSION 26
1567 /* ### make_requests end ### */
1568 /* Everything above this line is generated automatically by tools/make_requests */
1570 #undef REQUEST_HEADER
1571 #undef VARARG
1573 /* format of the server buffer */
1574 struct server_buffer_info
1576 volatile unsigned int cur_req; /* offset of the current request */
1577 volatile unsigned int cur_pos; /* first available position in buffer */
1580 /* client-side functions */
1582 #ifndef __WINE_SERVER__
1584 #include "thread.h"
1585 #include "ntddk.h"
1586 #include "wine/exception.h"
1588 /* client communication functions */
1590 extern unsigned int server_call_noerr( enum request req );
1591 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1592 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1593 extern void *server_alloc_req( size_t fixed_size, size_t var_size );
1594 extern const char *get_config_dir(void);
1596 /* get a pointer to the request buffer */
1597 static inline void WINE_UNUSED *get_req_buffer(void)
1599 return NtCurrentTeb()->buffer;
1602 /* maximum remaining size in the server buffer */
1603 static inline int WINE_UNUSED server_remaining( const void *ptr )
1605 return (char *)NtCurrentTeb()->buffer_info - (char *)ptr;
1608 /* do a server call and set the last error code */
1609 static inline int server_call( enum request req )
1611 unsigned int res = server_call_noerr( req );
1612 if (res) SetLastError( RtlNtStatusToDosError(res) );
1613 return res;
1616 /* copy a Unicode string to the server buffer */
1617 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1619 if (src)
1621 WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1622 while ((dst < end) && *src) *dst++ = *src++;
1624 *dst = 0;
1627 /* copy and convert an ASCII string to the server buffer */
1628 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1630 if (src)
1632 WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
1633 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1635 *dst = 0;
1638 /* get a pointer to the variable part of the request */
1639 inline static void *server_data_ptr( const void *req )
1641 return (union generic_request *)req + 1;
1644 /* get the size of the variable part of the request */
1645 inline static size_t server_data_size( const void *req )
1647 return ((struct request_header *)req)->var_size;
1651 /* exception support for server calls */
1653 extern DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
1654 CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
1656 struct __server_exception_frame
1658 EXCEPTION_FRAME frame;
1659 struct server_buffer_info info; /* saved buffer information */
1662 #define SERVER_START_REQ \
1663 do { \
1664 struct __server_exception_frame __f; \
1665 __f.frame.Handler = server_exception_handler; \
1666 __f.info = *NtCurrentTeb()->buffer_info; \
1667 __wine_push_frame( &__f.frame ); \
1668 do {
1670 #define SERVER_END_REQ \
1671 } while(0); \
1672 *NtCurrentTeb()->buffer_info = __f.info; \
1673 __wine_pop_frame( &__f.frame ); \
1674 } while(0);
1676 extern int CLIENT_InitServer(void);
1677 extern int CLIENT_BootDone( int debug_level );
1678 extern int CLIENT_IsBootThread(void);
1679 extern int CLIENT_InitThread(void);
1680 #endif /* __WINE_SERVER__ */
1682 #endif /* __WINE_SERVER_H */