Special case handling of : Shift + arrow, shift + home, ...
[wine.git] / include / server.h
blobe93cea74c2a329304ea1e8498a24acfb55e25ed1
1 /*
2 * Wine server definitions
4 * Copyright (C) 1998 Alexandre Julliard
5 */
7 #ifndef __WINE_SERVER_H
8 #define __WINE_SERVER_H
10 /* message header as sent on the wire */
11 struct header
13 unsigned int len; /* total msg length (including this header) */
14 unsigned int type; /* msg type */
15 unsigned int seq; /* sequence number */
18 /* max msg length (not including the header) */
19 #define MAX_MSG_LENGTH (16384 - sizeof(struct header))
21 /* data structure used to pass an fd with sendmsg/recvmsg */
22 struct cmsg_fd
24 int len; /* sizeof structure */
25 int level; /* SOL_SOCKET */
26 int type; /* SCM_RIGHTS */
27 int fd; /* fd to pass */
31 /* Request structures */
33 /* following are the definitions of all the client<->server */
34 /* communication format; requests are from client to server, */
35 /* replies are from server to client. All requests must have */
36 /* a corresponding structure; the replies can be empty in */
37 /* which case it isn't necessary to define a structure. */
40 /* Create a new thread from the context of the parent */
41 struct new_thread_request
43 void* pid; /* process id for the new thread (or 0 if none yet) */
45 struct new_thread_reply
47 void* tid; /* thread id */
48 int thandle; /* thread handle (in the current process) */
49 void* pid; /* process id (created if necessary) */
50 int phandle; /* process handle (in the current process) */
54 /* Initialize a thread; called from the child after fork()/clone() */
55 struct init_thread_request
57 int unix_pid; /* Unix pid of new thread */
61 /* Terminate a process */
62 struct terminate_process_request
64 int handle; /* process handle to terminate */
65 int exit_code; /* process exit code */
69 /* Terminate a thread */
70 struct terminate_thread_request
72 int handle; /* thread handle to terminate */
73 int exit_code; /* thread exit code */
77 /* Retrieve information about a process */
78 struct get_process_info_request
80 int handle; /* process handle */
82 struct get_process_info_reply
84 void* pid; /* server process id */
85 int exit_code; /* process exit code */
89 /* Retrieve information about a thread */
90 struct get_thread_info_request
92 int handle; /* thread handle */
94 struct get_thread_info_reply
96 void* pid; /* server thread id */
97 int exit_code; /* thread exit code */
101 /* Close a handle for the current process */
102 struct close_handle_request
104 int handle; /* handle to close */
108 /* Duplicate a handle */
109 struct dup_handle_request
111 int src_process; /* src process handle */
112 int src_handle; /* src handle to duplicate */
113 int dst_process; /* dst process handle */
114 int dst_handle; /* handle to duplicate to (or -1 for any) */
115 unsigned int access; /* wanted access rights */
116 int inherit; /* inherit flag */
117 int options; /* duplicate options (see below) */
119 struct dup_handle_reply
121 int handle; /* duplicated handle in dst process */
125 /* Open a handle to a process */
126 struct open_process_request
128 void* pid; /* process id to open */
129 unsigned int access; /* wanted access rights */
130 int inherit; /* inherit flag */
132 struct open_process_reply
134 int handle; /* handle to the process */
138 /* Wait for handles */
139 struct select_request
141 int count; /* handles count */
142 int flags; /* wait flags (see below) */
143 int timeout; /* timeout in ms */
144 /* int handles[] */
146 struct select_reply
148 int signaled; /* signaled handle */
150 #define SELECT_ALL 1
151 #define SELECT_MSG 2
152 #define SELECT_ALERTABLE 4
153 #define SELECT_TIMEOUT 8
156 /* Create an event */
157 struct create_event_request
159 int manual_reset; /* manual reset event */
160 int initial_state; /* initial state of the event */
161 int inherit; /* inherit flag */
162 /* char name[] */
164 struct create_event_reply
166 int handle; /* handle to the event */
169 /* Event operation */
170 struct event_op_request
172 int handle; /* handle to event */
173 int op; /* event operation (see below) */
175 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
178 /* Create a mutex */
179 struct create_mutex_request
181 int owned; /* initially owned? */
182 int inherit; /* inherit flag */
183 /* char name[] */
185 struct create_mutex_reply
187 int handle; /* handle to the mutex */
191 /* Release a mutex */
192 struct release_mutex_request
194 int handle; /* handle to the mutex */
198 /* Create a semaphore */
199 struct create_semaphore_request
201 unsigned int initial; /* initial count */
202 unsigned int max; /* maximum count */
203 int inherit; /* inherit flag */
204 /* char name[] */
206 struct create_semaphore_reply
208 int handle; /* handle to the semaphore */
212 /* Release a semaphore */
213 struct release_semaphore_request
215 int handle; /* handle to the semaphore */
216 unsigned int count; /* count to add to semaphore */
218 struct release_semaphore_reply
220 unsigned int prev_count; /* previous semaphore count */
223 /* Open a named object (event, mutex, semaphore) */
224 struct open_named_obj_request
226 int type; /* object type (see below) */
227 unsigned int access; /* wanted access rights */
228 int inherit; /* inherit flag */
229 /* char name[] */
231 enum open_named_obj { OPEN_EVENT, OPEN_MUTEX, OPEN_SEMAPHORE };
233 struct open_named_obj_reply
235 int handle; /* handle to the object */
239 /* client-side functions */
241 #ifndef __WINE_SERVER__
243 /* client communication functions */
244 enum request;
245 #define CHECK_LEN(len,wanted) \
246 if ((len) == (wanted)) ; \
247 else CLIENT_ProtocolError( __FUNCTION__ ": len %d != %d\n", (len), (wanted) );
248 extern void CLIENT_ProtocolError( const char *err, ... );
249 extern void CLIENT_SendRequest( enum request req, int pass_fd,
250 int n, ... /* arg_1, len_1, etc. */ );
251 extern unsigned int CLIENT_WaitReply( int *len, int *passed_fd,
252 int n, ... /* arg_1, len_1, etc. */ );
254 struct _THDB;
255 extern int CLIENT_NewThread( struct _THDB *thdb, int *thandle, int *phandle );
256 extern int CLIENT_InitThread(void);
257 extern int CLIENT_TerminateProcess( int handle, int exit_code );
258 extern int CLIENT_TerminateThread( int handle, int exit_code );
259 extern int CLIENT_CloseHandle( int handle );
260 extern int CLIENT_DuplicateHandle( int src_process, int src_handle, int dst_process,
261 int dst_handle, DWORD access, BOOL32 inherit, DWORD options );
262 extern int CLIENT_GetThreadInfo( int handle, struct get_thread_info_reply *reply );
263 extern int CLIENT_GetProcessInfo( int handle, struct get_process_info_reply *reply );
264 extern int CLIENT_OpenProcess( void *pid, DWORD access, BOOL32 inherit );
265 extern int CLIENT_Select( int count, int *handles, int flags, int timeout );
266 #endif /* __WINE_SERVER__ */
268 #endif /* __WINE_SERVER_H */