Separate GetTextMetrics and implement it for SBCS/Unicode/cp932.
[wine/testsucceed.git] / include / server.h
blob4ce1a19f146fe7d527fbe4c977dc3df5b393714d
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*/
27 /* a path name for server requests (Unicode) */
28 typedef WCHAR path_t[MAX_PATH+1];
31 /* definitions of the event data depending on the event code */
32 struct debug_event_exception
34 EXCEPTION_RECORD record; /* exception record */
35 int first; /* first chance exception? */
37 struct debug_event_create_thread
39 int handle; /* handle to the new thread */
40 void *teb; /* thread teb (in debugged process address space) */
41 void *start; /* thread startup routine */
43 struct debug_event_create_process
45 int file; /* handle to the process exe file */
46 int process; /* handle to the new process */
47 int thread; /* handle to the new thread */
48 void *base; /* base of executable image */
49 int dbg_offset; /* offset of debug info in file */
50 int dbg_size; /* size of debug info */
51 void *teb; /* thread teb (in debugged process address space) */
52 void *start; /* thread startup routine */
53 void *name; /* image name (optional) */
54 int unicode; /* is it Unicode? */
56 struct debug_event_exit
58 int exit_code; /* thread or process exit code */
60 struct debug_event_load_dll
62 int handle; /* file handle for the dll */
63 void *base; /* base address of the dll */
64 int dbg_offset; /* offset of debug info in file */
65 int dbg_size; /* size of debug info */
66 void *name; /* image name (optional) */
67 int unicode; /* is it Unicode? */
69 struct debug_event_unload_dll
71 void *base; /* base address of the dll */
73 struct debug_event_output_string
75 void *string; /* string to display (in debugged process address space) */
76 int unicode; /* is it Unicode? */
77 int length; /* string length */
79 struct debug_event_rip_info
81 int error; /* ??? */
82 int type; /* ??? */
84 union debug_event_data
86 struct debug_event_exception exception;
87 struct debug_event_create_thread create_thread;
88 struct debug_event_create_process create_process;
89 struct debug_event_exit exit;
90 struct debug_event_load_dll load_dll;
91 struct debug_event_unload_dll unload_dll;
92 struct debug_event_output_string output_string;
93 struct debug_event_rip_info rip_info;
96 /* debug event data */
97 typedef struct
99 int code; /* event code */
100 union debug_event_data info; /* event information */
101 } debug_event_t;
104 /* Create a new process from the context of the parent */
105 struct new_process_request
107 IN int inherit_all; /* inherit all handles from parent */
108 IN int create_flags; /* creation flags */
109 IN int start_flags; /* flags from startup info */
110 IN int exe_file; /* file handle for main exe */
111 IN int hstdin; /* handle for stdin */
112 IN int hstdout; /* handle for stdout */
113 IN int hstderr; /* handle for stderr */
114 IN int cmd_show; /* main window show mode */
115 IN int alloc_fd; /* create the fd pair right now? */
116 IN char filename[1]; /* file name of main exe */
120 /* Wait for the new process to start */
121 struct wait_process_request
123 IN int pinherit; /* process handle inherit flag */
124 IN int tinherit; /* thread handle inherit flag */
125 IN int timeout; /* wait timeout */
126 IN int cancel; /* cancel the process creation? */
127 OUT void* pid; /* process id */
128 OUT int phandle; /* process handle (in the current process) */
129 OUT void* tid; /* thread id */
130 OUT int thandle; /* thread handle (in the current process) */
131 OUT int event; /* event handle to signal startup */
135 /* Create a new thread from the context of the parent */
136 struct new_thread_request
138 IN int suspend; /* new thread should be suspended on creation */
139 IN int inherit; /* inherit flag */
140 OUT void* tid; /* thread id */
141 OUT int handle; /* thread handle (in the current process) */
145 /* Signal that we are finished booting on the client side */
146 struct boot_done_request
148 IN int debug_level; /* new debug level */
152 /* Initialize a process; called from the new process context */
153 struct init_process_request
155 IN void* ldt_copy; /* addr of LDT copy */
156 IN void* ldt_flags; /* addr of LDT flags */
157 IN int ppid; /* parent Unix pid */
158 OUT int start_flags; /* flags from startup info */
159 OUT int exe_file; /* file handle for main exe */
160 OUT int hstdin; /* handle for stdin */
161 OUT int hstdout; /* handle for stdout */
162 OUT int hstderr; /* handle for stderr */
163 OUT int cmd_show; /* main window show mode */
164 OUT char filename[1]; /* file name of main exe */
168 /* Signal the end of the process initialization */
169 struct init_process_done_request
171 IN void* module; /* main module base address */
172 IN void* entry; /* process entry point */
173 IN void* name; /* ptr to ptr to name (in process addr space) */
174 IN int gui; /* is it a GUI process? */
175 OUT int debugged; /* being debugged? */
179 /* Initialize a thread; called from the child after fork()/clone() */
180 struct init_thread_request
182 IN int unix_pid; /* Unix pid of new thread */
183 IN void* teb; /* TEB of new thread (in thread address space) */
184 IN void* entry; /* thread entry point (in thread address space) */
188 /* Retrieve the thread buffer file descriptor */
189 /* The reply to this request is the first thing a newly */
190 /* created thread gets (without having to request it) */
191 struct get_thread_buffer_request
193 OUT void* pid; /* process id of the new thread's process */
194 OUT void* tid; /* thread id of the new thread */
195 OUT int boot; /* is this the boot thread? */
196 OUT int version; /* protocol version */
200 /* Terminate a process */
201 struct terminate_process_request
203 IN int handle; /* process handle to terminate */
204 IN int exit_code; /* process exit code */
205 OUT int self; /* suicide? */
209 /* Terminate a thread */
210 struct terminate_thread_request
212 IN int handle; /* thread handle to terminate */
213 IN int exit_code; /* thread exit code */
214 OUT int self; /* suicide? */
215 OUT int last; /* last thread in this process? */
219 /* Retrieve information about a process */
220 struct get_process_info_request
222 IN int handle; /* process handle */
223 OUT void* pid; /* server process id */
224 OUT int debugged; /* debugged? */
225 OUT int exit_code; /* process exit code */
226 OUT int priority; /* priority class */
227 OUT int process_affinity; /* process affinity mask */
228 OUT int system_affinity; /* system affinity mask */
232 /* Set a process informations */
233 struct set_process_info_request
235 IN int handle; /* process handle */
236 IN int mask; /* setting mask (see below) */
237 IN int priority; /* priority class */
238 IN int affinity; /* affinity mask */
240 #define SET_PROCESS_INFO_PRIORITY 0x01
241 #define SET_PROCESS_INFO_AFFINITY 0x02
244 /* Retrieve information about a thread */
245 struct get_thread_info_request
247 IN int handle; /* thread handle */
248 IN void* tid_in; /* thread id (optional) */
249 OUT void* tid; /* server thread id */
250 OUT void* teb; /* thread teb pointer */
251 OUT int exit_code; /* thread exit code */
252 OUT int priority; /* thread priority level */
256 /* Set a thread informations */
257 struct set_thread_info_request
259 IN int handle; /* thread handle */
260 IN int mask; /* setting mask (see below) */
261 IN int priority; /* priority class */
262 IN int affinity; /* affinity mask */
264 #define SET_THREAD_INFO_PRIORITY 0x01
265 #define SET_THREAD_INFO_AFFINITY 0x02
268 /* Suspend a thread */
269 struct suspend_thread_request
271 IN int handle; /* thread handle */
272 OUT int count; /* new suspend count */
276 /* Resume a thread */
277 struct resume_thread_request
279 IN int handle; /* thread handle */
280 OUT int count; /* new suspend count */
284 /* Notify the server that a dll has been loaded */
285 struct load_dll_request
287 IN int handle; /* file handle */
288 IN void* base; /* base address */
289 IN int dbg_offset; /* debug info offset */
290 IN int dbg_size; /* debug info size */
291 IN void* name; /* ptr to ptr to name (in process addr space) */
295 /* Notify the server that a dll is being unloaded */
296 struct unload_dll_request
298 IN void* base; /* base address */
302 /* Queue an APC for a thread */
303 struct queue_apc_request
305 IN int handle; /* thread handle */
306 IN void* func; /* function to call */
307 IN void* param; /* param for function to call */
311 /* Get list of APC to call */
312 struct get_apcs_request
314 OUT int count; /* number of apcs */
315 OUT void* apcs[1]; /* async procedures to call */
319 /* Close a handle for the current process */
320 struct close_handle_request
322 IN int handle; /* handle to close */
326 /* Get information about a handle */
327 struct get_handle_info_request
329 IN int handle; /* handle we are interested in */
330 OUT int flags; /* handle flags */
334 /* Set a handle information */
335 struct set_handle_info_request
337 IN int handle; /* handle we are interested in */
338 IN int flags; /* new handle flags */
339 IN int mask; /* mask for flags to set */
343 /* Duplicate a handle */
344 struct dup_handle_request
346 IN int src_process; /* src process handle */
347 IN int src_handle; /* src handle to duplicate */
348 IN int dst_process; /* dst process handle */
349 IN unsigned int access; /* wanted access rights */
350 IN int inherit; /* inherit flag */
351 IN int options; /* duplicate options (see below) */
352 OUT int handle; /* duplicated handle in dst process */
354 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
355 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
356 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
359 /* Open a handle to a process */
360 struct open_process_request
362 IN void* pid; /* process id to open */
363 IN unsigned int access; /* wanted access rights */
364 IN int inherit; /* inherit flag */
365 OUT int handle; /* handle to the process */
369 /* Wait for handles */
370 struct select_request
372 IN int count; /* handles count */
373 IN int flags; /* wait flags (see below) */
374 IN int timeout; /* timeout in ms */
375 OUT int signaled; /* signaled handle */
376 IN int handles[1]; /* handles to select on */
378 #define SELECT_ALL 1
379 #define SELECT_ALERTABLE 2
380 #define SELECT_TIMEOUT 4
383 /* Create an event */
384 struct create_event_request
386 IN int manual_reset; /* manual reset event */
387 IN int initial_state; /* initial state of the event */
388 IN int inherit; /* inherit flag */
389 OUT int handle; /* handle to the event */
390 IN WCHAR name[1]; /* event name */
393 /* Event operation */
394 struct event_op_request
396 IN int handle; /* handle to event */
397 IN int op; /* event operation (see below) */
399 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
402 /* Open an event */
403 struct open_event_request
405 IN unsigned int access; /* wanted access rights */
406 IN int inherit; /* inherit flag */
407 OUT int handle; /* handle to the event */
408 IN WCHAR name[1]; /* object name */
412 /* Create a mutex */
413 struct create_mutex_request
415 IN int owned; /* initially owned? */
416 IN int inherit; /* inherit flag */
417 OUT int handle; /* handle to the mutex */
418 IN WCHAR name[1]; /* mutex name */
422 /* Release a mutex */
423 struct release_mutex_request
425 IN int handle; /* handle to the mutex */
429 /* Open a mutex */
430 struct open_mutex_request
432 IN unsigned int access; /* wanted access rights */
433 IN int inherit; /* inherit flag */
434 OUT int handle; /* handle to the mutex */
435 IN WCHAR name[1]; /* object name */
439 /* Create a semaphore */
440 struct create_semaphore_request
442 IN unsigned int initial; /* initial count */
443 IN unsigned int max; /* maximum count */
444 IN int inherit; /* inherit flag */
445 OUT int handle; /* handle to the semaphore */
446 IN WCHAR name[1]; /* semaphore name */
450 /* Release a semaphore */
451 struct release_semaphore_request
453 IN int handle; /* handle to the semaphore */
454 IN unsigned int count; /* count to add to semaphore */
455 OUT unsigned int prev_count; /* previous semaphore count */
459 /* Open a semaphore */
460 struct open_semaphore_request
462 IN unsigned int access; /* wanted access rights */
463 IN int inherit; /* inherit flag */
464 OUT int handle; /* handle to the semaphore */
465 IN WCHAR name[1]; /* object name */
469 /* Create a file */
470 struct create_file_request
472 IN unsigned int access; /* wanted access rights */
473 IN int inherit; /* inherit flag */
474 IN unsigned int sharing; /* sharing flags */
475 IN int create; /* file create action */
476 IN unsigned int attrs; /* file attributes for creation */
477 OUT int handle; /* handle to the file */
478 IN char name[1]; /* file name */
482 /* Allocate a file handle for a Unix fd */
483 struct alloc_file_handle_request
485 IN unsigned int access; /* wanted access rights */
486 OUT int handle; /* handle to the file */
490 /* Get a Unix fd to read from a file */
491 struct get_read_fd_request
493 IN int handle; /* handle to the file */
497 /* Get a Unix fd to write to a file */
498 struct get_write_fd_request
500 IN int handle; /* handle to the file */
504 /* Set a file current position */
505 struct set_file_pointer_request
507 IN int handle; /* handle to the file */
508 IN int low; /* position low word */
509 IN int high; /* position high word */
510 IN int whence; /* whence to seek */
511 OUT int new_low; /* new position low word */
512 OUT int new_high; /* new position high word */
516 /* Truncate (or extend) a file */
517 struct truncate_file_request
519 IN int handle; /* handle to the file */
523 /* Set a file access and modification times */
524 struct set_file_time_request
526 IN int handle; /* handle to the file */
527 IN time_t access_time; /* last access time */
528 IN time_t write_time; /* last write time */
532 /* Flush a file buffers */
533 struct flush_file_request
535 IN int handle; /* handle to the file */
539 /* Get information about a file */
540 struct get_file_info_request
542 IN int handle; /* handle to the file */
543 OUT int type; /* file type */
544 OUT int attr; /* file attributes */
545 OUT time_t access_time; /* last access time */
546 OUT time_t write_time; /* last write time */
547 OUT int size_high; /* file size */
548 OUT int size_low; /* file size */
549 OUT int links; /* number of links */
550 OUT int index_high; /* unique index */
551 OUT int index_low; /* unique index */
552 OUT unsigned int serial; /* volume serial number */
556 /* Lock a region of a file */
557 struct lock_file_request
559 IN int handle; /* handle to the file */
560 IN unsigned int offset_low; /* offset of start of lock */
561 IN unsigned int offset_high; /* offset of start of lock */
562 IN unsigned int count_low; /* count of bytes to lock */
563 IN unsigned int count_high; /* count of bytes to lock */
567 /* Unlock a region of a file */
568 struct unlock_file_request
570 IN int handle; /* handle to the file */
571 IN unsigned int offset_low; /* offset of start of unlock */
572 IN unsigned int offset_high; /* offset of start of unlock */
573 IN unsigned int count_low; /* count of bytes to unlock */
574 IN unsigned int count_high; /* count of bytes to unlock */
578 /* Create an anonymous pipe */
579 struct create_pipe_request
581 IN int inherit; /* inherit flag */
582 OUT int handle_read; /* handle to the read-side of the pipe */
583 OUT int handle_write; /* handle to the write-side of the pipe */
587 /* Create a socket */
588 struct create_socket_request
590 IN unsigned int access; /* wanted access rights */
591 IN int inherit; /* inherit flag */
592 IN int family; /* family, see socket manpage */
593 IN int type; /* type, see socket manpage */
594 IN int protocol; /* protocol, see socket manpage */
595 OUT int handle; /* handle to the new socket */
599 /* Accept a socket */
600 struct accept_socket_request
602 IN int lhandle; /* handle to the listening socket */
603 IN unsigned int access; /* wanted access rights */
604 IN int inherit; /* inherit flag */
605 OUT int handle; /* handle to the new socket */
609 /* Set socket event parameters */
610 struct set_socket_event_request
612 IN int handle; /* handle to the socket */
613 IN unsigned int mask; /* event mask */
614 IN int event; /* event object */
618 /* Get socket event parameters */
619 struct get_socket_event_request
621 IN int handle; /* handle to the socket */
622 IN int service; /* clear pending? */
623 IN int s_event; /* "expected" event object */
624 IN int c_event; /* event to clear */
625 OUT unsigned int mask; /* event mask */
626 OUT unsigned int pmask; /* pending events */
627 OUT unsigned int state; /* status bits */
628 OUT int errors[1]; /* event errors */
632 /* Reenable pending socket events */
633 struct enable_socket_event_request
635 IN int handle; /* handle to the socket */
636 IN unsigned int mask; /* events to re-enable */
637 IN unsigned int sstate; /* status bits to set */
638 IN unsigned int cstate; /* status bits to clear */
642 /* Allocate a console for the current process */
643 struct alloc_console_request
645 IN unsigned int access; /* wanted access rights */
646 IN int inherit; /* inherit flag */
647 OUT int handle_in; /* handle to console input */
648 OUT int handle_out; /* handle to console output */
652 /* Free the console of the current process */
653 struct free_console_request
655 IN int dummy;
659 /* Open a handle to the process console */
660 struct open_console_request
662 IN int output; /* input or output? */
663 IN unsigned int access; /* wanted access rights */
664 IN int inherit; /* inherit flag */
665 OUT int handle; /* handle to the console */
669 /* Set a console file descriptor */
670 struct set_console_fd_request
672 IN int handle; /* handle to the console */
673 IN int file_handle; /* handle of file to use as file descriptor */
674 IN int pid; /* pid of xterm (hack) */
678 /* Get a console mode (input or output) */
679 struct get_console_mode_request
681 IN int handle; /* handle to the console */
682 OUT int mode; /* console mode */
686 /* Set a console mode (input or output) */
687 struct set_console_mode_request
689 IN int handle; /* handle to the console */
690 IN int mode; /* console mode */
694 /* Set info about a console (output only) */
695 struct set_console_info_request
697 IN int handle; /* handle to the console */
698 IN int mask; /* setting mask (see below) */
699 IN int cursor_size; /* size of cursor (percentage filled) */
700 IN int cursor_visible;/* cursor visibility flag */
701 IN char title[1]; /* console title */
703 #define SET_CONSOLE_INFO_CURSOR 0x01
704 #define SET_CONSOLE_INFO_TITLE 0x02
706 /* Get info about a console (output only) */
707 struct get_console_info_request
709 IN int handle; /* handle to the console */
710 OUT int cursor_size; /* size of cursor (percentage filled) */
711 OUT int cursor_visible;/* cursor visibility flag */
712 OUT int pid; /* pid of xterm (hack) */
713 OUT char title[1]; /* console title */
717 /* Add input records to a console input queue */
718 struct write_console_input_request
720 IN int handle; /* handle to the console input */
721 IN int count; /* number of input records */
722 OUT int written; /* number of records written */
723 /* INPUT_RECORD records[0]; */ /* input records */
726 /* Fetch input records from a console input queue */
727 struct read_console_input_request
729 IN int handle; /* handle to the console input */
730 IN int count; /* max number of records to retrieve */
731 IN int flush; /* flush the retrieved records from the queue? */
732 OUT int read; /* number of records read */
733 /* INPUT_RECORD records[0]; */ /* input records */
737 /* Create a change notification */
738 struct create_change_notification_request
740 IN int subtree; /* watch all the subtree */
741 IN int filter; /* notification filter */
742 OUT int handle; /* handle to the change notification */
746 /* Create a file mapping */
747 struct create_mapping_request
749 IN int size_high; /* mapping size */
750 IN int size_low; /* mapping size */
751 IN int protect; /* protection flags (see below) */
752 IN int inherit; /* inherit flag */
753 IN int file_handle; /* file handle */
754 OUT int handle; /* handle to the mapping */
755 IN WCHAR name[1]; /* object name */
757 /* protection flags */
758 #define VPROT_READ 0x01
759 #define VPROT_WRITE 0x02
760 #define VPROT_EXEC 0x04
761 #define VPROT_WRITECOPY 0x08
762 #define VPROT_GUARD 0x10
763 #define VPROT_NOCACHE 0x20
764 #define VPROT_COMMITTED 0x40
765 #define VPROT_IMAGE 0x80
768 /* Open a mapping */
769 struct open_mapping_request
771 IN unsigned int access; /* wanted access rights */
772 IN int inherit; /* inherit flag */
773 OUT int handle; /* handle to the mapping */
774 IN WCHAR name[1]; /* object name */
778 /* Get information about a file mapping */
779 struct get_mapping_info_request
781 IN int handle; /* handle to the mapping */
782 OUT int size_high; /* mapping size */
783 OUT int size_low; /* mapping size */
784 OUT int protect; /* protection flags */
785 OUT int header_size; /* header size (for VPROT_IMAGE mapping) */
786 OUT void* base; /* default base addr (for VPROT_IMAGE mapping) */
787 OUT int shared_file; /* shared mapping file handle */
788 OUT int shared_size; /* shared mapping size */
792 /* Create a device */
793 struct create_device_request
795 IN unsigned int access; /* wanted access rights */
796 IN int inherit; /* inherit flag */
797 IN int id; /* client private id */
798 OUT int handle; /* handle to the device */
802 /* Create a snapshot */
803 struct create_snapshot_request
805 IN int inherit; /* inherit flag */
806 IN int flags; /* snapshot flags (TH32CS_*) */
807 IN void* pid; /* process id */
808 OUT int handle; /* handle to the snapshot */
812 /* Get the next process from a snapshot */
813 struct next_process_request
815 IN int handle; /* handle to the snapshot */
816 IN int reset; /* reset snapshot position? */
817 OUT int count; /* process usage count */
818 OUT void* pid; /* process id */
819 OUT int threads; /* number of threads */
820 OUT int priority; /* process priority */
824 /* Get the next thread from a snapshot */
825 struct next_thread_request
827 IN int handle; /* handle to the snapshot */
828 IN int reset; /* reset snapshot position? */
829 OUT int count; /* thread usage count */
830 OUT void* pid; /* process id */
831 OUT void* tid; /* thread id */
832 OUT int base_pri; /* base priority */
833 OUT int delta_pri; /* delta priority */
837 /* Get the next module from a snapshot */
838 struct next_module_request
840 IN int handle; /* handle to the snapshot */
841 IN int reset; /* reset snapshot position? */
842 OUT void* pid; /* process id */
843 OUT void* base; /* module base address */
847 /* Wait for a debug event */
848 struct wait_debug_event_request
850 IN int timeout; /* timeout in ms */
851 OUT void* pid; /* process id */
852 OUT void* tid; /* thread id */
853 OUT debug_event_t event; /* debug event data */
857 /* Send an exception event */
858 struct exception_event_request
860 IN EXCEPTION_RECORD record; /* exception record */
861 IN int first; /* first chance exception? */
862 IN CONTEXT context; /* thread context */
863 OUT int status; /* event continuation status */
867 /* Send an output string to the debugger */
868 struct output_debug_string_request
870 IN void* string; /* string to display (in debugged process address space) */
871 IN int unicode; /* is it Unicode? */
872 IN int length; /* string length */
876 /* Continue a debug event */
877 struct continue_debug_event_request
879 IN void* pid; /* process id to continue */
880 IN void* tid; /* thread id to continue */
881 IN int status; /* continuation status */
885 /* Start debugging an existing process */
886 struct debug_process_request
888 IN void* pid; /* id of the process to debug */
892 /* Read data from a process address space */
893 struct read_process_memory_request
895 IN int handle; /* process handle */
896 IN void* addr; /* addr to read from (must be int-aligned) */
897 IN int len; /* number of ints to read */
898 OUT unsigned int data[1]; /* result data */
902 /* Write data to a process address space */
903 struct write_process_memory_request
905 IN int handle; /* process handle */
906 IN void* addr; /* addr to write to (must be int-aligned) */
907 IN int len; /* number of ints to write */
908 IN unsigned int first_mask; /* mask for first word */
909 IN unsigned int last_mask; /* mask for last word */
910 IN unsigned int data[1]; /* data to write */
914 /* Create a registry key */
915 struct create_key_request
917 IN int parent; /* handle to the parent key */
918 IN unsigned int access; /* desired access rights */
919 IN unsigned int options; /* creation options */
920 IN time_t modif; /* last modification time */
921 OUT int hkey; /* handle to the created key */
922 OUT int created; /* has it been newly created? */
923 IN path_t name; /* key name */
924 IN WCHAR class[1]; /* class name */
928 /* Open a registry key */
929 struct open_key_request
931 IN int parent; /* handle to the parent key */
932 IN unsigned int access; /* desired access rights */
933 OUT int hkey; /* handle to the open key */
934 IN path_t name; /* key name */
938 /* Delete a registry key */
939 struct delete_key_request
941 IN int hkey; /* handle to the parent key */
942 IN path_t name; /* key name */
946 /* Close a registry key */
947 struct close_key_request
949 IN int hkey; /* key to close */
953 /* Enumerate registry subkeys */
954 struct enum_key_request
956 IN int hkey; /* handle to registry key */
957 IN int index; /* index of subkey */
958 OUT time_t modif; /* last modification time */
959 OUT path_t name; /* subkey name */
960 OUT WCHAR class[1]; /* class name */
964 /* Query information about a registry key */
965 struct query_key_info_request
967 IN int hkey; /* handle to registry key */
968 OUT int subkeys; /* number of subkeys */
969 OUT int max_subkey; /* longest subkey name */
970 OUT int max_class; /* longest class name */
971 OUT int values; /* number of values */
972 OUT int max_value; /* longest value name */
973 OUT int max_data; /* longest value data */
974 OUT time_t modif; /* last modification time */
975 OUT path_t name; /* key name */
976 OUT WCHAR class[1]; /* class name */
980 /* Set a value of a registry key */
981 struct set_key_value_request
983 IN int hkey; /* handle to registry key */
984 IN int type; /* value type */
985 IN unsigned int total; /* total value len */
986 IN unsigned int offset; /* offset for setting data */
987 IN unsigned int len; /* value data len */
988 IN path_t name; /* value name */
989 IN unsigned char data[1]; /* value data */
993 /* Retrieve the value of a registry key */
994 struct get_key_value_request
996 IN int hkey; /* handle to registry key */
997 IN unsigned int offset; /* offset for getting data */
998 OUT int type; /* value type */
999 OUT int len; /* value data len */
1000 IN WCHAR name[1]; /* value name */
1001 OUT unsigned char data[1]; /* value data */
1005 /* Enumerate a value of a registry key */
1006 struct enum_key_value_request
1008 IN int hkey; /* handle to registry key */
1009 IN int index; /* value index */
1010 IN unsigned int offset; /* offset for getting data */
1011 OUT int type; /* value type */
1012 OUT int len; /* value data len */
1013 OUT path_t name; /* value name */
1014 OUT unsigned char data[1]; /* value data */
1018 /* Delete a value of a registry key */
1019 struct delete_key_value_request
1021 IN int hkey; /* handle to registry key */
1022 IN path_t name; /* value name */
1026 /* Load a registry branch from a file */
1027 struct load_registry_request
1029 IN int hkey; /* root key to load to */
1030 IN int file; /* file to load from */
1031 IN path_t name; /* subkey name */
1035 /* Save a registry branch to a file */
1036 struct save_registry_request
1038 IN int hkey; /* key to save */
1039 IN int file; /* file to save to */
1043 /* Save a registry branch at server exit */
1044 struct save_registry_atexit_request
1046 IN int hkey; /* key to save */
1047 IN char file[1]; /* file to save to */
1051 /* Set the current and saving level for the registry */
1052 struct set_registry_levels_request
1054 IN int current; /* new current level */
1055 IN int saving; /* new saving level */
1056 IN int period; /* duration between periodic saves (milliseconds) */
1060 /* Create a waitable timer */
1061 struct create_timer_request
1063 IN int inherit; /* inherit flag */
1064 IN int manual; /* manual reset */
1065 OUT int handle; /* handle to the timer */
1066 IN WCHAR name[1]; /* timer name */
1070 /* Open a waitable timer */
1071 struct open_timer_request
1073 IN unsigned int access; /* wanted access rights */
1074 IN int inherit; /* inherit flag */
1075 OUT int handle; /* handle to the timer */
1076 IN WCHAR name[1]; /* timer name */
1079 /* Set a waitable timer */
1080 struct set_timer_request
1082 IN int handle; /* handle to the timer */
1083 IN int sec; /* next expiration absolute time */
1084 IN int usec; /* next expiration absolute time */
1085 IN int period; /* timer period in ms */
1086 IN void* callback; /* callback function */
1087 IN void* arg; /* callback argument */
1090 /* Cancel a waitable timer */
1091 struct cancel_timer_request
1093 IN int handle; /* handle to the timer */
1097 /* Retrieve the current context of a thread */
1098 struct get_thread_context_request
1100 IN int handle; /* thread handle */
1101 IN unsigned int flags; /* context flags */
1102 OUT CONTEXT context; /* thread context */
1106 /* Set the current context of a thread */
1107 struct set_thread_context_request
1109 IN int handle; /* thread handle */
1110 IN unsigned int flags; /* context flags */
1111 IN CONTEXT context; /* thread context */
1115 /* Fetch a selector entry for a thread */
1116 struct get_selector_entry_request
1118 IN int handle; /* thread handle */
1119 IN int entry; /* LDT entry */
1120 OUT unsigned int base; /* selector base */
1121 OUT unsigned int limit; /* selector limit */
1122 OUT unsigned char flags; /* selector flags */
1126 /* Add an atom */
1127 struct add_atom_request
1129 IN int local; /* is atom in local process table? */
1130 OUT int atom; /* resulting atom */
1131 IN WCHAR name[1]; /* atom name */
1135 /* Delete an atom */
1136 struct delete_atom_request
1138 IN int atom; /* atom handle */
1139 IN int local; /* is atom in local process table? */
1143 /* Find an atom */
1144 struct find_atom_request
1146 IN int local; /* is atom in local process table? */
1147 OUT int atom; /* atom handle */
1148 IN WCHAR name[1]; /* atom name */
1152 /* Get an atom name */
1153 struct get_atom_name_request
1155 IN int atom; /* atom handle */
1156 IN int local; /* is atom in local process table? */
1157 OUT int count; /* atom lock count */
1158 OUT WCHAR name[1]; /* atom name */
1162 /* Init the process atom table */
1163 struct init_atom_table_request
1165 IN int entries; /* number of entries */
1169 /* Get the message queue of the current thread */
1170 struct get_msg_queue_request
1172 OUT int handle; /* handle to the queue */
1175 /* Wake up a message queue */
1176 struct wake_queue_request
1178 IN int handle; /* handle to the queue */
1179 IN unsigned int bits; /* wake bits */
1182 /* Wait for a process to start waiting on input */
1183 struct wait_input_idle_request
1185 IN int handle; /* process handle */
1186 IN int timeout; /* timeout */
1187 OUT int event; /* handle to idle event */
1191 /* Everything below this line is generated automatically by tools/make_requests */
1192 /* ### make_requests begin ### */
1194 enum request
1196 REQ_NEW_PROCESS,
1197 REQ_WAIT_PROCESS,
1198 REQ_NEW_THREAD,
1199 REQ_BOOT_DONE,
1200 REQ_INIT_PROCESS,
1201 REQ_INIT_PROCESS_DONE,
1202 REQ_INIT_THREAD,
1203 REQ_GET_THREAD_BUFFER,
1204 REQ_TERMINATE_PROCESS,
1205 REQ_TERMINATE_THREAD,
1206 REQ_GET_PROCESS_INFO,
1207 REQ_SET_PROCESS_INFO,
1208 REQ_GET_THREAD_INFO,
1209 REQ_SET_THREAD_INFO,
1210 REQ_SUSPEND_THREAD,
1211 REQ_RESUME_THREAD,
1212 REQ_LOAD_DLL,
1213 REQ_UNLOAD_DLL,
1214 REQ_QUEUE_APC,
1215 REQ_GET_APCS,
1216 REQ_CLOSE_HANDLE,
1217 REQ_GET_HANDLE_INFO,
1218 REQ_SET_HANDLE_INFO,
1219 REQ_DUP_HANDLE,
1220 REQ_OPEN_PROCESS,
1221 REQ_SELECT,
1222 REQ_CREATE_EVENT,
1223 REQ_EVENT_OP,
1224 REQ_OPEN_EVENT,
1225 REQ_CREATE_MUTEX,
1226 REQ_RELEASE_MUTEX,
1227 REQ_OPEN_MUTEX,
1228 REQ_CREATE_SEMAPHORE,
1229 REQ_RELEASE_SEMAPHORE,
1230 REQ_OPEN_SEMAPHORE,
1231 REQ_CREATE_FILE,
1232 REQ_ALLOC_FILE_HANDLE,
1233 REQ_GET_READ_FD,
1234 REQ_GET_WRITE_FD,
1235 REQ_SET_FILE_POINTER,
1236 REQ_TRUNCATE_FILE,
1237 REQ_SET_FILE_TIME,
1238 REQ_FLUSH_FILE,
1239 REQ_GET_FILE_INFO,
1240 REQ_LOCK_FILE,
1241 REQ_UNLOCK_FILE,
1242 REQ_CREATE_PIPE,
1243 REQ_CREATE_SOCKET,
1244 REQ_ACCEPT_SOCKET,
1245 REQ_SET_SOCKET_EVENT,
1246 REQ_GET_SOCKET_EVENT,
1247 REQ_ENABLE_SOCKET_EVENT,
1248 REQ_ALLOC_CONSOLE,
1249 REQ_FREE_CONSOLE,
1250 REQ_OPEN_CONSOLE,
1251 REQ_SET_CONSOLE_FD,
1252 REQ_GET_CONSOLE_MODE,
1253 REQ_SET_CONSOLE_MODE,
1254 REQ_SET_CONSOLE_INFO,
1255 REQ_GET_CONSOLE_INFO,
1256 REQ_WRITE_CONSOLE_INPUT,
1257 REQ_READ_CONSOLE_INPUT,
1258 REQ_CREATE_CHANGE_NOTIFICATION,
1259 REQ_CREATE_MAPPING,
1260 REQ_OPEN_MAPPING,
1261 REQ_GET_MAPPING_INFO,
1262 REQ_CREATE_DEVICE,
1263 REQ_CREATE_SNAPSHOT,
1264 REQ_NEXT_PROCESS,
1265 REQ_NEXT_THREAD,
1266 REQ_NEXT_MODULE,
1267 REQ_WAIT_DEBUG_EVENT,
1268 REQ_EXCEPTION_EVENT,
1269 REQ_OUTPUT_DEBUG_STRING,
1270 REQ_CONTINUE_DEBUG_EVENT,
1271 REQ_DEBUG_PROCESS,
1272 REQ_READ_PROCESS_MEMORY,
1273 REQ_WRITE_PROCESS_MEMORY,
1274 REQ_CREATE_KEY,
1275 REQ_OPEN_KEY,
1276 REQ_DELETE_KEY,
1277 REQ_CLOSE_KEY,
1278 REQ_ENUM_KEY,
1279 REQ_QUERY_KEY_INFO,
1280 REQ_SET_KEY_VALUE,
1281 REQ_GET_KEY_VALUE,
1282 REQ_ENUM_KEY_VALUE,
1283 REQ_DELETE_KEY_VALUE,
1284 REQ_LOAD_REGISTRY,
1285 REQ_SAVE_REGISTRY,
1286 REQ_SAVE_REGISTRY_ATEXIT,
1287 REQ_SET_REGISTRY_LEVELS,
1288 REQ_CREATE_TIMER,
1289 REQ_OPEN_TIMER,
1290 REQ_SET_TIMER,
1291 REQ_CANCEL_TIMER,
1292 REQ_GET_THREAD_CONTEXT,
1293 REQ_SET_THREAD_CONTEXT,
1294 REQ_GET_SELECTOR_ENTRY,
1295 REQ_ADD_ATOM,
1296 REQ_DELETE_ATOM,
1297 REQ_FIND_ATOM,
1298 REQ_GET_ATOM_NAME,
1299 REQ_INIT_ATOM_TABLE,
1300 REQ_GET_MSG_QUEUE,
1301 REQ_WAKE_QUEUE,
1302 REQ_WAIT_INPUT_IDLE,
1303 REQ_NB_REQUESTS
1306 #define SERVER_PROTOCOL_VERSION 16
1308 /* ### make_requests end ### */
1309 /* Everything above this line is generated automatically by tools/make_requests */
1312 /* client-side functions */
1314 #ifndef __WINE_SERVER__
1316 #include "thread.h"
1317 #include "ntddk.h"
1319 /* client communication functions */
1321 extern unsigned int server_call_noerr( enum request req );
1322 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1323 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1324 extern const char *get_config_dir(void);
1326 /* get a pointer to the request buffer */
1327 static inline void WINE_UNUSED *get_req_buffer(void)
1329 return NtCurrentTeb()->buffer;
1332 /* maximum remaining size in the server buffer */
1333 static inline int WINE_UNUSED server_remaining( const void *ptr )
1335 return (char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size - (char *)ptr;
1338 /* do a server call and set the last error code */
1339 static inline int server_call( enum request req )
1341 unsigned int res = server_call_noerr( req );
1342 if (res) SetLastError( RtlNtStatusToDosError(res) );
1343 return res;
1346 /* copy a Unicode string to the server buffer */
1347 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1349 if (src)
1351 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1352 while ((dst < end) && *src) *dst++ = *src++;
1354 *dst = 0;
1357 /* copy and convert an ASCII string to the server buffer */
1358 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1360 if (src)
1362 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1363 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1365 *dst = 0;
1368 extern int CLIENT_InitServer(void);
1369 extern int CLIENT_BootDone( int debug_level );
1370 extern int CLIENT_IsBootThread(void);
1371 extern int CLIENT_InitThread(void);
1372 #endif /* __WINE_SERVER__ */
1374 #endif /* __WINE_SERVER_H */