2 * Wine server definitions
4 * Copyright (C) 1998 Alexandre Julliard
7 #ifndef __WINE_SERVER_H
8 #define __WINE_SERVER_H
13 /* Request structures */
15 /* Following are the definitions of all the client<->server */
16 /* communication format; if you make any change in this file, */
17 /* you must run tools/make_requests again. */
20 /* These empty macros are used by tools/make_requests */
21 /* to generate the request/reply tracing functions */
22 #define IN /*nothing*/
23 #define OUT /*nothing*/
26 /* Create a new process from the context of the parent */
27 struct new_process_request
29 IN
int inherit
; /* inherit flag */
30 IN
int inherit_all
; /* inherit all handles from parent */
31 IN
int create_flags
; /* creation flags */
32 IN
int start_flags
; /* flags from startup info */
33 IN
int hstdin
; /* handle for stdin */
34 IN
int hstdout
; /* handle for stdout */
35 IN
int hstderr
; /* handle for stderr */
36 IN
int cmd_show
; /* main window show mode */
37 IN
void* env_ptr
; /* pointer to environment (FIXME: hack) */
38 OUT
void* pid
; /* process id */
39 OUT
int handle
; /* process handle (in the current process) */
40 IN
char cmdline
[1]; /* command line */
44 /* Create a new thread from the context of the parent */
45 struct new_thread_request
47 IN
void* pid
; /* process id for the new thread */
48 IN
int suspend
; /* new thread should be suspended on creation */
49 IN
int inherit
; /* inherit flag */
50 OUT
void* tid
; /* thread id */
51 OUT
int handle
; /* thread handle (in the current process) */
55 /* Set the server debug level */
56 struct set_debug_request
58 IN
int level
; /* New debug level */
62 /* Initialize a process; called from the new process context */
63 struct init_process_request
65 OUT
int start_flags
; /* flags from startup info */
66 OUT
int hstdin
; /* handle for stdin */
67 OUT
int hstdout
; /* handle for stdout */
68 OUT
int hstderr
; /* handle for stderr */
69 OUT
int cmd_show
; /* main window show mode */
70 OUT
void* env_ptr
; /* pointer to environment (FIXME: hack) */
71 OUT
char cmdline
[1]; /* command line */
75 /* Initialize a thread; called from the child after fork()/clone() */
76 struct init_thread_request
78 IN
int unix_pid
; /* Unix pid of new thread */
79 IN
void* teb
; /* TEB of new thread (in thread address space) */
80 OUT
void* pid
; /* process id of the new thread's process */
81 OUT
void* tid
; /* thread id of the new thread */
85 /* Retrieve the thread buffer file descriptor */
86 /* The reply to this request is the first thing a newly */
87 /* created thread gets (without having to request it) */
88 struct get_thread_buffer_request
94 /* Terminate a process */
95 struct terminate_process_request
97 IN
int handle
; /* process handle to terminate */
98 IN
int exit_code
; /* process exit code */
102 /* Terminate a thread */
103 struct terminate_thread_request
105 IN
int handle
; /* thread handle to terminate */
106 IN
int exit_code
; /* thread exit code */
110 /* Retrieve information about a process */
111 struct get_process_info_request
113 IN
int handle
; /* process handle */
114 OUT
void* pid
; /* server process id */
115 OUT
int exit_code
; /* process exit code */
116 OUT
int priority
; /* priority class */
117 OUT
int process_affinity
; /* process affinity mask */
118 OUT
int system_affinity
; /* system affinity mask */
122 /* Set a process informations */
123 struct set_process_info_request
125 IN
int handle
; /* process handle */
126 IN
int mask
; /* setting mask (see below) */
127 IN
int priority
; /* priority class */
128 IN
int affinity
; /* affinity mask */
130 #define SET_PROCESS_INFO_PRIORITY 0x01
131 #define SET_PROCESS_INFO_AFFINITY 0x02
134 /* Retrieve information about a thread */
135 struct get_thread_info_request
137 IN
int handle
; /* thread handle */
138 OUT
void* tid
; /* server thread id */
139 OUT
int exit_code
; /* thread exit code */
140 OUT
int priority
; /* thread priority level */
144 /* Set a thread informations */
145 struct set_thread_info_request
147 IN
int handle
; /* thread handle */
148 IN
int mask
; /* setting mask (see below) */
149 IN
int priority
; /* priority class */
150 IN
int affinity
; /* affinity mask */
152 #define SET_THREAD_INFO_PRIORITY 0x01
153 #define SET_THREAD_INFO_AFFINITY 0x02
156 /* Suspend a thread */
157 struct suspend_thread_request
159 IN
int handle
; /* thread handle */
160 OUT
int count
; /* new suspend count */
164 /* Resume a thread */
165 struct resume_thread_request
167 IN
int handle
; /* thread handle */
168 OUT
int count
; /* new suspend count */
172 /* Debugger support: freeze / unfreeze */
173 struct debugger_request
175 IN
int op
; /* operation type */
178 enum debugger_op
{ DEBUGGER_FREEZE_ALL
, DEBUGGER_UNFREEZE_ALL
};
181 /* Queue an APC for a thread */
182 struct queue_apc_request
184 IN
int handle
; /* thread handle */
185 IN
void* func
; /* function to call */
186 IN
void* param
; /* param for function to call */
190 /* Get list of APC to call */
191 struct get_apcs_request
193 OUT
int count
; /* number of apcs */
194 OUT
void* apcs
[1]; /* async procedures to call */
198 /* Close a handle for the current process */
199 struct close_handle_request
201 IN
int handle
; /* handle to close */
205 /* Get information about a handle */
206 struct get_handle_info_request
208 IN
int handle
; /* handle we are interested in */
209 OUT
int flags
; /* handle flags */
213 /* Set a handle information */
214 struct set_handle_info_request
216 IN
int handle
; /* handle we are interested in */
217 IN
int flags
; /* new handle flags */
218 IN
int mask
; /* mask for flags to set */
222 /* Duplicate a handle */
223 struct dup_handle_request
225 IN
int src_process
; /* src process handle */
226 IN
int src_handle
; /* src handle to duplicate */
227 IN
int dst_process
; /* dst process handle */
228 IN
unsigned int access
; /* wanted access rights */
229 IN
int inherit
; /* inherit flag */
230 IN
int options
; /* duplicate options (see below) */
231 OUT
int handle
; /* duplicated handle in dst process */
233 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
234 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
235 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
238 /* Open a handle to a process */
239 struct open_process_request
241 IN
void* pid
; /* process id to open */
242 IN
unsigned int access
; /* wanted access rights */
243 IN
int inherit
; /* inherit flag */
244 OUT
int handle
; /* handle to the process */
248 /* Wait for handles */
249 struct select_request
251 IN
int count
; /* handles count */
252 IN
int flags
; /* wait flags (see below) */
253 IN
int timeout
; /* timeout in ms */
254 OUT
int signaled
; /* signaled handle */
255 IN
int handles
[1]; /* handles to select on */
258 #define SELECT_ALERTABLE 2
259 #define SELECT_TIMEOUT 4
262 /* Create an event */
263 struct create_event_request
265 IN
int manual_reset
; /* manual reset event */
266 IN
int initial_state
; /* initial state of the event */
267 IN
int inherit
; /* inherit flag */
268 OUT
int handle
; /* handle to the event */
269 IN
char name
[1]; /* event name */
272 /* Event operation */
273 struct event_op_request
275 IN
int handle
; /* handle to event */
276 IN
int op
; /* event operation (see below) */
278 enum event_op
{ PULSE_EVENT
, SET_EVENT
, RESET_EVENT
};
282 struct open_event_request
284 IN
unsigned int access
; /* wanted access rights */
285 IN
int inherit
; /* inherit flag */
286 OUT
int handle
; /* handle to the event */
287 IN
char name
[1]; /* object name */
292 struct create_mutex_request
294 IN
int owned
; /* initially owned? */
295 IN
int inherit
; /* inherit flag */
296 OUT
int handle
; /* handle to the mutex */
297 IN
char name
[1]; /* mutex name */
301 /* Release a mutex */
302 struct release_mutex_request
304 IN
int handle
; /* handle to the mutex */
309 struct open_mutex_request
311 IN
unsigned int access
; /* wanted access rights */
312 IN
int inherit
; /* inherit flag */
313 OUT
int handle
; /* handle to the mutex */
314 IN
char name
[1]; /* object name */
318 /* Create a semaphore */
319 struct create_semaphore_request
321 IN
unsigned int initial
; /* initial count */
322 IN
unsigned int max
; /* maximum count */
323 IN
int inherit
; /* inherit flag */
324 OUT
int handle
; /* handle to the semaphore */
325 IN
char name
[1]; /* semaphore name */
329 /* Release a semaphore */
330 struct release_semaphore_request
332 IN
int handle
; /* handle to the semaphore */
333 IN
unsigned int count
; /* count to add to semaphore */
334 OUT
unsigned int prev_count
; /* previous semaphore count */
338 /* Open a semaphore */
339 struct open_semaphore_request
341 IN
unsigned int access
; /* wanted access rights */
342 IN
int inherit
; /* inherit flag */
343 OUT
int handle
; /* handle to the semaphore */
344 IN
char name
[1]; /* object name */
349 struct create_file_request
351 IN
unsigned int access
; /* wanted access rights */
352 IN
int inherit
; /* inherit flag */
353 IN
unsigned int sharing
; /* sharing flags */
354 IN
int create
; /* file create action */
355 IN
unsigned int attrs
; /* file attributes for creation */
356 OUT
int handle
; /* handle to the file */
357 IN
char name
[1]; /* file name */
361 /* Allocate a file handle for a Unix fd */
362 struct alloc_file_handle_request
364 IN
unsigned int access
; /* wanted access rights */
365 OUT
int handle
; /* handle to the file */
369 /* Get a Unix fd to read from a file */
370 struct get_read_fd_request
372 IN
int handle
; /* handle to the file */
376 /* Get a Unix fd to write to a file */
377 struct get_write_fd_request
379 IN
int handle
; /* handle to the file */
383 /* Set a file current position */
384 struct set_file_pointer_request
386 IN
int handle
; /* handle to the file */
387 IN
int low
; /* position low word */
388 IN
int high
; /* position high word */
389 IN
int whence
; /* whence to seek */
390 OUT
int new_low
; /* new position low word */
391 OUT
int new_high
; /* new position high word */
395 /* Truncate (or extend) a file */
396 struct truncate_file_request
398 IN
int handle
; /* handle to the file */
402 /* Set a file access and modification times */
403 struct set_file_time_request
405 IN
int handle
; /* handle to the file */
406 IN
time_t access_time
; /* last access time */
407 IN
time_t write_time
; /* last write time */
411 /* Flush a file buffers */
412 struct flush_file_request
414 IN
int handle
; /* handle to the file */
418 /* Get information about a file */
419 struct get_file_info_request
421 IN
int handle
; /* handle to the file */
422 OUT
int type
; /* file type */
423 OUT
int attr
; /* file attributes */
424 OUT
time_t access_time
; /* last access time */
425 OUT
time_t write_time
; /* last write time */
426 OUT
int size_high
; /* file size */
427 OUT
int size_low
; /* file size */
428 OUT
int links
; /* number of links */
429 OUT
int index_high
; /* unique index */
430 OUT
int index_low
; /* unique index */
431 OUT
unsigned int serial
; /* volume serial number */
435 /* Lock a region of a file */
436 struct lock_file_request
438 IN
int handle
; /* handle to the file */
439 IN
unsigned int offset_low
; /* offset of start of lock */
440 IN
unsigned int offset_high
; /* offset of start of lock */
441 IN
unsigned int count_low
; /* count of bytes to lock */
442 IN
unsigned int count_high
; /* count of bytes to lock */
446 /* Unlock a region of a file */
447 struct unlock_file_request
449 IN
int handle
; /* handle to the file */
450 IN
unsigned int offset_low
; /* offset of start of unlock */
451 IN
unsigned int offset_high
; /* offset of start of unlock */
452 IN
unsigned int count_low
; /* count of bytes to unlock */
453 IN
unsigned int count_high
; /* count of bytes to unlock */
457 /* Create an anonymous pipe */
458 struct create_pipe_request
460 IN
int inherit
; /* inherit flag */
461 OUT
int handle_read
; /* handle to the read-side of the pipe */
462 OUT
int handle_write
; /* handle to the write-side of the pipe */
466 /* Create a socket */
467 struct create_socket_request
469 IN
unsigned int access
; /* wanted access rights */
470 IN
int inherit
; /* inherit flag */
471 IN
int family
; /* family, see socket manpage */
472 IN
int type
; /* type, see socket manpage */
473 IN
int protocol
; /* protocol, see socket manpage */
474 OUT
int handle
; /* handle to the new socket */
478 /* Accept a socket */
479 struct accept_socket_request
481 IN
int lhandle
; /* handle to the listening socket */
482 IN
unsigned int access
; /* wanted access rights */
483 IN
int inherit
; /* inherit flag */
484 OUT
int handle
; /* handle to the new socket */
488 /* Set socket event parameters */
489 struct set_socket_event_request
491 IN
int handle
; /* handle to the socket */
492 IN
unsigned int mask
; /* event mask */
493 IN
int event
; /* event object */
497 /* Get socket event parameters */
498 struct get_socket_event_request
500 IN
int handle
; /* handle to the socket */
501 IN
int service
; /* clear pending? */
502 IN
int s_event
; /* "expected" event object */
503 OUT
unsigned int mask
; /* event mask */
504 OUT
unsigned int pmask
; /* pending events */
505 OUT
unsigned int state
; /* status bits */
506 OUT
int errors
[1]; /* event errors */
510 /* Reenable pending socket events */
511 struct enable_socket_event_request
513 IN
int handle
; /* handle to the socket */
514 IN
unsigned int mask
; /* events to re-enable */
515 IN
unsigned int sstate
; /* status bits to set */
516 IN
unsigned int cstate
; /* status bits to clear */
520 /* Allocate a console for the current process */
521 struct alloc_console_request
523 IN
unsigned int access
; /* wanted access rights */
524 IN
int inherit
; /* inherit flag */
525 OUT
int handle_in
; /* handle to console input */
526 OUT
int handle_out
; /* handle to console output */
530 /* Free the console of the current process */
531 struct free_console_request
537 /* Open a handle to the process console */
538 struct open_console_request
540 IN
int output
; /* input or output? */
541 IN
unsigned int access
; /* wanted access rights */
542 IN
int inherit
; /* inherit flag */
543 OUT
int handle
; /* handle to the console */
547 /* Set a console file descriptor */
548 struct set_console_fd_request
550 IN
int handle
; /* handle to the console */
551 IN
int file_handle
; /* handle of file to use as file descriptor */
552 IN
int pid
; /* pid of xterm (hack) */
556 /* Get a console mode (input or output) */
557 struct get_console_mode_request
559 IN
int handle
; /* handle to the console */
560 OUT
int mode
; /* console mode */
564 /* Set a console mode (input or output) */
565 struct set_console_mode_request
567 IN
int handle
; /* handle to the console */
568 IN
int mode
; /* console mode */
572 /* Set info about a console (output only) */
573 struct set_console_info_request
575 IN
int handle
; /* handle to the console */
576 IN
int mask
; /* setting mask (see below) */
577 IN
int cursor_size
; /* size of cursor (percentage filled) */
578 IN
int cursor_visible
;/* cursor visibility flag */
579 IN
char title
[1]; /* console title */
581 #define SET_CONSOLE_INFO_CURSOR 0x01
582 #define SET_CONSOLE_INFO_TITLE 0x02
584 /* Get info about a console (output only) */
585 struct get_console_info_request
587 IN
int handle
; /* handle to the console */
588 OUT
int cursor_size
; /* size of cursor (percentage filled) */
589 OUT
int cursor_visible
;/* cursor visibility flag */
590 OUT
int pid
; /* pid of xterm (hack) */
591 OUT
char title
[1]; /* console title */
595 /* Add input records to a console input queue */
596 struct write_console_input_request
598 IN
int handle
; /* handle to the console input */
599 IN
int count
; /* number of input records */
600 OUT
int written
; /* number of records written */
601 /* INPUT_RECORD records[0]; */ /* input records */
604 /* Fetch input records from a console input queue */
605 struct read_console_input_request
607 IN
int handle
; /* handle to the console input */
608 IN
int count
; /* max number of records to retrieve */
609 IN
int flush
; /* flush the retrieved records from the queue? */
610 OUT
int read
; /* number of records read */
611 /* INPUT_RECORD records[0]; */ /* input records */
615 /* Create a change notification */
616 struct create_change_notification_request
618 IN
int subtree
; /* watch all the subtree */
619 IN
int filter
; /* notification filter */
620 OUT
int handle
; /* handle to the change notification */
624 /* Create a file mapping */
625 struct create_mapping_request
627 IN
int size_high
; /* mapping size */
628 IN
int size_low
; /* mapping size */
629 IN
int protect
; /* protection flags (see below) */
630 IN
int inherit
; /* inherit flag */
631 IN
int file_handle
; /* file handle */
632 OUT
int handle
; /* handle to the mapping */
633 IN
char name
[1]; /* object name */
635 /* protection flags */
636 #define VPROT_READ 0x01
637 #define VPROT_WRITE 0x02
638 #define VPROT_EXEC 0x04
639 #define VPROT_WRITECOPY 0x08
640 #define VPROT_GUARD 0x10
641 #define VPROT_NOCACHE 0x20
642 #define VPROT_COMMITTED 0x40
646 struct open_mapping_request
648 IN
unsigned int access
; /* wanted access rights */
649 IN
int inherit
; /* inherit flag */
650 OUT
int handle
; /* handle to the mapping */
651 IN
char name
[1]; /* object name */
655 /* Get information about a file mapping */
656 struct get_mapping_info_request
658 IN
int handle
; /* handle to the mapping */
659 OUT
int size_high
; /* mapping size */
660 OUT
int size_low
; /* mapping size */
661 OUT
int protect
; /* protection flags */
665 /* Create a device */
666 struct create_device_request
668 IN
unsigned int access
; /* wanted access rights */
669 IN
int inherit
; /* inherit flag */
670 IN
int id
; /* client private id */
671 OUT
int handle
; /* handle to the device */
675 /* Create a snapshot */
676 struct create_snapshot_request
678 IN
int inherit
; /* inherit flag */
679 IN
int flags
; /* snapshot flags (TH32CS_*) */
680 OUT
int handle
; /* handle to the snapshot */
684 /* Get the next process from a snapshot */
685 struct next_process_request
687 IN
int handle
; /* handle to the snapshot */
688 IN
int reset
; /* reset snapshot position? */
689 OUT
void* pid
; /* process id */
690 OUT
int threads
; /* number of threads */
691 OUT
int priority
; /* process priority */
695 /* Wait for a debug event */
696 struct wait_debug_event_request
698 IN
int timeout
; /* timeout in ms */
699 OUT
int code
; /* event code */
700 OUT
void* pid
; /* process id */
701 OUT
void* tid
; /* thread id */
702 /* OUT union debug_event_data data; */
706 /* Send a debug event */
707 struct send_debug_event_request
709 IN
int code
; /* event code */
710 OUT
int status
; /* event continuation status */
711 /* IN union debug_event_data data; */
715 /* definitions of the event data depending on the event code */
716 struct debug_event_exception
718 int code
; /* exception code */
719 int flags
; /* exception flags */
720 void *record
; /* exception record ptr */
721 void *addr
; /* exception address */
722 int nb_params
; /* exceptions parameters */
724 int first_chance
; /* first chance to handle it? */
726 struct debug_event_create_thread
728 int handle
; /* handle to the new thread */
729 void *teb
; /* thread teb (in debugged process address space) */
730 void *start
; /* thread startup routine */
732 struct debug_event_create_process
734 int file
; /* handle to the process exe file */
735 int process
; /* handle to the new process */
736 int thread
; /* handle to the new thread */
737 void *base
; /* base of executable image */
738 int dbg_offset
; /* offset of debug info in file */
739 int dbg_size
; /* size of debug info */
740 void *teb
; /* thread teb (in debugged process address space) */
741 void *start
; /* thread startup routine */
742 void *name
; /* image name (optional) */
743 int unicode
; /* is it Unicode? */
745 struct debug_event_exit
747 int exit_code
; /* thread or process exit code */
749 struct debug_event_load_dll
751 int handle
; /* file handle for the dll */
752 void *base
; /* base address of the dll */
753 int dbg_offset
; /* offset of debug info in file */
754 int dbg_size
; /* size of debug info */
755 void *name
; /* image name (optional) */
756 int unicode
; /* is it Unicode? */
758 struct debug_event_unload_dll
760 void *base
; /* base address of the dll */
762 struct debug_event_output_string
764 void *string
; /* string to display (in debugged process address space) */
765 int unicode
; /* is it Unicode? */
766 int length
; /* string length */
768 struct debug_event_rip_info
773 union debug_event_data
775 struct debug_event_exception exception
;
776 struct debug_event_create_thread create_thread
;
777 struct debug_event_create_process create_process
;
778 struct debug_event_exit exit
;
779 struct debug_event_load_dll load_dll
;
780 struct debug_event_unload_dll unload_dll
;
781 struct debug_event_output_string output_string
;
782 struct debug_event_rip_info rip_info
;
786 /* Continue a debug event */
787 struct continue_debug_event_request
789 IN
void* pid
; /* process id to continue */
790 IN
void* tid
; /* thread id to continue */
791 IN
int status
; /* continuation status */
795 /* Start debugging an existing process */
796 struct debug_process_request
798 IN
void* pid
; /* id of the process to debug */
802 /* Everything below this line is generated automatically by tools/make_requests */
803 /* ### make_requests begin ### */
812 REQ_GET_THREAD_BUFFER
,
813 REQ_TERMINATE_PROCESS
,
814 REQ_TERMINATE_THREAD
,
815 REQ_GET_PROCESS_INFO
,
816 REQ_SET_PROCESS_INFO
,
836 REQ_CREATE_SEMAPHORE
,
837 REQ_RELEASE_SEMAPHORE
,
840 REQ_ALLOC_FILE_HANDLE
,
843 REQ_SET_FILE_POINTER
,
853 REQ_SET_SOCKET_EVENT
,
854 REQ_GET_SOCKET_EVENT
,
855 REQ_ENABLE_SOCKET_EVENT
,
860 REQ_GET_CONSOLE_MODE
,
861 REQ_SET_CONSOLE_MODE
,
862 REQ_SET_CONSOLE_INFO
,
863 REQ_GET_CONSOLE_INFO
,
864 REQ_WRITE_CONSOLE_INPUT
,
865 REQ_READ_CONSOLE_INPUT
,
866 REQ_CREATE_CHANGE_NOTIFICATION
,
869 REQ_GET_MAPPING_INFO
,
873 REQ_WAIT_DEBUG_EVENT
,
874 REQ_SEND_DEBUG_EVENT
,
875 REQ_CONTINUE_DEBUG_EVENT
,
880 /* ### make_requests end ### */
881 /* Everything above this line is generated automatically by tools/make_requests */
884 /* client-side functions */
886 #ifndef __WINE_SERVER__
890 /* client communication functions */
892 /* get a pointer to the request buffer */
893 static inline void * WINE_UNUSED
get_req_buffer(void)
895 return NtCurrentTeb()->buffer
;
898 /* maximum remaining size in the server buffer */
899 static inline int WINE_UNUSED
server_remaining( const void *ptr
)
901 return (char *)NtCurrentTeb()->buffer
+ NtCurrentTeb()->buffer_size
- (char *)ptr
;
904 extern unsigned int server_call( enum request req
);
905 extern unsigned int server_call_fd( enum request req
, int fd_out
, int *fd_in
);
906 extern void server_protocol_error( const char *err
, ... );
908 extern int CLIENT_InitServer(void);
909 extern int CLIENT_SetDebug( int level
);
910 extern int CLIENT_DebuggerRequest( int op
);
911 extern int CLIENT_InitThread(void);
912 #endif /* __WINE_SERVER__ */
914 #endif /* __WINE_SERVER_H */