Running object table are not using 0 as a valid index anymore.
[wine.git] / include / server.h
blobff40699a8adf3542a98700f4ed748c9db8596d39
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 int code; /* exception code */
35 int flags; /* exception flags */
36 void *record; /* exception record ptr */
37 void *addr; /* exception address */
38 int nb_params; /* exceptions parameters */
39 int params[15];
40 int first_chance; /* first chance to handle it? */
41 CONTEXT context; /* thread context */
43 struct debug_event_create_thread
45 int handle; /* handle to the new thread */
46 void *teb; /* thread teb (in debugged process address space) */
47 void *start; /* thread startup routine */
49 struct debug_event_create_process
51 int file; /* handle to the process exe file */
52 int process; /* handle to the new process */
53 int thread; /* handle to the new thread */
54 void *base; /* base of executable image */
55 int dbg_offset; /* offset of debug info in file */
56 int dbg_size; /* size of debug info */
57 void *teb; /* thread teb (in debugged process address space) */
58 void *start; /* thread startup routine */
59 void *name; /* image name (optional) */
60 int unicode; /* is it Unicode? */
62 struct debug_event_exit
64 int exit_code; /* thread or process exit code */
66 struct debug_event_load_dll
68 int handle; /* file handle for the dll */
69 void *base; /* base address of the dll */
70 int dbg_offset; /* offset of debug info in file */
71 int dbg_size; /* size of debug info */
72 void *name; /* image name (optional) */
73 int unicode; /* is it Unicode? */
75 struct debug_event_unload_dll
77 void *base; /* base address of the dll */
79 struct debug_event_output_string
81 void *string; /* string to display (in debugged process address space) */
82 int unicode; /* is it Unicode? */
83 int length; /* string length */
85 struct debug_event_rip_info
87 int error; /* ??? */
88 int type; /* ??? */
90 union debug_event_data
92 struct debug_event_exception exception;
93 struct debug_event_create_thread create_thread;
94 struct debug_event_create_process create_process;
95 struct debug_event_exit exit;
96 struct debug_event_load_dll load_dll;
97 struct debug_event_unload_dll unload_dll;
98 struct debug_event_output_string output_string;
99 struct debug_event_rip_info rip_info;
102 /* debug event data */
103 typedef struct
105 int code; /* event code */
106 union debug_event_data info; /* event information */
107 } debug_event_t;
110 /* Create a new process from the context of the parent */
111 struct new_process_request
113 IN int inherit; /* inherit flag */
114 IN int inherit_all; /* inherit all handles from parent */
115 IN int create_flags; /* creation flags */
116 IN int start_flags; /* flags from startup info */
117 IN int hstdin; /* handle for stdin */
118 IN int hstdout; /* handle for stdout */
119 IN int hstderr; /* handle for stderr */
120 IN int event; /* event to signal startup */
121 IN int cmd_show; /* main window show mode */
122 IN void* env_ptr; /* pointer to environment (FIXME: hack) */
123 OUT void* pid; /* process id */
124 OUT int phandle; /* process handle (in the current process) */
125 OUT void* tid; /* thread id */
126 OUT int thandle; /* thread handle (in the current process) */
127 IN char cmdline[1]; /* command line */
131 /* Create a new thread from the context of the parent */
132 struct new_thread_request
134 IN int suspend; /* new thread should be suspended on creation */
135 IN int inherit; /* inherit flag */
136 OUT void* tid; /* thread id */
137 OUT int handle; /* thread handle (in the current process) */
141 /* Signal that we are finished booting on the client side */
142 struct boot_done_request
144 IN int debug_level; /* new debug level */
148 /* Initialize a process; called from the new process context */
149 struct init_process_request
151 IN void* ldt_copy; /* addr of LDT copy */
152 IN void* ldt_flags; /* addr of LDT flags */
153 OUT int start_flags; /* flags from startup info */
154 OUT int hstdin; /* handle for stdin */
155 OUT int hstdout; /* handle for stdout */
156 OUT int hstderr; /* handle for stderr */
157 OUT int cmd_show; /* main window show mode */
158 OUT void* env_ptr; /* pointer to environment (FIXME: hack) */
159 OUT char cmdline[1]; /* command line */
163 /* Signal the end of the process initialization */
164 struct init_process_done_request
166 IN int dummy;
170 /* Initialize a thread; called from the child after fork()/clone() */
171 struct init_thread_request
173 IN int unix_pid; /* Unix pid of new thread */
174 IN void* teb; /* TEB of new thread (in thread address space) */
175 OUT void* pid; /* process id of the new thread's process */
176 OUT void* tid; /* thread id of the new thread */
177 OUT int boot; /* is this the boot thread? */
181 /* Retrieve the thread buffer file descriptor */
182 /* The reply to this request is the first thing a newly */
183 /* created thread gets (without having to request it) */
184 struct get_thread_buffer_request
186 IN int dummy;
190 /* Terminate a process */
191 struct terminate_process_request
193 IN int handle; /* process handle to terminate */
194 IN int exit_code; /* process exit code */
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 */
206 /* Retrieve information about a process */
207 struct get_process_info_request
209 IN int handle; /* process handle */
210 OUT void* pid; /* server process id */
211 OUT int exit_code; /* process exit code */
212 OUT int priority; /* priority class */
213 OUT int process_affinity; /* process affinity mask */
214 OUT int system_affinity; /* system affinity mask */
218 /* Set a process informations */
219 struct set_process_info_request
221 IN int handle; /* process handle */
222 IN int mask; /* setting mask (see below) */
223 IN int priority; /* priority class */
224 IN int affinity; /* affinity mask */
226 #define SET_PROCESS_INFO_PRIORITY 0x01
227 #define SET_PROCESS_INFO_AFFINITY 0x02
230 /* Retrieve information about a thread */
231 struct get_thread_info_request
233 IN int handle; /* thread handle */
234 OUT void* tid; /* server thread id */
235 OUT int exit_code; /* thread exit code */
236 OUT int priority; /* thread priority level */
240 /* Set a thread informations */
241 struct set_thread_info_request
243 IN int handle; /* thread handle */
244 IN int mask; /* setting mask (see below) */
245 IN int priority; /* priority class */
246 IN int affinity; /* affinity mask */
248 #define SET_THREAD_INFO_PRIORITY 0x01
249 #define SET_THREAD_INFO_AFFINITY 0x02
252 /* Suspend a thread */
253 struct suspend_thread_request
255 IN int handle; /* thread handle */
256 OUT int count; /* new suspend count */
260 /* Resume a thread */
261 struct resume_thread_request
263 IN int handle; /* thread handle */
264 OUT int count; /* new suspend count */
268 /* Debugger support: freeze / unfreeze */
269 struct debugger_request
271 IN int op; /* operation type */
274 enum debugger_op { DEBUGGER_FREEZE_ALL, DEBUGGER_UNFREEZE_ALL };
277 /* Queue an APC for a thread */
278 struct queue_apc_request
280 IN int handle; /* thread handle */
281 IN void* func; /* function to call */
282 IN void* param; /* param for function to call */
286 /* Get list of APC to call */
287 struct get_apcs_request
289 OUT int count; /* number of apcs */
290 OUT void* apcs[1]; /* async procedures to call */
294 /* Close a handle for the current process */
295 struct close_handle_request
297 IN int handle; /* handle to close */
301 /* Get information about a handle */
302 struct get_handle_info_request
304 IN int handle; /* handle we are interested in */
305 OUT int flags; /* handle flags */
309 /* Set a handle information */
310 struct set_handle_info_request
312 IN int handle; /* handle we are interested in */
313 IN int flags; /* new handle flags */
314 IN int mask; /* mask for flags to set */
318 /* Duplicate a handle */
319 struct dup_handle_request
321 IN int src_process; /* src process handle */
322 IN int src_handle; /* src handle to duplicate */
323 IN int dst_process; /* dst process handle */
324 IN unsigned int access; /* wanted access rights */
325 IN int inherit; /* inherit flag */
326 IN int options; /* duplicate options (see below) */
327 OUT int handle; /* duplicated handle in dst process */
329 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
330 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
331 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
334 /* Open a handle to a process */
335 struct open_process_request
337 IN void* pid; /* process id to open */
338 IN unsigned int access; /* wanted access rights */
339 IN int inherit; /* inherit flag */
340 OUT int handle; /* handle to the process */
344 /* Wait for handles */
345 struct select_request
347 IN int count; /* handles count */
348 IN int flags; /* wait flags (see below) */
349 IN int timeout; /* timeout in ms */
350 OUT int signaled; /* signaled handle */
351 IN int handles[1]; /* handles to select on */
353 #define SELECT_ALL 1
354 #define SELECT_ALERTABLE 2
355 #define SELECT_TIMEOUT 4
358 /* Create an event */
359 struct create_event_request
361 IN int manual_reset; /* manual reset event */
362 IN int initial_state; /* initial state of the event */
363 IN int inherit; /* inherit flag */
364 OUT int handle; /* handle to the event */
365 IN WCHAR name[1]; /* event name */
368 /* Event operation */
369 struct event_op_request
371 IN int handle; /* handle to event */
372 IN int op; /* event operation (see below) */
374 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
377 /* Open an event */
378 struct open_event_request
380 IN unsigned int access; /* wanted access rights */
381 IN int inherit; /* inherit flag */
382 OUT int handle; /* handle to the event */
383 IN WCHAR name[1]; /* object name */
387 /* Create a mutex */
388 struct create_mutex_request
390 IN int owned; /* initially owned? */
391 IN int inherit; /* inherit flag */
392 OUT int handle; /* handle to the mutex */
393 IN WCHAR name[1]; /* mutex name */
397 /* Release a mutex */
398 struct release_mutex_request
400 IN int handle; /* handle to the mutex */
404 /* Open a mutex */
405 struct open_mutex_request
407 IN unsigned int access; /* wanted access rights */
408 IN int inherit; /* inherit flag */
409 OUT int handle; /* handle to the mutex */
410 IN WCHAR name[1]; /* object name */
414 /* Create a semaphore */
415 struct create_semaphore_request
417 IN unsigned int initial; /* initial count */
418 IN unsigned int max; /* maximum count */
419 IN int inherit; /* inherit flag */
420 OUT int handle; /* handle to the semaphore */
421 IN WCHAR name[1]; /* semaphore name */
425 /* Release a semaphore */
426 struct release_semaphore_request
428 IN int handle; /* handle to the semaphore */
429 IN unsigned int count; /* count to add to semaphore */
430 OUT unsigned int prev_count; /* previous semaphore count */
434 /* Open a semaphore */
435 struct open_semaphore_request
437 IN unsigned int access; /* wanted access rights */
438 IN int inherit; /* inherit flag */
439 OUT int handle; /* handle to the semaphore */
440 IN WCHAR name[1]; /* object name */
444 /* Create a file */
445 struct create_file_request
447 IN unsigned int access; /* wanted access rights */
448 IN int inherit; /* inherit flag */
449 IN unsigned int sharing; /* sharing flags */
450 IN int create; /* file create action */
451 IN unsigned int attrs; /* file attributes for creation */
452 OUT int handle; /* handle to the file */
453 IN char name[1]; /* file name */
457 /* Allocate a file handle for a Unix fd */
458 struct alloc_file_handle_request
460 IN unsigned int access; /* wanted access rights */
461 OUT int handle; /* handle to the file */
465 /* Get a Unix fd to read from a file */
466 struct get_read_fd_request
468 IN int handle; /* handle to the file */
472 /* Get a Unix fd to write to a file */
473 struct get_write_fd_request
475 IN int handle; /* handle to the file */
479 /* Set a file current position */
480 struct set_file_pointer_request
482 IN int handle; /* handle to the file */
483 IN int low; /* position low word */
484 IN int high; /* position high word */
485 IN int whence; /* whence to seek */
486 OUT int new_low; /* new position low word */
487 OUT int new_high; /* new position high word */
491 /* Truncate (or extend) a file */
492 struct truncate_file_request
494 IN int handle; /* handle to the file */
498 /* Set a file access and modification times */
499 struct set_file_time_request
501 IN int handle; /* handle to the file */
502 IN time_t access_time; /* last access time */
503 IN time_t write_time; /* last write time */
507 /* Flush a file buffers */
508 struct flush_file_request
510 IN int handle; /* handle to the file */
514 /* Get information about a file */
515 struct get_file_info_request
517 IN int handle; /* handle to the file */
518 OUT int type; /* file type */
519 OUT int attr; /* file attributes */
520 OUT time_t access_time; /* last access time */
521 OUT time_t write_time; /* last write time */
522 OUT int size_high; /* file size */
523 OUT int size_low; /* file size */
524 OUT int links; /* number of links */
525 OUT int index_high; /* unique index */
526 OUT int index_low; /* unique index */
527 OUT unsigned int serial; /* volume serial number */
531 /* Lock a region of a file */
532 struct lock_file_request
534 IN int handle; /* handle to the file */
535 IN unsigned int offset_low; /* offset of start of lock */
536 IN unsigned int offset_high; /* offset of start of lock */
537 IN unsigned int count_low; /* count of bytes to lock */
538 IN unsigned int count_high; /* count of bytes to lock */
542 /* Unlock a region of a file */
543 struct unlock_file_request
545 IN int handle; /* handle to the file */
546 IN unsigned int offset_low; /* offset of start of unlock */
547 IN unsigned int offset_high; /* offset of start of unlock */
548 IN unsigned int count_low; /* count of bytes to unlock */
549 IN unsigned int count_high; /* count of bytes to unlock */
553 /* Create an anonymous pipe */
554 struct create_pipe_request
556 IN int inherit; /* inherit flag */
557 OUT int handle_read; /* handle to the read-side of the pipe */
558 OUT int handle_write; /* handle to the write-side of the pipe */
562 /* Create a socket */
563 struct create_socket_request
565 IN unsigned int access; /* wanted access rights */
566 IN int inherit; /* inherit flag */
567 IN int family; /* family, see socket manpage */
568 IN int type; /* type, see socket manpage */
569 IN int protocol; /* protocol, see socket manpage */
570 OUT int handle; /* handle to the new socket */
574 /* Accept a socket */
575 struct accept_socket_request
577 IN int lhandle; /* handle to the listening socket */
578 IN unsigned int access; /* wanted access rights */
579 IN int inherit; /* inherit flag */
580 OUT int handle; /* handle to the new socket */
584 /* Set socket event parameters */
585 struct set_socket_event_request
587 IN int handle; /* handle to the socket */
588 IN unsigned int mask; /* event mask */
589 IN int event; /* event object */
593 /* Get socket event parameters */
594 struct get_socket_event_request
596 IN int handle; /* handle to the socket */
597 IN int service; /* clear pending? */
598 IN int s_event; /* "expected" event object */
599 OUT unsigned int mask; /* event mask */
600 OUT unsigned int pmask; /* pending events */
601 OUT unsigned int state; /* status bits */
602 OUT int errors[1]; /* event errors */
606 /* Reenable pending socket events */
607 struct enable_socket_event_request
609 IN int handle; /* handle to the socket */
610 IN unsigned int mask; /* events to re-enable */
611 IN unsigned int sstate; /* status bits to set */
612 IN unsigned int cstate; /* status bits to clear */
616 /* Allocate a console for the current process */
617 struct alloc_console_request
619 IN unsigned int access; /* wanted access rights */
620 IN int inherit; /* inherit flag */
621 OUT int handle_in; /* handle to console input */
622 OUT int handle_out; /* handle to console output */
626 /* Free the console of the current process */
627 struct free_console_request
629 IN int dummy;
633 /* Open a handle to the process console */
634 struct open_console_request
636 IN int output; /* input or output? */
637 IN unsigned int access; /* wanted access rights */
638 IN int inherit; /* inherit flag */
639 OUT int handle; /* handle to the console */
643 /* Set a console file descriptor */
644 struct set_console_fd_request
646 IN int handle; /* handle to the console */
647 IN int file_handle; /* handle of file to use as file descriptor */
648 IN int pid; /* pid of xterm (hack) */
652 /* Get a console mode (input or output) */
653 struct get_console_mode_request
655 IN int handle; /* handle to the console */
656 OUT int mode; /* console mode */
660 /* Set a console mode (input or output) */
661 struct set_console_mode_request
663 IN int handle; /* handle to the console */
664 IN int mode; /* console mode */
668 /* Set info about a console (output only) */
669 struct set_console_info_request
671 IN int handle; /* handle to the console */
672 IN int mask; /* setting mask (see below) */
673 IN int cursor_size; /* size of cursor (percentage filled) */
674 IN int cursor_visible;/* cursor visibility flag */
675 IN char title[1]; /* console title */
677 #define SET_CONSOLE_INFO_CURSOR 0x01
678 #define SET_CONSOLE_INFO_TITLE 0x02
680 /* Get info about a console (output only) */
681 struct get_console_info_request
683 IN int handle; /* handle to the console */
684 OUT int cursor_size; /* size of cursor (percentage filled) */
685 OUT int cursor_visible;/* cursor visibility flag */
686 OUT int pid; /* pid of xterm (hack) */
687 OUT char title[1]; /* console title */
691 /* Add input records to a console input queue */
692 struct write_console_input_request
694 IN int handle; /* handle to the console input */
695 IN int count; /* number of input records */
696 OUT int written; /* number of records written */
697 /* INPUT_RECORD records[0]; */ /* input records */
700 /* Fetch input records from a console input queue */
701 struct read_console_input_request
703 IN int handle; /* handle to the console input */
704 IN int count; /* max number of records to retrieve */
705 IN int flush; /* flush the retrieved records from the queue? */
706 OUT int read; /* number of records read */
707 /* INPUT_RECORD records[0]; */ /* input records */
711 /* Create a change notification */
712 struct create_change_notification_request
714 IN int subtree; /* watch all the subtree */
715 IN int filter; /* notification filter */
716 OUT int handle; /* handle to the change notification */
720 /* Create a file mapping */
721 struct create_mapping_request
723 IN int size_high; /* mapping size */
724 IN int size_low; /* mapping size */
725 IN int protect; /* protection flags (see below) */
726 IN int inherit; /* inherit flag */
727 IN int file_handle; /* file handle */
728 OUT int handle; /* handle to the mapping */
729 IN WCHAR name[1]; /* object name */
731 /* protection flags */
732 #define VPROT_READ 0x01
733 #define VPROT_WRITE 0x02
734 #define VPROT_EXEC 0x04
735 #define VPROT_WRITECOPY 0x08
736 #define VPROT_GUARD 0x10
737 #define VPROT_NOCACHE 0x20
738 #define VPROT_COMMITTED 0x40
741 /* Open a mapping */
742 struct open_mapping_request
744 IN unsigned int access; /* wanted access rights */
745 IN int inherit; /* inherit flag */
746 OUT int handle; /* handle to the mapping */
747 IN WCHAR name[1]; /* object name */
751 /* Get information about a file mapping */
752 struct get_mapping_info_request
754 IN int handle; /* handle to the mapping */
755 OUT int size_high; /* mapping size */
756 OUT int size_low; /* mapping size */
757 OUT int protect; /* protection flags */
761 /* Create a device */
762 struct create_device_request
764 IN unsigned int access; /* wanted access rights */
765 IN int inherit; /* inherit flag */
766 IN int id; /* client private id */
767 OUT int handle; /* handle to the device */
771 /* Create a snapshot */
772 struct create_snapshot_request
774 IN int inherit; /* inherit flag */
775 IN int flags; /* snapshot flags (TH32CS_*) */
776 OUT int handle; /* handle to the snapshot */
780 /* Get the next process from a snapshot */
781 struct next_process_request
783 IN int handle; /* handle to the snapshot */
784 IN int reset; /* reset snapshot position? */
785 OUT void* pid; /* process id */
786 OUT int threads; /* number of threads */
787 OUT int priority; /* process priority */
791 /* Wait for a debug event */
792 struct wait_debug_event_request
794 IN int timeout; /* timeout in ms */
795 OUT void* pid; /* process id */
796 OUT void* tid; /* thread id */
797 OUT debug_event_t event; /* debug event data */
801 /* Send a debug event */
802 struct send_debug_event_request
804 OUT int status; /* event continuation status */
805 IN debug_event_t event; /* debug event data */
809 /* Continue a debug event */
810 struct continue_debug_event_request
812 IN void* pid; /* process id to continue */
813 IN void* tid; /* thread id to continue */
814 IN int status; /* continuation status */
818 /* Start debugging an existing process */
819 struct debug_process_request
821 IN void* pid; /* id of the process to debug */
825 /* Read data from a process address space */
826 struct read_process_memory_request
828 IN int handle; /* process handle */
829 IN void* addr; /* addr to read from (must be int-aligned) */
830 IN int len; /* number of ints to read */
831 OUT unsigned int data[1]; /* result data */
835 /* Write data to a process address space */
836 struct write_process_memory_request
838 IN int handle; /* process handle */
839 IN void* addr; /* addr to write to (must be int-aligned) */
840 IN int len; /* number of ints to write */
841 IN unsigned int first_mask; /* mask for first word */
842 IN unsigned int last_mask; /* mask for last word */
843 IN unsigned int data[1]; /* data to write */
847 /* Create a registry key */
848 struct create_key_request
850 IN int parent; /* handle to the parent key */
851 IN unsigned int access; /* desired access rights */
852 IN unsigned int options; /* creation options */
853 IN time_t modif; /* last modification time */
854 OUT int hkey; /* handle to the created key */
855 OUT int created; /* has it been newly created? */
856 IN path_t name; /* key name */
857 IN WCHAR class[1]; /* class name */
861 /* Open a registry key */
862 struct open_key_request
864 IN int parent; /* handle to the parent key */
865 IN unsigned int access; /* desired access rights */
866 OUT int hkey; /* handle to the open key */
867 IN path_t name; /* key name */
871 /* Delete a registry key */
872 struct delete_key_request
874 IN int hkey; /* handle to the parent key */
875 IN path_t name; /* key name */
879 /* Close a registry key */
880 struct close_key_request
882 IN int hkey; /* key to close */
886 /* Enumerate registry subkeys */
887 struct enum_key_request
889 IN int hkey; /* handle to registry key */
890 IN int index; /* index of subkey */
891 OUT time_t modif; /* last modification time */
892 OUT path_t name; /* subkey name */
893 OUT WCHAR class[1]; /* class name */
897 /* Query information about a registry key */
898 struct query_key_info_request
900 IN int hkey; /* handle to registry key */
901 OUT int subkeys; /* number of subkeys */
902 OUT int max_subkey; /* longest subkey name */
903 OUT int max_class; /* longest class name */
904 OUT int values; /* number of values */
905 OUT int max_value; /* longest value name */
906 OUT int max_data; /* longest value data */
907 OUT time_t modif; /* last modification time */
908 OUT path_t name; /* key name */
909 OUT WCHAR class[1]; /* class name */
913 /* Set a value of a registry key */
914 struct set_key_value_request
916 IN int hkey; /* handle to registry key */
917 IN int type; /* value type */
918 IN int len; /* value data len */
919 IN path_t name; /* value name */
920 IN unsigned char data[1]; /* value data */
924 /* Retrieve the value of a registry key */
925 struct get_key_value_request
927 IN int hkey; /* handle to registry key */
928 OUT int type; /* value type */
929 OUT int len; /* value data len */
930 IN WCHAR name[1]; /* value name */
931 OUT unsigned char data[1]; /* value data */
935 /* Enumerate a value of a registry key */
936 struct enum_key_value_request
938 IN int hkey; /* handle to registry key */
939 IN int index; /* value index */
940 OUT int type; /* value type */
941 OUT int len; /* value data len */
942 OUT path_t name; /* value name */
943 OUT unsigned char data[1]; /* value data */
947 /* Delete a value of a registry key */
948 struct delete_key_value_request
950 IN int hkey; /* handle to registry key */
951 IN path_t name; /* value name */
955 /* Load a registry branch from a file */
956 struct load_registry_request
958 IN int hkey; /* root key to load to */
959 IN int file; /* file to load from */
960 IN path_t name; /* subkey name */
964 /* Save a registry branch to a file */
965 struct save_registry_request
967 IN int hkey; /* key to save */
968 IN int file; /* file to save to */
972 /* Set the current and saving level for the registry */
973 struct set_registry_levels_request
975 IN int current; /* new current level */
976 IN int saving; /* new saving level */
977 IN int version; /* file format version for saving */
981 /* Create a waitable timer */
982 struct create_timer_request
984 IN int inherit; /* inherit flag */
985 IN int manual; /* manual reset */
986 OUT int handle; /* handle to the timer */
987 IN WCHAR name[1]; /* timer name */
991 /* Open a waitable timer */
992 struct open_timer_request
994 IN unsigned int access; /* wanted access rights */
995 IN int inherit; /* inherit flag */
996 OUT int handle; /* handle to the timer */
997 IN WCHAR name[1]; /* timer name */
1000 /* Set a waitable timer */
1001 struct set_timer_request
1003 IN int handle; /* handle to the timer */
1004 IN int sec; /* next expiration absolute time */
1005 IN int usec; /* next expiration absolute time */
1006 IN int period; /* timer period in ms */
1007 IN void* callback; /* callback function */
1008 IN void* arg; /* callback argument */
1011 /* Cancel a waitable timer */
1012 struct cancel_timer_request
1014 IN int handle; /* handle to the timer */
1018 /* Retrieve the current context of a thread */
1019 struct get_thread_context_request
1021 IN int handle; /* thread handle */
1022 IN unsigned int flags; /* context flags */
1023 OUT CONTEXT context; /* thread context */
1027 /* Set the current context of a thread */
1028 struct set_thread_context_request
1030 IN int handle; /* thread handle */
1031 IN unsigned int flags; /* context flags */
1032 IN CONTEXT context; /* thread context */
1036 /* Fetch a selector entry for a thread */
1037 struct get_selector_entry_request
1039 IN int handle; /* thread handle */
1040 IN int entry; /* LDT entry */
1041 OUT unsigned int base; /* selector base */
1042 OUT unsigned int limit; /* selector limit */
1043 OUT unsigned char flags; /* selector flags */
1047 /* Everything below this line is generated automatically by tools/make_requests */
1048 /* ### make_requests begin ### */
1050 enum request
1052 REQ_NEW_PROCESS,
1053 REQ_NEW_THREAD,
1054 REQ_BOOT_DONE,
1055 REQ_INIT_PROCESS,
1056 REQ_INIT_PROCESS_DONE,
1057 REQ_INIT_THREAD,
1058 REQ_GET_THREAD_BUFFER,
1059 REQ_TERMINATE_PROCESS,
1060 REQ_TERMINATE_THREAD,
1061 REQ_GET_PROCESS_INFO,
1062 REQ_SET_PROCESS_INFO,
1063 REQ_GET_THREAD_INFO,
1064 REQ_SET_THREAD_INFO,
1065 REQ_SUSPEND_THREAD,
1066 REQ_RESUME_THREAD,
1067 REQ_DEBUGGER,
1068 REQ_QUEUE_APC,
1069 REQ_GET_APCS,
1070 REQ_CLOSE_HANDLE,
1071 REQ_GET_HANDLE_INFO,
1072 REQ_SET_HANDLE_INFO,
1073 REQ_DUP_HANDLE,
1074 REQ_OPEN_PROCESS,
1075 REQ_SELECT,
1076 REQ_CREATE_EVENT,
1077 REQ_EVENT_OP,
1078 REQ_OPEN_EVENT,
1079 REQ_CREATE_MUTEX,
1080 REQ_RELEASE_MUTEX,
1081 REQ_OPEN_MUTEX,
1082 REQ_CREATE_SEMAPHORE,
1083 REQ_RELEASE_SEMAPHORE,
1084 REQ_OPEN_SEMAPHORE,
1085 REQ_CREATE_FILE,
1086 REQ_ALLOC_FILE_HANDLE,
1087 REQ_GET_READ_FD,
1088 REQ_GET_WRITE_FD,
1089 REQ_SET_FILE_POINTER,
1090 REQ_TRUNCATE_FILE,
1091 REQ_SET_FILE_TIME,
1092 REQ_FLUSH_FILE,
1093 REQ_GET_FILE_INFO,
1094 REQ_LOCK_FILE,
1095 REQ_UNLOCK_FILE,
1096 REQ_CREATE_PIPE,
1097 REQ_CREATE_SOCKET,
1098 REQ_ACCEPT_SOCKET,
1099 REQ_SET_SOCKET_EVENT,
1100 REQ_GET_SOCKET_EVENT,
1101 REQ_ENABLE_SOCKET_EVENT,
1102 REQ_ALLOC_CONSOLE,
1103 REQ_FREE_CONSOLE,
1104 REQ_OPEN_CONSOLE,
1105 REQ_SET_CONSOLE_FD,
1106 REQ_GET_CONSOLE_MODE,
1107 REQ_SET_CONSOLE_MODE,
1108 REQ_SET_CONSOLE_INFO,
1109 REQ_GET_CONSOLE_INFO,
1110 REQ_WRITE_CONSOLE_INPUT,
1111 REQ_READ_CONSOLE_INPUT,
1112 REQ_CREATE_CHANGE_NOTIFICATION,
1113 REQ_CREATE_MAPPING,
1114 REQ_OPEN_MAPPING,
1115 REQ_GET_MAPPING_INFO,
1116 REQ_CREATE_DEVICE,
1117 REQ_CREATE_SNAPSHOT,
1118 REQ_NEXT_PROCESS,
1119 REQ_WAIT_DEBUG_EVENT,
1120 REQ_SEND_DEBUG_EVENT,
1121 REQ_CONTINUE_DEBUG_EVENT,
1122 REQ_DEBUG_PROCESS,
1123 REQ_READ_PROCESS_MEMORY,
1124 REQ_WRITE_PROCESS_MEMORY,
1125 REQ_CREATE_KEY,
1126 REQ_OPEN_KEY,
1127 REQ_DELETE_KEY,
1128 REQ_CLOSE_KEY,
1129 REQ_ENUM_KEY,
1130 REQ_QUERY_KEY_INFO,
1131 REQ_SET_KEY_VALUE,
1132 REQ_GET_KEY_VALUE,
1133 REQ_ENUM_KEY_VALUE,
1134 REQ_DELETE_KEY_VALUE,
1135 REQ_LOAD_REGISTRY,
1136 REQ_SAVE_REGISTRY,
1137 REQ_SET_REGISTRY_LEVELS,
1138 REQ_CREATE_TIMER,
1139 REQ_OPEN_TIMER,
1140 REQ_SET_TIMER,
1141 REQ_CANCEL_TIMER,
1142 REQ_GET_THREAD_CONTEXT,
1143 REQ_SET_THREAD_CONTEXT,
1144 REQ_GET_SELECTOR_ENTRY,
1145 REQ_NB_REQUESTS
1148 /* ### make_requests end ### */
1149 /* Everything above this line is generated automatically by tools/make_requests */
1152 /* client-side functions */
1154 #ifndef __WINE_SERVER__
1156 #include "thread.h"
1157 #include "ntddk.h"
1159 /* client communication functions */
1161 extern unsigned int server_call_noerr( enum request req );
1162 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1163 extern void server_protocol_error( const char *err, ... );
1165 /* get a pointer to the request buffer */
1166 static inline void * WINE_UNUSED get_req_buffer(void)
1168 return NtCurrentTeb()->buffer;
1171 /* maximum remaining size in the server buffer */
1172 static inline int WINE_UNUSED server_remaining( const void *ptr )
1174 return (char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size - (char *)ptr;
1177 /* do a server call and set the last error code */
1178 static inline int server_call( enum request req )
1180 unsigned int res = server_call_noerr( req );
1181 if (res) SetLastError( RtlNtStatusToDosError(res) );
1182 return res;
1185 /* copy a Unicode string to the server buffer */
1186 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1188 if (src)
1190 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1191 while ((dst < end) && *src) *dst++ = *src++;
1193 *dst = 0;
1196 /* copy and convert an ASCII string to the server buffer */
1197 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1199 if (src)
1201 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1202 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1204 *dst = 0;
1207 extern int CLIENT_InitServer(void);
1208 extern int CLIENT_BootDone( int debug_level );
1209 extern int CLIENT_IsBootThread(void);
1210 extern int CLIENT_DebuggerRequest( int op );
1211 extern int CLIENT_InitThread(void);
1212 #endif /* __WINE_SERVER__ */
1214 #endif /* __WINE_SERVER_H */