Now attaching imported DLLs of a winelib executable.
[wine/hacks.git] / include / server.h
blobf6031d48df22600d75a5e0afc72828adec4ba392
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; /* inherit flag */
108 IN int inherit_all; /* inherit all handles from parent */
109 IN int create_flags; /* creation flags */
110 IN int start_flags; /* flags from startup info */
111 IN int exe_file; /* file handle for main exe */
112 IN int hstdin; /* handle for stdin */
113 IN int hstdout; /* handle for stdout */
114 IN int hstderr; /* handle for stderr */
115 IN int event; /* event to signal startup */
116 IN int cmd_show; /* main window show mode */
117 IN void* env_ptr; /* pointer to environment (FIXME: hack) */
118 OUT void* pid; /* process id */
119 OUT int phandle; /* process handle (in the current process) */
120 OUT void* tid; /* thread id */
121 OUT int thandle; /* thread handle (in the current process) */
122 IN char cmdline[1]; /* command line */
126 /* Create a new thread from the context of the parent */
127 struct new_thread_request
129 IN int suspend; /* new thread should be suspended on creation */
130 IN int inherit; /* inherit flag */
131 OUT void* tid; /* thread id */
132 OUT int handle; /* thread handle (in the current process) */
136 /* Signal that we are finished booting on the client side */
137 struct boot_done_request
139 IN int debug_level; /* new debug level */
143 /* Initialize a process; called from the new process context */
144 struct init_process_request
146 IN void* ldt_copy; /* addr of LDT copy */
147 IN void* ldt_flags; /* addr of LDT flags */
148 OUT int start_flags; /* flags from startup info */
149 OUT int exe_file; /* file handle for main exe */
150 OUT int hstdin; /* handle for stdin */
151 OUT int hstdout; /* handle for stdout */
152 OUT int hstderr; /* handle for stderr */
153 OUT int cmd_show; /* main window show mode */
154 OUT void* env_ptr; /* pointer to environment (FIXME: hack) */
155 OUT char cmdline[1]; /* command line */
159 /* Signal the end of the process initialization */
160 struct init_process_done_request
162 IN void* module; /* main module base address */
163 IN void* entry; /* process entry point */
164 OUT int debugged; /* being debugged? */
168 /* Initialize a thread; called from the child after fork()/clone() */
169 struct init_thread_request
171 IN int unix_pid; /* Unix pid of new thread */
172 IN void* teb; /* TEB of new thread (in thread address space) */
173 IN void* entry; /* thread entry point (in thread address space) */
177 /* Retrieve the thread buffer file descriptor */
178 /* The reply to this request is the first thing a newly */
179 /* created thread gets (without having to request it) */
180 struct get_thread_buffer_request
182 OUT void* pid; /* process id of the new thread's process */
183 OUT void* tid; /* thread id of the new thread */
184 OUT int boot; /* is this the boot thread? */
185 OUT int version; /* protocol version */
189 /* Terminate a process */
190 struct terminate_process_request
192 IN int handle; /* process handle to terminate */
193 IN int exit_code; /* process exit code */
194 OUT int self; /* suicide? */
198 /* Terminate a thread */
199 struct terminate_thread_request
201 IN int handle; /* thread handle to terminate */
202 IN int exit_code; /* thread exit code */
203 OUT int self; /* suicide? */
204 OUT int last; /* last thread in this process? */
208 /* Retrieve information about a process */
209 struct get_process_info_request
211 IN int handle; /* process handle */
212 OUT void* pid; /* server process id */
213 OUT int debugged; /* debugged? */
214 OUT int exit_code; /* process exit code */
215 OUT int priority; /* priority class */
216 OUT int process_affinity; /* process affinity mask */
217 OUT int system_affinity; /* system affinity mask */
221 /* Set a process informations */
222 struct set_process_info_request
224 IN int handle; /* process handle */
225 IN int mask; /* setting mask (see below) */
226 IN int priority; /* priority class */
227 IN int affinity; /* affinity mask */
229 #define SET_PROCESS_INFO_PRIORITY 0x01
230 #define SET_PROCESS_INFO_AFFINITY 0x02
233 /* Retrieve information about a thread */
234 struct get_thread_info_request
236 IN int handle; /* thread handle */
237 OUT void* tid; /* server thread id */
238 OUT int exit_code; /* thread exit code */
239 OUT int priority; /* thread priority level */
243 /* Set a thread informations */
244 struct set_thread_info_request
246 IN int handle; /* thread handle */
247 IN int mask; /* setting mask (see below) */
248 IN int priority; /* priority class */
249 IN int affinity; /* affinity mask */
251 #define SET_THREAD_INFO_PRIORITY 0x01
252 #define SET_THREAD_INFO_AFFINITY 0x02
255 /* Suspend a thread */
256 struct suspend_thread_request
258 IN int handle; /* thread handle */
259 OUT int count; /* new suspend count */
263 /* Resume a thread */
264 struct resume_thread_request
266 IN int handle; /* thread handle */
267 OUT int count; /* new suspend count */
271 /* Notify the server that a dll has been loaded */
272 struct load_dll_request
274 IN int handle; /* file handle */
275 IN void* base; /* base address */
276 IN int dbg_offset; /* debug info offset */
277 IN int dbg_size; /* debug info size */
278 IN void* name; /* ptr to ptr to name (in process addr space) */
282 /* Notify the server that a dll is being unloaded */
283 struct unload_dll_request
285 IN void* base; /* base address */
289 /* Queue an APC for a thread */
290 struct queue_apc_request
292 IN int handle; /* thread handle */
293 IN void* func; /* function to call */
294 IN void* param; /* param for function to call */
298 /* Get list of APC to call */
299 struct get_apcs_request
301 OUT int count; /* number of apcs */
302 OUT void* apcs[1]; /* async procedures to call */
306 /* Close a handle for the current process */
307 struct close_handle_request
309 IN int handle; /* handle to close */
313 /* Get information about a handle */
314 struct get_handle_info_request
316 IN int handle; /* handle we are interested in */
317 OUT int flags; /* handle flags */
321 /* Set a handle information */
322 struct set_handle_info_request
324 IN int handle; /* handle we are interested in */
325 IN int flags; /* new handle flags */
326 IN int mask; /* mask for flags to set */
330 /* Duplicate a handle */
331 struct dup_handle_request
333 IN int src_process; /* src process handle */
334 IN int src_handle; /* src handle to duplicate */
335 IN int dst_process; /* dst process handle */
336 IN unsigned int access; /* wanted access rights */
337 IN int inherit; /* inherit flag */
338 IN int options; /* duplicate options (see below) */
339 OUT int handle; /* duplicated handle in dst process */
341 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
342 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
343 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
346 /* Open a handle to a process */
347 struct open_process_request
349 IN void* pid; /* process id to open */
350 IN unsigned int access; /* wanted access rights */
351 IN int inherit; /* inherit flag */
352 OUT int handle; /* handle to the process */
356 /* Wait for handles */
357 struct select_request
359 IN int count; /* handles count */
360 IN int flags; /* wait flags (see below) */
361 IN int timeout; /* timeout in ms */
362 OUT int signaled; /* signaled handle */
363 IN int handles[1]; /* handles to select on */
365 #define SELECT_ALL 1
366 #define SELECT_ALERTABLE 2
367 #define SELECT_TIMEOUT 4
370 /* Create an event */
371 struct create_event_request
373 IN int manual_reset; /* manual reset event */
374 IN int initial_state; /* initial state of the event */
375 IN int inherit; /* inherit flag */
376 OUT int handle; /* handle to the event */
377 IN WCHAR name[1]; /* event name */
380 /* Event operation */
381 struct event_op_request
383 IN int handle; /* handle to event */
384 IN int op; /* event operation (see below) */
386 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
389 /* Open an event */
390 struct open_event_request
392 IN unsigned int access; /* wanted access rights */
393 IN int inherit; /* inherit flag */
394 OUT int handle; /* handle to the event */
395 IN WCHAR name[1]; /* object name */
399 /* Create a mutex */
400 struct create_mutex_request
402 IN int owned; /* initially owned? */
403 IN int inherit; /* inherit flag */
404 OUT int handle; /* handle to the mutex */
405 IN WCHAR name[1]; /* mutex name */
409 /* Release a mutex */
410 struct release_mutex_request
412 IN int handle; /* handle to the mutex */
416 /* Open a mutex */
417 struct open_mutex_request
419 IN unsigned int access; /* wanted access rights */
420 IN int inherit; /* inherit flag */
421 OUT int handle; /* handle to the mutex */
422 IN WCHAR name[1]; /* object name */
426 /* Create a semaphore */
427 struct create_semaphore_request
429 IN unsigned int initial; /* initial count */
430 IN unsigned int max; /* maximum count */
431 IN int inherit; /* inherit flag */
432 OUT int handle; /* handle to the semaphore */
433 IN WCHAR name[1]; /* semaphore name */
437 /* Release a semaphore */
438 struct release_semaphore_request
440 IN int handle; /* handle to the semaphore */
441 IN unsigned int count; /* count to add to semaphore */
442 OUT unsigned int prev_count; /* previous semaphore count */
446 /* Open a semaphore */
447 struct open_semaphore_request
449 IN unsigned int access; /* wanted access rights */
450 IN int inherit; /* inherit flag */
451 OUT int handle; /* handle to the semaphore */
452 IN WCHAR name[1]; /* object name */
456 /* Create a file */
457 struct create_file_request
459 IN unsigned int access; /* wanted access rights */
460 IN int inherit; /* inherit flag */
461 IN unsigned int sharing; /* sharing flags */
462 IN int create; /* file create action */
463 IN unsigned int attrs; /* file attributes for creation */
464 OUT int handle; /* handle to the file */
465 IN char name[1]; /* file name */
469 /* Allocate a file handle for a Unix fd */
470 struct alloc_file_handle_request
472 IN unsigned int access; /* wanted access rights */
473 OUT int handle; /* handle to the file */
477 /* Get a Unix fd to read from a file */
478 struct get_read_fd_request
480 IN int handle; /* handle to the file */
484 /* Get a Unix fd to write to a file */
485 struct get_write_fd_request
487 IN int handle; /* handle to the file */
491 /* Set a file current position */
492 struct set_file_pointer_request
494 IN int handle; /* handle to the file */
495 IN int low; /* position low word */
496 IN int high; /* position high word */
497 IN int whence; /* whence to seek */
498 OUT int new_low; /* new position low word */
499 OUT int new_high; /* new position high word */
503 /* Truncate (or extend) a file */
504 struct truncate_file_request
506 IN int handle; /* handle to the file */
510 /* Set a file access and modification times */
511 struct set_file_time_request
513 IN int handle; /* handle to the file */
514 IN time_t access_time; /* last access time */
515 IN time_t write_time; /* last write time */
519 /* Flush a file buffers */
520 struct flush_file_request
522 IN int handle; /* handle to the file */
526 /* Get information about a file */
527 struct get_file_info_request
529 IN int handle; /* handle to the file */
530 OUT int type; /* file type */
531 OUT int attr; /* file attributes */
532 OUT time_t access_time; /* last access time */
533 OUT time_t write_time; /* last write time */
534 OUT int size_high; /* file size */
535 OUT int size_low; /* file size */
536 OUT int links; /* number of links */
537 OUT int index_high; /* unique index */
538 OUT int index_low; /* unique index */
539 OUT unsigned int serial; /* volume serial number */
543 /* Lock a region of a file */
544 struct lock_file_request
546 IN int handle; /* handle to the file */
547 IN unsigned int offset_low; /* offset of start of lock */
548 IN unsigned int offset_high; /* offset of start of lock */
549 IN unsigned int count_low; /* count of bytes to lock */
550 IN unsigned int count_high; /* count of bytes to lock */
554 /* Unlock a region of a file */
555 struct unlock_file_request
557 IN int handle; /* handle to the file */
558 IN unsigned int offset_low; /* offset of start of unlock */
559 IN unsigned int offset_high; /* offset of start of unlock */
560 IN unsigned int count_low; /* count of bytes to unlock */
561 IN unsigned int count_high; /* count of bytes to unlock */
565 /* Create an anonymous pipe */
566 struct create_pipe_request
568 IN int inherit; /* inherit flag */
569 OUT int handle_read; /* handle to the read-side of the pipe */
570 OUT int handle_write; /* handle to the write-side of the pipe */
574 /* Create a socket */
575 struct create_socket_request
577 IN unsigned int access; /* wanted access rights */
578 IN int inherit; /* inherit flag */
579 IN int family; /* family, see socket manpage */
580 IN int type; /* type, see socket manpage */
581 IN int protocol; /* protocol, see socket manpage */
582 OUT int handle; /* handle to the new socket */
586 /* Accept a socket */
587 struct accept_socket_request
589 IN int lhandle; /* handle to the listening socket */
590 IN unsigned int access; /* wanted access rights */
591 IN int inherit; /* inherit flag */
592 OUT int handle; /* handle to the new socket */
596 /* Set socket event parameters */
597 struct set_socket_event_request
599 IN int handle; /* handle to the socket */
600 IN unsigned int mask; /* event mask */
601 IN int event; /* event object */
605 /* Get socket event parameters */
606 struct get_socket_event_request
608 IN int handle; /* handle to the socket */
609 IN int service; /* clear pending? */
610 IN int s_event; /* "expected" event object */
611 OUT unsigned int mask; /* event mask */
612 OUT unsigned int pmask; /* pending events */
613 OUT unsigned int state; /* status bits */
614 OUT int errors[1]; /* event errors */
618 /* Reenable pending socket events */
619 struct enable_socket_event_request
621 IN int handle; /* handle to the socket */
622 IN unsigned int mask; /* events to re-enable */
623 IN unsigned int sstate; /* status bits to set */
624 IN unsigned int cstate; /* status bits to clear */
628 /* Allocate a console for the current process */
629 struct alloc_console_request
631 IN unsigned int access; /* wanted access rights */
632 IN int inherit; /* inherit flag */
633 OUT int handle_in; /* handle to console input */
634 OUT int handle_out; /* handle to console output */
638 /* Free the console of the current process */
639 struct free_console_request
641 IN int dummy;
645 /* Open a handle to the process console */
646 struct open_console_request
648 IN int output; /* input or output? */
649 IN unsigned int access; /* wanted access rights */
650 IN int inherit; /* inherit flag */
651 OUT int handle; /* handle to the console */
655 /* Set a console file descriptor */
656 struct set_console_fd_request
658 IN int handle; /* handle to the console */
659 IN int file_handle; /* handle of file to use as file descriptor */
660 IN int pid; /* pid of xterm (hack) */
664 /* Get a console mode (input or output) */
665 struct get_console_mode_request
667 IN int handle; /* handle to the console */
668 OUT int mode; /* console mode */
672 /* Set a console mode (input or output) */
673 struct set_console_mode_request
675 IN int handle; /* handle to the console */
676 IN int mode; /* console mode */
680 /* Set info about a console (output only) */
681 struct set_console_info_request
683 IN int handle; /* handle to the console */
684 IN int mask; /* setting mask (see below) */
685 IN int cursor_size; /* size of cursor (percentage filled) */
686 IN int cursor_visible;/* cursor visibility flag */
687 IN char title[1]; /* console title */
689 #define SET_CONSOLE_INFO_CURSOR 0x01
690 #define SET_CONSOLE_INFO_TITLE 0x02
692 /* Get info about a console (output only) */
693 struct get_console_info_request
695 IN int handle; /* handle to the console */
696 OUT int cursor_size; /* size of cursor (percentage filled) */
697 OUT int cursor_visible;/* cursor visibility flag */
698 OUT int pid; /* pid of xterm (hack) */
699 OUT char title[1]; /* console title */
703 /* Add input records to a console input queue */
704 struct write_console_input_request
706 IN int handle; /* handle to the console input */
707 IN int count; /* number of input records */
708 OUT int written; /* number of records written */
709 /* INPUT_RECORD records[0]; */ /* input records */
712 /* Fetch input records from a console input queue */
713 struct read_console_input_request
715 IN int handle; /* handle to the console input */
716 IN int count; /* max number of records to retrieve */
717 IN int flush; /* flush the retrieved records from the queue? */
718 OUT int read; /* number of records read */
719 /* INPUT_RECORD records[0]; */ /* input records */
723 /* Create a change notification */
724 struct create_change_notification_request
726 IN int subtree; /* watch all the subtree */
727 IN int filter; /* notification filter */
728 OUT int handle; /* handle to the change notification */
732 /* Create a file mapping */
733 struct create_mapping_request
735 IN int size_high; /* mapping size */
736 IN int size_low; /* mapping size */
737 IN int protect; /* protection flags (see below) */
738 IN int inherit; /* inherit flag */
739 IN int file_handle; /* file handle */
740 OUT int handle; /* handle to the mapping */
741 IN WCHAR name[1]; /* object name */
743 /* protection flags */
744 #define VPROT_READ 0x01
745 #define VPROT_WRITE 0x02
746 #define VPROT_EXEC 0x04
747 #define VPROT_WRITECOPY 0x08
748 #define VPROT_GUARD 0x10
749 #define VPROT_NOCACHE 0x20
750 #define VPROT_COMMITTED 0x40
753 /* Open a mapping */
754 struct open_mapping_request
756 IN unsigned int access; /* wanted access rights */
757 IN int inherit; /* inherit flag */
758 OUT int handle; /* handle to the mapping */
759 IN WCHAR name[1]; /* object name */
763 /* Get information about a file mapping */
764 struct get_mapping_info_request
766 IN int handle; /* handle to the mapping */
767 OUT int size_high; /* mapping size */
768 OUT int size_low; /* mapping size */
769 OUT int protect; /* protection flags */
773 /* Create a device */
774 struct create_device_request
776 IN unsigned int access; /* wanted access rights */
777 IN int inherit; /* inherit flag */
778 IN int id; /* client private id */
779 OUT int handle; /* handle to the device */
783 /* Create a snapshot */
784 struct create_snapshot_request
786 IN int inherit; /* inherit flag */
787 IN int flags; /* snapshot flags (TH32CS_*) */
788 OUT int handle; /* handle to the snapshot */
792 /* Get the next process from a snapshot */
793 struct next_process_request
795 IN int handle; /* handle to the snapshot */
796 IN int reset; /* reset snapshot position? */
797 OUT void* pid; /* process id */
798 OUT int threads; /* number of threads */
799 OUT int priority; /* process priority */
803 /* Wait for a debug event */
804 struct wait_debug_event_request
806 IN int timeout; /* timeout in ms */
807 OUT void* pid; /* process id */
808 OUT void* tid; /* thread id */
809 OUT debug_event_t event; /* debug event data */
813 /* Send an exception event */
814 struct exception_event_request
816 IN EXCEPTION_RECORD record; /* exception record */
817 IN int first; /* first chance exception? */
818 IN CONTEXT context; /* thread context */
819 OUT int status; /* event continuation status */
823 /* Send an output string to the debugger */
824 struct output_debug_string_request
826 IN void* string; /* string to display (in debugged process address space) */
827 IN int unicode; /* is it Unicode? */
828 IN int length; /* string length */
832 /* Continue a debug event */
833 struct continue_debug_event_request
835 IN void* pid; /* process id to continue */
836 IN void* tid; /* thread id to continue */
837 IN int status; /* continuation status */
841 /* Start debugging an existing process */
842 struct debug_process_request
844 IN void* pid; /* id of the process to debug */
848 /* Read data from a process address space */
849 struct read_process_memory_request
851 IN int handle; /* process handle */
852 IN void* addr; /* addr to read from (must be int-aligned) */
853 IN int len; /* number of ints to read */
854 OUT unsigned int data[1]; /* result data */
858 /* Write data to a process address space */
859 struct write_process_memory_request
861 IN int handle; /* process handle */
862 IN void* addr; /* addr to write to (must be int-aligned) */
863 IN int len; /* number of ints to write */
864 IN unsigned int first_mask; /* mask for first word */
865 IN unsigned int last_mask; /* mask for last word */
866 IN unsigned int data[1]; /* data to write */
870 /* Create a registry key */
871 struct create_key_request
873 IN int parent; /* handle to the parent key */
874 IN unsigned int access; /* desired access rights */
875 IN unsigned int options; /* creation options */
876 IN time_t modif; /* last modification time */
877 OUT int hkey; /* handle to the created key */
878 OUT int created; /* has it been newly created? */
879 IN path_t name; /* key name */
880 IN WCHAR class[1]; /* class name */
884 /* Open a registry key */
885 struct open_key_request
887 IN int parent; /* handle to the parent key */
888 IN unsigned int access; /* desired access rights */
889 OUT int hkey; /* handle to the open key */
890 IN path_t name; /* key name */
894 /* Delete a registry key */
895 struct delete_key_request
897 IN int hkey; /* handle to the parent key */
898 IN path_t name; /* key name */
902 /* Close a registry key */
903 struct close_key_request
905 IN int hkey; /* key to close */
909 /* Enumerate registry subkeys */
910 struct enum_key_request
912 IN int hkey; /* handle to registry key */
913 IN int index; /* index of subkey */
914 OUT time_t modif; /* last modification time */
915 OUT path_t name; /* subkey name */
916 OUT WCHAR class[1]; /* class name */
920 /* Query information about a registry key */
921 struct query_key_info_request
923 IN int hkey; /* handle to registry key */
924 OUT int subkeys; /* number of subkeys */
925 OUT int max_subkey; /* longest subkey name */
926 OUT int max_class; /* longest class name */
927 OUT int values; /* number of values */
928 OUT int max_value; /* longest value name */
929 OUT int max_data; /* longest value data */
930 OUT time_t modif; /* last modification time */
931 OUT path_t name; /* key name */
932 OUT WCHAR class[1]; /* class name */
936 /* Set a value of a registry key */
937 struct set_key_value_request
939 IN int hkey; /* handle to registry key */
940 IN int type; /* value type */
941 IN int len; /* value data len */
942 IN path_t name; /* value name */
943 IN unsigned char data[1]; /* value data */
947 /* Retrieve the value of a registry key */
948 struct get_key_value_request
950 IN int hkey; /* handle to registry key */
951 OUT int type; /* value type */
952 OUT int len; /* value data len */
953 IN WCHAR name[1]; /* value name */
954 OUT unsigned char data[1]; /* value data */
958 /* Enumerate a value of a registry key */
959 struct enum_key_value_request
961 IN int hkey; /* handle to registry key */
962 IN int index; /* value index */
963 OUT int type; /* value type */
964 OUT int len; /* value data len */
965 OUT path_t name; /* value name */
966 OUT unsigned char data[1]; /* value data */
970 /* Delete a value of a registry key */
971 struct delete_key_value_request
973 IN int hkey; /* handle to registry key */
974 IN path_t name; /* value name */
978 /* Load a registry branch from a file */
979 struct load_registry_request
981 IN int hkey; /* root key to load to */
982 IN int file; /* file to load from */
983 IN path_t name; /* subkey name */
987 /* Save a registry branch to a file */
988 struct save_registry_request
990 IN int hkey; /* key to save */
991 IN int file; /* file to save to */
995 /* Set the current and saving level for the registry */
996 struct set_registry_levels_request
998 IN int current; /* new current level */
999 IN int saving; /* new saving level */
1000 IN int version; /* file format version for saving */
1004 /* Create a waitable timer */
1005 struct create_timer_request
1007 IN int inherit; /* inherit flag */
1008 IN int manual; /* manual reset */
1009 OUT int handle; /* handle to the timer */
1010 IN WCHAR name[1]; /* timer name */
1014 /* Open a waitable timer */
1015 struct open_timer_request
1017 IN unsigned int access; /* wanted access rights */
1018 IN int inherit; /* inherit flag */
1019 OUT int handle; /* handle to the timer */
1020 IN WCHAR name[1]; /* timer name */
1023 /* Set a waitable timer */
1024 struct set_timer_request
1026 IN int handle; /* handle to the timer */
1027 IN int sec; /* next expiration absolute time */
1028 IN int usec; /* next expiration absolute time */
1029 IN int period; /* timer period in ms */
1030 IN void* callback; /* callback function */
1031 IN void* arg; /* callback argument */
1034 /* Cancel a waitable timer */
1035 struct cancel_timer_request
1037 IN int handle; /* handle to the timer */
1041 /* Retrieve the current context of a thread */
1042 struct get_thread_context_request
1044 IN int handle; /* thread handle */
1045 IN unsigned int flags; /* context flags */
1046 OUT CONTEXT context; /* thread context */
1050 /* Set the current context of a thread */
1051 struct set_thread_context_request
1053 IN int handle; /* thread handle */
1054 IN unsigned int flags; /* context flags */
1055 IN CONTEXT context; /* thread context */
1059 /* Fetch a selector entry for a thread */
1060 struct get_selector_entry_request
1062 IN int handle; /* thread handle */
1063 IN int entry; /* LDT entry */
1064 OUT unsigned int base; /* selector base */
1065 OUT unsigned int limit; /* selector limit */
1066 OUT unsigned char flags; /* selector flags */
1070 /* Add a global atom */
1071 struct add_atom_request
1073 OUT int atom; /* resulting atom */
1074 IN WCHAR name[1]; /* atom name */
1078 /* Delete a global atom */
1079 struct delete_atom_request
1081 IN int atom; /* atom handle */
1085 /* Find a global atom */
1086 struct find_atom_request
1088 OUT int atom; /* atom handle */
1089 IN WCHAR name[1]; /* atom name */
1093 /* Get a global atom name */
1094 struct get_atom_name_request
1096 IN int atom; /* atom handle */
1097 OUT int count; /* atom lock count */
1098 OUT WCHAR name[1]; /* atom name */
1101 /* Everything below this line is generated automatically by tools/make_requests */
1102 /* ### make_requests begin ### */
1104 enum request
1106 REQ_NEW_PROCESS,
1107 REQ_NEW_THREAD,
1108 REQ_BOOT_DONE,
1109 REQ_INIT_PROCESS,
1110 REQ_INIT_PROCESS_DONE,
1111 REQ_INIT_THREAD,
1112 REQ_GET_THREAD_BUFFER,
1113 REQ_TERMINATE_PROCESS,
1114 REQ_TERMINATE_THREAD,
1115 REQ_GET_PROCESS_INFO,
1116 REQ_SET_PROCESS_INFO,
1117 REQ_GET_THREAD_INFO,
1118 REQ_SET_THREAD_INFO,
1119 REQ_SUSPEND_THREAD,
1120 REQ_RESUME_THREAD,
1121 REQ_LOAD_DLL,
1122 REQ_UNLOAD_DLL,
1123 REQ_QUEUE_APC,
1124 REQ_GET_APCS,
1125 REQ_CLOSE_HANDLE,
1126 REQ_GET_HANDLE_INFO,
1127 REQ_SET_HANDLE_INFO,
1128 REQ_DUP_HANDLE,
1129 REQ_OPEN_PROCESS,
1130 REQ_SELECT,
1131 REQ_CREATE_EVENT,
1132 REQ_EVENT_OP,
1133 REQ_OPEN_EVENT,
1134 REQ_CREATE_MUTEX,
1135 REQ_RELEASE_MUTEX,
1136 REQ_OPEN_MUTEX,
1137 REQ_CREATE_SEMAPHORE,
1138 REQ_RELEASE_SEMAPHORE,
1139 REQ_OPEN_SEMAPHORE,
1140 REQ_CREATE_FILE,
1141 REQ_ALLOC_FILE_HANDLE,
1142 REQ_GET_READ_FD,
1143 REQ_GET_WRITE_FD,
1144 REQ_SET_FILE_POINTER,
1145 REQ_TRUNCATE_FILE,
1146 REQ_SET_FILE_TIME,
1147 REQ_FLUSH_FILE,
1148 REQ_GET_FILE_INFO,
1149 REQ_LOCK_FILE,
1150 REQ_UNLOCK_FILE,
1151 REQ_CREATE_PIPE,
1152 REQ_CREATE_SOCKET,
1153 REQ_ACCEPT_SOCKET,
1154 REQ_SET_SOCKET_EVENT,
1155 REQ_GET_SOCKET_EVENT,
1156 REQ_ENABLE_SOCKET_EVENT,
1157 REQ_ALLOC_CONSOLE,
1158 REQ_FREE_CONSOLE,
1159 REQ_OPEN_CONSOLE,
1160 REQ_SET_CONSOLE_FD,
1161 REQ_GET_CONSOLE_MODE,
1162 REQ_SET_CONSOLE_MODE,
1163 REQ_SET_CONSOLE_INFO,
1164 REQ_GET_CONSOLE_INFO,
1165 REQ_WRITE_CONSOLE_INPUT,
1166 REQ_READ_CONSOLE_INPUT,
1167 REQ_CREATE_CHANGE_NOTIFICATION,
1168 REQ_CREATE_MAPPING,
1169 REQ_OPEN_MAPPING,
1170 REQ_GET_MAPPING_INFO,
1171 REQ_CREATE_DEVICE,
1172 REQ_CREATE_SNAPSHOT,
1173 REQ_NEXT_PROCESS,
1174 REQ_WAIT_DEBUG_EVENT,
1175 REQ_EXCEPTION_EVENT,
1176 REQ_OUTPUT_DEBUG_STRING,
1177 REQ_CONTINUE_DEBUG_EVENT,
1178 REQ_DEBUG_PROCESS,
1179 REQ_READ_PROCESS_MEMORY,
1180 REQ_WRITE_PROCESS_MEMORY,
1181 REQ_CREATE_KEY,
1182 REQ_OPEN_KEY,
1183 REQ_DELETE_KEY,
1184 REQ_CLOSE_KEY,
1185 REQ_ENUM_KEY,
1186 REQ_QUERY_KEY_INFO,
1187 REQ_SET_KEY_VALUE,
1188 REQ_GET_KEY_VALUE,
1189 REQ_ENUM_KEY_VALUE,
1190 REQ_DELETE_KEY_VALUE,
1191 REQ_LOAD_REGISTRY,
1192 REQ_SAVE_REGISTRY,
1193 REQ_SET_REGISTRY_LEVELS,
1194 REQ_CREATE_TIMER,
1195 REQ_OPEN_TIMER,
1196 REQ_SET_TIMER,
1197 REQ_CANCEL_TIMER,
1198 REQ_GET_THREAD_CONTEXT,
1199 REQ_SET_THREAD_CONTEXT,
1200 REQ_GET_SELECTOR_ENTRY,
1201 REQ_ADD_ATOM,
1202 REQ_DELETE_ATOM,
1203 REQ_FIND_ATOM,
1204 REQ_GET_ATOM_NAME,
1205 REQ_NB_REQUESTS
1208 #define SERVER_PROTOCOL_VERSION 4
1210 /* ### make_requests end ### */
1211 /* Everything above this line is generated automatically by tools/make_requests */
1214 /* client-side functions */
1216 #ifndef __WINE_SERVER__
1218 #include "thread.h"
1219 #include "ntddk.h"
1221 /* client communication functions */
1223 extern unsigned int server_call_noerr( enum request req );
1224 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1225 extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
1227 /* get a pointer to the request buffer */
1228 static inline void * WINE_UNUSED get_req_buffer(void)
1230 return NtCurrentTeb()->buffer;
1233 /* maximum remaining size in the server buffer */
1234 static inline int WINE_UNUSED server_remaining( const void *ptr )
1236 return (char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size - (char *)ptr;
1239 /* do a server call and set the last error code */
1240 static inline int server_call( enum request req )
1242 unsigned int res = server_call_noerr( req );
1243 if (res) SetLastError( RtlNtStatusToDosError(res) );
1244 return res;
1247 /* copy a Unicode string to the server buffer */
1248 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1250 if (src)
1252 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1253 while ((dst < end) && *src) *dst++ = *src++;
1255 *dst = 0;
1258 /* copy and convert an ASCII string to the server buffer */
1259 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1261 if (src)
1263 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1264 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1266 *dst = 0;
1269 extern int CLIENT_InitServer(void);
1270 extern int CLIENT_BootDone( int debug_level );
1271 extern int CLIENT_IsBootThread(void);
1272 extern int CLIENT_InitThread(void);
1273 #endif /* __WINE_SERVER__ */
1275 #endif /* __WINE_SERVER_H */