Changed the server to return STATUS_* error codes.
[wine/wine-kai.git] / include / server.h
blob96685b0cfd412f3e5fdef294f2d1cb96d6a8a3d3
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 handle; /* process handle (in the current process) */
125 IN char cmdline[1]; /* command line */
129 /* Create a new thread from the context of the parent */
130 struct new_thread_request
132 IN void* pid; /* process id for the new thread */
133 IN int suspend; /* new thread should be suspended on creation */
134 IN int inherit; /* inherit flag */
135 OUT void* tid; /* thread id */
136 OUT int handle; /* thread handle (in the current process) */
140 /* Set the server debug level */
141 struct set_debug_request
143 IN int level; /* New debug level */
147 /* Initialize a process; called from the new process context */
148 struct init_process_request
150 OUT int start_flags; /* flags from startup info */
151 OUT int hstdin; /* handle for stdin */
152 OUT int hstdout; /* handle for stdout */
153 OUT int hstderr; /* handle for stderr */
154 OUT int cmd_show; /* main window show mode */
155 OUT void* env_ptr; /* pointer to environment (FIXME: hack) */
156 OUT char cmdline[1]; /* command line */
160 /* Signal the end of the process initialization */
161 struct init_process_done_request
163 IN int dummy;
167 /* Initialize a thread; called from the child after fork()/clone() */
168 struct init_thread_request
170 IN int unix_pid; /* Unix pid of new thread */
171 IN void* teb; /* TEB of new thread (in thread address space) */
172 OUT void* pid; /* process id of the new thread's process */
173 OUT void* tid; /* thread id of the new thread */
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 IN int dummy;
186 /* Terminate a process */
187 struct terminate_process_request
189 IN int handle; /* process handle to terminate */
190 IN int exit_code; /* process exit code */
194 /* Terminate a thread */
195 struct terminate_thread_request
197 IN int handle; /* thread handle to terminate */
198 IN int exit_code; /* thread exit code */
202 /* Retrieve information about a process */
203 struct get_process_info_request
205 IN int handle; /* process handle */
206 OUT void* pid; /* server process id */
207 OUT int exit_code; /* process exit code */
208 OUT int priority; /* priority class */
209 OUT int process_affinity; /* process affinity mask */
210 OUT int system_affinity; /* system affinity mask */
214 /* Set a process informations */
215 struct set_process_info_request
217 IN int handle; /* process handle */
218 IN int mask; /* setting mask (see below) */
219 IN int priority; /* priority class */
220 IN int affinity; /* affinity mask */
222 #define SET_PROCESS_INFO_PRIORITY 0x01
223 #define SET_PROCESS_INFO_AFFINITY 0x02
226 /* Retrieve information about a thread */
227 struct get_thread_info_request
229 IN int handle; /* thread handle */
230 OUT void* tid; /* server thread id */
231 OUT int exit_code; /* thread exit code */
232 OUT int priority; /* thread priority level */
236 /* Set a thread informations */
237 struct set_thread_info_request
239 IN int handle; /* thread handle */
240 IN int mask; /* setting mask (see below) */
241 IN int priority; /* priority class */
242 IN int affinity; /* affinity mask */
244 #define SET_THREAD_INFO_PRIORITY 0x01
245 #define SET_THREAD_INFO_AFFINITY 0x02
248 /* Suspend a thread */
249 struct suspend_thread_request
251 IN int handle; /* thread handle */
252 OUT int count; /* new suspend count */
256 /* Resume a thread */
257 struct resume_thread_request
259 IN int handle; /* thread handle */
260 OUT int count; /* new suspend count */
264 /* Debugger support: freeze / unfreeze */
265 struct debugger_request
267 IN int op; /* operation type */
270 enum debugger_op { DEBUGGER_FREEZE_ALL, DEBUGGER_UNFREEZE_ALL };
273 /* Queue an APC for a thread */
274 struct queue_apc_request
276 IN int handle; /* thread handle */
277 IN void* func; /* function to call */
278 IN void* param; /* param for function to call */
282 /* Get list of APC to call */
283 struct get_apcs_request
285 OUT int count; /* number of apcs */
286 OUT void* apcs[1]; /* async procedures to call */
290 /* Close a handle for the current process */
291 struct close_handle_request
293 IN int handle; /* handle to close */
297 /* Get information about a handle */
298 struct get_handle_info_request
300 IN int handle; /* handle we are interested in */
301 OUT int flags; /* handle flags */
305 /* Set a handle information */
306 struct set_handle_info_request
308 IN int handle; /* handle we are interested in */
309 IN int flags; /* new handle flags */
310 IN int mask; /* mask for flags to set */
314 /* Duplicate a handle */
315 struct dup_handle_request
317 IN int src_process; /* src process handle */
318 IN int src_handle; /* src handle to duplicate */
319 IN int dst_process; /* dst process handle */
320 IN unsigned int access; /* wanted access rights */
321 IN int inherit; /* inherit flag */
322 IN int options; /* duplicate options (see below) */
323 OUT int handle; /* duplicated handle in dst process */
325 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
326 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
327 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
330 /* Open a handle to a process */
331 struct open_process_request
333 IN void* pid; /* process id to open */
334 IN unsigned int access; /* wanted access rights */
335 IN int inherit; /* inherit flag */
336 OUT int handle; /* handle to the process */
340 /* Wait for handles */
341 struct select_request
343 IN int count; /* handles count */
344 IN int flags; /* wait flags (see below) */
345 IN int timeout; /* timeout in ms */
346 OUT int signaled; /* signaled handle */
347 IN int handles[1]; /* handles to select on */
349 #define SELECT_ALL 1
350 #define SELECT_ALERTABLE 2
351 #define SELECT_TIMEOUT 4
354 /* Create an event */
355 struct create_event_request
357 IN int manual_reset; /* manual reset event */
358 IN int initial_state; /* initial state of the event */
359 IN int inherit; /* inherit flag */
360 OUT int handle; /* handle to the event */
361 IN WCHAR name[1]; /* event name */
364 /* Event operation */
365 struct event_op_request
367 IN int handle; /* handle to event */
368 IN int op; /* event operation (see below) */
370 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
373 /* Open an event */
374 struct open_event_request
376 IN unsigned int access; /* wanted access rights */
377 IN int inherit; /* inherit flag */
378 OUT int handle; /* handle to the event */
379 IN WCHAR name[1]; /* object name */
383 /* Create a mutex */
384 struct create_mutex_request
386 IN int owned; /* initially owned? */
387 IN int inherit; /* inherit flag */
388 OUT int handle; /* handle to the mutex */
389 IN WCHAR name[1]; /* mutex name */
393 /* Release a mutex */
394 struct release_mutex_request
396 IN int handle; /* handle to the mutex */
400 /* Open a mutex */
401 struct open_mutex_request
403 IN unsigned int access; /* wanted access rights */
404 IN int inherit; /* inherit flag */
405 OUT int handle; /* handle to the mutex */
406 IN WCHAR name[1]; /* object name */
410 /* Create a semaphore */
411 struct create_semaphore_request
413 IN unsigned int initial; /* initial count */
414 IN unsigned int max; /* maximum count */
415 IN int inherit; /* inherit flag */
416 OUT int handle; /* handle to the semaphore */
417 IN WCHAR name[1]; /* semaphore name */
421 /* Release a semaphore */
422 struct release_semaphore_request
424 IN int handle; /* handle to the semaphore */
425 IN unsigned int count; /* count to add to semaphore */
426 OUT unsigned int prev_count; /* previous semaphore count */
430 /* Open a semaphore */
431 struct open_semaphore_request
433 IN unsigned int access; /* wanted access rights */
434 IN int inherit; /* inherit flag */
435 OUT int handle; /* handle to the semaphore */
436 IN WCHAR name[1]; /* object name */
440 /* Create a file */
441 struct create_file_request
443 IN unsigned int access; /* wanted access rights */
444 IN int inherit; /* inherit flag */
445 IN unsigned int sharing; /* sharing flags */
446 IN int create; /* file create action */
447 IN unsigned int attrs; /* file attributes for creation */
448 OUT int handle; /* handle to the file */
449 IN char name[1]; /* file name */
453 /* Allocate a file handle for a Unix fd */
454 struct alloc_file_handle_request
456 IN unsigned int access; /* wanted access rights */
457 OUT int handle; /* handle to the file */
461 /* Get a Unix fd to read from a file */
462 struct get_read_fd_request
464 IN int handle; /* handle to the file */
468 /* Get a Unix fd to write to a file */
469 struct get_write_fd_request
471 IN int handle; /* handle to the file */
475 /* Set a file current position */
476 struct set_file_pointer_request
478 IN int handle; /* handle to the file */
479 IN int low; /* position low word */
480 IN int high; /* position high word */
481 IN int whence; /* whence to seek */
482 OUT int new_low; /* new position low word */
483 OUT int new_high; /* new position high word */
487 /* Truncate (or extend) a file */
488 struct truncate_file_request
490 IN int handle; /* handle to the file */
494 /* Set a file access and modification times */
495 struct set_file_time_request
497 IN int handle; /* handle to the file */
498 IN time_t access_time; /* last access time */
499 IN time_t write_time; /* last write time */
503 /* Flush a file buffers */
504 struct flush_file_request
506 IN int handle; /* handle to the file */
510 /* Get information about a file */
511 struct get_file_info_request
513 IN int handle; /* handle to the file */
514 OUT int type; /* file type */
515 OUT int attr; /* file attributes */
516 OUT time_t access_time; /* last access time */
517 OUT time_t write_time; /* last write time */
518 OUT int size_high; /* file size */
519 OUT int size_low; /* file size */
520 OUT int links; /* number of links */
521 OUT int index_high; /* unique index */
522 OUT int index_low; /* unique index */
523 OUT unsigned int serial; /* volume serial number */
527 /* Lock a region of a file */
528 struct lock_file_request
530 IN int handle; /* handle to the file */
531 IN unsigned int offset_low; /* offset of start of lock */
532 IN unsigned int offset_high; /* offset of start of lock */
533 IN unsigned int count_low; /* count of bytes to lock */
534 IN unsigned int count_high; /* count of bytes to lock */
538 /* Unlock a region of a file */
539 struct unlock_file_request
541 IN int handle; /* handle to the file */
542 IN unsigned int offset_low; /* offset of start of unlock */
543 IN unsigned int offset_high; /* offset of start of unlock */
544 IN unsigned int count_low; /* count of bytes to unlock */
545 IN unsigned int count_high; /* count of bytes to unlock */
549 /* Create an anonymous pipe */
550 struct create_pipe_request
552 IN int inherit; /* inherit flag */
553 OUT int handle_read; /* handle to the read-side of the pipe */
554 OUT int handle_write; /* handle to the write-side of the pipe */
558 /* Create a socket */
559 struct create_socket_request
561 IN unsigned int access; /* wanted access rights */
562 IN int inherit; /* inherit flag */
563 IN int family; /* family, see socket manpage */
564 IN int type; /* type, see socket manpage */
565 IN int protocol; /* protocol, see socket manpage */
566 OUT int handle; /* handle to the new socket */
570 /* Accept a socket */
571 struct accept_socket_request
573 IN int lhandle; /* handle to the listening socket */
574 IN unsigned int access; /* wanted access rights */
575 IN int inherit; /* inherit flag */
576 OUT int handle; /* handle to the new socket */
580 /* Set socket event parameters */
581 struct set_socket_event_request
583 IN int handle; /* handle to the socket */
584 IN unsigned int mask; /* event mask */
585 IN int event; /* event object */
589 /* Get socket event parameters */
590 struct get_socket_event_request
592 IN int handle; /* handle to the socket */
593 IN int service; /* clear pending? */
594 IN int s_event; /* "expected" event object */
595 OUT unsigned int mask; /* event mask */
596 OUT unsigned int pmask; /* pending events */
597 OUT unsigned int state; /* status bits */
598 OUT int errors[1]; /* event errors */
602 /* Reenable pending socket events */
603 struct enable_socket_event_request
605 IN int handle; /* handle to the socket */
606 IN unsigned int mask; /* events to re-enable */
607 IN unsigned int sstate; /* status bits to set */
608 IN unsigned int cstate; /* status bits to clear */
612 /* Allocate a console for the current process */
613 struct alloc_console_request
615 IN unsigned int access; /* wanted access rights */
616 IN int inherit; /* inherit flag */
617 OUT int handle_in; /* handle to console input */
618 OUT int handle_out; /* handle to console output */
622 /* Free the console of the current process */
623 struct free_console_request
625 IN int dummy;
629 /* Open a handle to the process console */
630 struct open_console_request
632 IN int output; /* input or output? */
633 IN unsigned int access; /* wanted access rights */
634 IN int inherit; /* inherit flag */
635 OUT int handle; /* handle to the console */
639 /* Set a console file descriptor */
640 struct set_console_fd_request
642 IN int handle; /* handle to the console */
643 IN int file_handle; /* handle of file to use as file descriptor */
644 IN int pid; /* pid of xterm (hack) */
648 /* Get a console mode (input or output) */
649 struct get_console_mode_request
651 IN int handle; /* handle to the console */
652 OUT int mode; /* console mode */
656 /* Set a console mode (input or output) */
657 struct set_console_mode_request
659 IN int handle; /* handle to the console */
660 IN int mode; /* console mode */
664 /* Set info about a console (output only) */
665 struct set_console_info_request
667 IN int handle; /* handle to the console */
668 IN int mask; /* setting mask (see below) */
669 IN int cursor_size; /* size of cursor (percentage filled) */
670 IN int cursor_visible;/* cursor visibility flag */
671 IN char title[1]; /* console title */
673 #define SET_CONSOLE_INFO_CURSOR 0x01
674 #define SET_CONSOLE_INFO_TITLE 0x02
676 /* Get info about a console (output only) */
677 struct get_console_info_request
679 IN int handle; /* handle to the console */
680 OUT int cursor_size; /* size of cursor (percentage filled) */
681 OUT int cursor_visible;/* cursor visibility flag */
682 OUT int pid; /* pid of xterm (hack) */
683 OUT char title[1]; /* console title */
687 /* Add input records to a console input queue */
688 struct write_console_input_request
690 IN int handle; /* handle to the console input */
691 IN int count; /* number of input records */
692 OUT int written; /* number of records written */
693 /* INPUT_RECORD records[0]; */ /* input records */
696 /* Fetch input records from a console input queue */
697 struct read_console_input_request
699 IN int handle; /* handle to the console input */
700 IN int count; /* max number of records to retrieve */
701 IN int flush; /* flush the retrieved records from the queue? */
702 OUT int read; /* number of records read */
703 /* INPUT_RECORD records[0]; */ /* input records */
707 /* Create a change notification */
708 struct create_change_notification_request
710 IN int subtree; /* watch all the subtree */
711 IN int filter; /* notification filter */
712 OUT int handle; /* handle to the change notification */
716 /* Create a file mapping */
717 struct create_mapping_request
719 IN int size_high; /* mapping size */
720 IN int size_low; /* mapping size */
721 IN int protect; /* protection flags (see below) */
722 IN int inherit; /* inherit flag */
723 IN int file_handle; /* file handle */
724 OUT int handle; /* handle to the mapping */
725 IN WCHAR name[1]; /* object name */
727 /* protection flags */
728 #define VPROT_READ 0x01
729 #define VPROT_WRITE 0x02
730 #define VPROT_EXEC 0x04
731 #define VPROT_WRITECOPY 0x08
732 #define VPROT_GUARD 0x10
733 #define VPROT_NOCACHE 0x20
734 #define VPROT_COMMITTED 0x40
737 /* Open a mapping */
738 struct open_mapping_request
740 IN unsigned int access; /* wanted access rights */
741 IN int inherit; /* inherit flag */
742 OUT int handle; /* handle to the mapping */
743 IN WCHAR name[1]; /* object name */
747 /* Get information about a file mapping */
748 struct get_mapping_info_request
750 IN int handle; /* handle to the mapping */
751 OUT int size_high; /* mapping size */
752 OUT int size_low; /* mapping size */
753 OUT int protect; /* protection flags */
757 /* Create a device */
758 struct create_device_request
760 IN unsigned int access; /* wanted access rights */
761 IN int inherit; /* inherit flag */
762 IN int id; /* client private id */
763 OUT int handle; /* handle to the device */
767 /* Create a snapshot */
768 struct create_snapshot_request
770 IN int inherit; /* inherit flag */
771 IN int flags; /* snapshot flags (TH32CS_*) */
772 OUT int handle; /* handle to the snapshot */
776 /* Get the next process from a snapshot */
777 struct next_process_request
779 IN int handle; /* handle to the snapshot */
780 IN int reset; /* reset snapshot position? */
781 OUT void* pid; /* process id */
782 OUT int threads; /* number of threads */
783 OUT int priority; /* process priority */
787 /* Wait for a debug event */
788 struct wait_debug_event_request
790 IN int timeout; /* timeout in ms */
791 OUT void* pid; /* process id */
792 OUT void* tid; /* thread id */
793 OUT debug_event_t event; /* debug event data */
797 /* Send a debug event */
798 struct send_debug_event_request
800 OUT int status; /* event continuation status */
801 IN debug_event_t event; /* debug event data */
805 /* Continue a debug event */
806 struct continue_debug_event_request
808 IN void* pid; /* process id to continue */
809 IN void* tid; /* thread id to continue */
810 IN int status; /* continuation status */
814 /* Start debugging an existing process */
815 struct debug_process_request
817 IN void* pid; /* id of the process to debug */
821 /* Read data from a process address space */
822 struct read_process_memory_request
824 IN int handle; /* process handle */
825 IN void* addr; /* addr to read from (must be int-aligned) */
826 IN int len; /* number of ints to read */
827 OUT unsigned int data[1]; /* result data */
831 /* Write data to a process address space */
832 struct write_process_memory_request
834 IN int handle; /* process handle */
835 IN void* addr; /* addr to write to (must be int-aligned) */
836 IN int len; /* number of ints to write */
837 IN unsigned int first_mask; /* mask for first word */
838 IN unsigned int last_mask; /* mask for last word */
839 IN unsigned int data[1]; /* data to write */
843 /* Create a registry key */
844 struct create_key_request
846 IN int parent; /* handle to the parent key */
847 IN unsigned int access; /* desired access rights */
848 IN unsigned int options; /* creation options */
849 IN time_t modif; /* last modification time */
850 OUT int hkey; /* handle to the created key */
851 OUT int created; /* has it been newly created? */
852 IN path_t name; /* key name */
853 IN WCHAR class[1]; /* class name */
857 /* Open a registry key */
858 struct open_key_request
860 IN int parent; /* handle to the parent key */
861 IN unsigned int access; /* desired access rights */
862 OUT int hkey; /* handle to the open key */
863 IN path_t name; /* key name */
867 /* Delete a registry key */
868 struct delete_key_request
870 IN int hkey; /* handle to the parent key */
871 IN path_t name; /* key name */
875 /* Close a registry key */
876 struct close_key_request
878 IN int hkey; /* key to close */
882 /* Enumerate registry subkeys */
883 struct enum_key_request
885 IN int hkey; /* handle to registry key */
886 IN int index; /* index of subkey */
887 OUT time_t modif; /* last modification time */
888 OUT path_t name; /* subkey name */
889 OUT WCHAR class[1]; /* class name */
893 /* Query information about a registry key */
894 struct query_key_info_request
896 IN int hkey; /* handle to registry key */
897 OUT int subkeys; /* number of subkeys */
898 OUT int max_subkey; /* longest subkey name */
899 OUT int max_class; /* longest class name */
900 OUT int values; /* number of values */
901 OUT int max_value; /* longest value name */
902 OUT int max_data; /* longest value data */
903 OUT time_t modif; /* last modification time */
904 OUT path_t name; /* key name */
905 OUT WCHAR class[1]; /* class name */
909 /* Set a value of a registry key */
910 struct set_key_value_request
912 IN int hkey; /* handle to registry key */
913 IN int type; /* value type */
914 IN int len; /* value data len */
915 IN path_t name; /* value name */
916 IN unsigned char data[1]; /* value data */
920 /* Retrieve the value of a registry key */
921 struct get_key_value_request
923 IN int hkey; /* handle to registry key */
924 OUT int type; /* value type */
925 OUT int len; /* value data len */
926 IN WCHAR name[1]; /* value name */
927 OUT unsigned char data[1]; /* value data */
931 /* Enumerate a value of a registry key */
932 struct enum_key_value_request
934 IN int hkey; /* handle to registry key */
935 IN int index; /* value index */
936 OUT int type; /* value type */
937 OUT int len; /* value data len */
938 OUT path_t name; /* value name */
939 OUT unsigned char data[1]; /* value data */
943 /* Delete a value of a registry key */
944 struct delete_key_value_request
946 IN int hkey; /* handle to registry key */
947 IN path_t name; /* value name */
951 /* Load a registry branch from a file */
952 struct load_registry_request
954 IN int hkey; /* root key to load to */
955 IN int file; /* file to load from */
956 IN path_t name; /* subkey name */
960 /* Save a registry branch to a file */
961 struct save_registry_request
963 IN int hkey; /* key to save */
964 IN int file; /* file to save to */
968 /* Set the current and saving level for the registry */
969 struct set_registry_levels_request
971 IN int current; /* new current level */
972 IN int saving; /* new saving level */
973 IN int version; /* file format version for saving */
977 /* Create a waitable timer */
978 struct create_timer_request
980 IN int inherit; /* inherit flag */
981 IN int manual; /* manual reset */
982 OUT int handle; /* handle to the timer */
983 IN WCHAR name[1]; /* timer name */
987 /* Open a waitable timer */
988 struct open_timer_request
990 IN unsigned int access; /* wanted access rights */
991 IN int inherit; /* inherit flag */
992 OUT int handle; /* handle to the timer */
993 IN WCHAR name[1]; /* timer name */
996 /* Set a waitable timer */
997 struct set_timer_request
999 IN int handle; /* handle to the timer */
1000 IN int sec; /* next expiration absolute time */
1001 IN int usec; /* next expiration absolute time */
1002 IN int period; /* timer period in ms */
1003 IN void* callback; /* callback function */
1004 IN void* arg; /* callback argument */
1007 /* Cancel a waitable timer */
1008 struct cancel_timer_request
1010 IN int handle; /* handle to the timer */
1014 /* Retrieve the current context of a thread */
1015 struct get_thread_context_request
1017 IN int handle; /* thread handle */
1018 IN unsigned int flags; /* context flags */
1019 OUT CONTEXT context; /* thread context */
1023 /* Set the current context of a thread */
1024 struct set_thread_context_request
1026 IN int handle; /* thread handle */
1027 IN unsigned int flags; /* context flags */
1028 IN CONTEXT context; /* thread context */
1032 /* Everything below this line is generated automatically by tools/make_requests */
1033 /* ### make_requests begin ### */
1035 enum request
1037 REQ_NEW_PROCESS,
1038 REQ_NEW_THREAD,
1039 REQ_SET_DEBUG,
1040 REQ_INIT_PROCESS,
1041 REQ_INIT_PROCESS_DONE,
1042 REQ_INIT_THREAD,
1043 REQ_GET_THREAD_BUFFER,
1044 REQ_TERMINATE_PROCESS,
1045 REQ_TERMINATE_THREAD,
1046 REQ_GET_PROCESS_INFO,
1047 REQ_SET_PROCESS_INFO,
1048 REQ_GET_THREAD_INFO,
1049 REQ_SET_THREAD_INFO,
1050 REQ_SUSPEND_THREAD,
1051 REQ_RESUME_THREAD,
1052 REQ_DEBUGGER,
1053 REQ_QUEUE_APC,
1054 REQ_GET_APCS,
1055 REQ_CLOSE_HANDLE,
1056 REQ_GET_HANDLE_INFO,
1057 REQ_SET_HANDLE_INFO,
1058 REQ_DUP_HANDLE,
1059 REQ_OPEN_PROCESS,
1060 REQ_SELECT,
1061 REQ_CREATE_EVENT,
1062 REQ_EVENT_OP,
1063 REQ_OPEN_EVENT,
1064 REQ_CREATE_MUTEX,
1065 REQ_RELEASE_MUTEX,
1066 REQ_OPEN_MUTEX,
1067 REQ_CREATE_SEMAPHORE,
1068 REQ_RELEASE_SEMAPHORE,
1069 REQ_OPEN_SEMAPHORE,
1070 REQ_CREATE_FILE,
1071 REQ_ALLOC_FILE_HANDLE,
1072 REQ_GET_READ_FD,
1073 REQ_GET_WRITE_FD,
1074 REQ_SET_FILE_POINTER,
1075 REQ_TRUNCATE_FILE,
1076 REQ_SET_FILE_TIME,
1077 REQ_FLUSH_FILE,
1078 REQ_GET_FILE_INFO,
1079 REQ_LOCK_FILE,
1080 REQ_UNLOCK_FILE,
1081 REQ_CREATE_PIPE,
1082 REQ_CREATE_SOCKET,
1083 REQ_ACCEPT_SOCKET,
1084 REQ_SET_SOCKET_EVENT,
1085 REQ_GET_SOCKET_EVENT,
1086 REQ_ENABLE_SOCKET_EVENT,
1087 REQ_ALLOC_CONSOLE,
1088 REQ_FREE_CONSOLE,
1089 REQ_OPEN_CONSOLE,
1090 REQ_SET_CONSOLE_FD,
1091 REQ_GET_CONSOLE_MODE,
1092 REQ_SET_CONSOLE_MODE,
1093 REQ_SET_CONSOLE_INFO,
1094 REQ_GET_CONSOLE_INFO,
1095 REQ_WRITE_CONSOLE_INPUT,
1096 REQ_READ_CONSOLE_INPUT,
1097 REQ_CREATE_CHANGE_NOTIFICATION,
1098 REQ_CREATE_MAPPING,
1099 REQ_OPEN_MAPPING,
1100 REQ_GET_MAPPING_INFO,
1101 REQ_CREATE_DEVICE,
1102 REQ_CREATE_SNAPSHOT,
1103 REQ_NEXT_PROCESS,
1104 REQ_WAIT_DEBUG_EVENT,
1105 REQ_SEND_DEBUG_EVENT,
1106 REQ_CONTINUE_DEBUG_EVENT,
1107 REQ_DEBUG_PROCESS,
1108 REQ_READ_PROCESS_MEMORY,
1109 REQ_WRITE_PROCESS_MEMORY,
1110 REQ_CREATE_KEY,
1111 REQ_OPEN_KEY,
1112 REQ_DELETE_KEY,
1113 REQ_CLOSE_KEY,
1114 REQ_ENUM_KEY,
1115 REQ_QUERY_KEY_INFO,
1116 REQ_SET_KEY_VALUE,
1117 REQ_GET_KEY_VALUE,
1118 REQ_ENUM_KEY_VALUE,
1119 REQ_DELETE_KEY_VALUE,
1120 REQ_LOAD_REGISTRY,
1121 REQ_SAVE_REGISTRY,
1122 REQ_SET_REGISTRY_LEVELS,
1123 REQ_CREATE_TIMER,
1124 REQ_OPEN_TIMER,
1125 REQ_SET_TIMER,
1126 REQ_CANCEL_TIMER,
1127 REQ_GET_THREAD_CONTEXT,
1128 REQ_SET_THREAD_CONTEXT,
1129 REQ_NB_REQUESTS
1132 /* ### make_requests end ### */
1133 /* Everything above this line is generated automatically by tools/make_requests */
1136 /* client-side functions */
1138 #ifndef __WINE_SERVER__
1140 #include "thread.h"
1141 #include "ntddk.h"
1143 /* client communication functions */
1145 extern unsigned int server_call_noerr( enum request req );
1146 extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
1147 extern void server_protocol_error( const char *err, ... );
1149 /* get a pointer to the request buffer */
1150 static inline void * WINE_UNUSED get_req_buffer(void)
1152 return NtCurrentTeb()->buffer;
1155 /* maximum remaining size in the server buffer */
1156 static inline int WINE_UNUSED server_remaining( const void *ptr )
1158 return (char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size - (char *)ptr;
1161 /* do a server call and set the last error code */
1162 static inline int server_call( enum request req )
1164 unsigned int res = server_call_noerr( req );
1165 if (res) SetLastError( RtlNtStatusToDosError(res) );
1166 return res;
1169 /* copy a Unicode string to the server buffer */
1170 static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
1172 if (src)
1174 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1175 while ((dst < end) && *src) *dst++ = *src++;
1177 *dst = 0;
1180 /* copy and convert an ASCII string to the server buffer */
1181 static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
1183 if (src)
1185 WCHAR *end = (WCHAR *)((char *)NtCurrentTeb()->buffer + NtCurrentTeb()->buffer_size) - 1;
1186 while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
1188 *dst = 0;
1191 extern int CLIENT_InitServer(void);
1192 extern int CLIENT_SetDebug( int level );
1193 extern int CLIENT_DebuggerRequest( int op );
1194 extern int CLIENT_InitThread(void);
1195 #endif /* __WINE_SERVER__ */
1197 #endif /* __WINE_SERVER_H */