Hacked server-side device support
[wine/multimedia.git] / include / server.h
blobea5df051065354f2d24ca0a9582258396c9969e9
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>
13 /* message header as sent on the wire */
14 struct header
16 unsigned int len; /* total msg length (including this header) */
17 unsigned int type; /* msg type */
18 unsigned int seq; /* sequence number */
21 /* max msg length (not including the header) */
22 #define MAX_MSG_LENGTH (16384 - sizeof(struct header))
24 /* data structure used to pass an fd with sendmsg/recvmsg */
25 struct cmsg_fd
27 int len; /* sizeof structure */
28 int level; /* SOL_SOCKET */
29 int type; /* SCM_RIGHTS */
30 int fd; /* fd to pass */
34 /* Request structures */
36 /* following are the definitions of all the client<->server */
37 /* communication format; requests are from client to server, */
38 /* replies are from server to client. All requests must have */
39 /* a corresponding structure; the replies can be empty in */
40 /* which case it isn't necessary to define a structure. */
43 /* Create a new thread from the context of the parent */
44 struct new_thread_request
46 void* pid; /* process id for the new thread (or 0 if none yet) */
48 struct new_thread_reply
50 void* tid; /* thread id */
51 int thandle; /* thread handle (in the current process) */
52 void* pid; /* process id (created if necessary) */
53 int phandle; /* process handle (in the current process) */
57 /* Set the server debug level */
58 struct set_debug_request
60 int level; /* New debug level */
64 /* Initialize a thread; called from the child after fork()/clone() */
65 struct init_thread_request
67 int unix_pid; /* Unix pid of new thread */
68 char cmd_line[0]; /* Thread command line */
72 /* Terminate a process */
73 struct terminate_process_request
75 int handle; /* process handle to terminate */
76 int exit_code; /* process exit code */
80 /* Terminate a thread */
81 struct terminate_thread_request
83 int handle; /* thread handle to terminate */
84 int exit_code; /* thread exit code */
88 /* Retrieve information about a process */
89 struct get_process_info_request
91 int handle; /* process handle */
93 struct get_process_info_reply
95 void* pid; /* server process id */
96 int exit_code; /* process exit code */
97 int priority; /* priority class */
98 int process_affinity; /* process affinity mask */
99 int system_affinity; /* system affinity mask */
103 /* Set a process informations */
104 struct set_process_info_request
106 int handle; /* process handle */
107 int mask; /* setting mask (see below) */
108 int priority; /* priority class */
109 int affinity; /* affinity mask */
111 #define SET_PROCESS_INFO_PRIORITY 0x01
112 #define SET_PROCESS_INFO_AFFINITY 0x02
115 /* Retrieve information about a thread */
116 struct get_thread_info_request
118 int handle; /* thread handle */
120 struct get_thread_info_reply
122 void* pid; /* server thread id */
123 int exit_code; /* thread exit code */
124 int priority; /* thread priority level */
128 /* Set a thread informations */
129 struct set_thread_info_request
131 int handle; /* thread handle */
132 int mask; /* setting mask (see below) */
133 int priority; /* priority class */
134 int affinity; /* affinity mask */
136 #define SET_THREAD_INFO_PRIORITY 0x01
137 #define SET_THREAD_INFO_AFFINITY 0x02
140 /* Suspend a thread */
141 struct suspend_thread_request
143 int handle; /* thread handle */
145 struct suspend_thread_reply
147 int count; /* new suspend count */
151 /* Resume a thread */
152 struct resume_thread_request
154 int handle; /* thread handle */
156 struct resume_thread_reply
158 int count; /* new suspend count */
162 /* Queue an APC for a thread */
163 struct queue_apc_request
165 int handle; /* thread handle */
166 void* func; /* function to call */
167 void* param; /* param for function to call */
171 /* Close a handle for the current process */
172 struct close_handle_request
174 int handle; /* handle to close */
178 /* Duplicate a handle */
179 struct dup_handle_request
181 int src_process; /* src process handle */
182 int src_handle; /* src handle to duplicate */
183 int dst_process; /* dst process handle */
184 int dst_handle; /* handle to duplicate to (or -1 for any) */
185 unsigned int access; /* wanted access rights */
186 int inherit; /* inherit flag */
187 int options; /* duplicate options (see below) */
189 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
190 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
191 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
192 struct dup_handle_reply
194 int handle; /* duplicated handle in dst process */
198 /* Open a handle to a process */
199 struct open_process_request
201 void* pid; /* process id to open */
202 unsigned int access; /* wanted access rights */
203 int inherit; /* inherit flag */
205 struct open_process_reply
207 int handle; /* handle to the process */
211 /* Wait for handles */
212 struct select_request
214 int count; /* handles count */
215 int flags; /* wait flags (see below) */
216 int timeout; /* timeout in ms */
217 /* int handles[] */
219 struct select_reply
221 int signaled; /* signaled handle */
222 /* void* apcs[]; */ /* async procedures to call */
224 #define SELECT_ALL 1
225 #define SELECT_ALERTABLE 2
226 #define SELECT_TIMEOUT 4
229 /* Create an event */
230 struct create_event_request
232 int manual_reset; /* manual reset event */
233 int initial_state; /* initial state of the event */
234 int inherit; /* inherit flag */
235 char name[0]; /* event name */
237 struct create_event_reply
239 int handle; /* handle to the event */
242 /* Event operation */
243 struct event_op_request
245 int handle; /* handle to event */
246 int op; /* event operation (see below) */
248 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
251 /* Create a mutex */
252 struct create_mutex_request
254 int owned; /* initially owned? */
255 int inherit; /* inherit flag */
256 char name[0]; /* mutex name */
258 struct create_mutex_reply
260 int handle; /* handle to the mutex */
264 /* Release a mutex */
265 struct release_mutex_request
267 int handle; /* handle to the mutex */
271 /* Create a semaphore */
272 struct create_semaphore_request
274 unsigned int initial; /* initial count */
275 unsigned int max; /* maximum count */
276 int inherit; /* inherit flag */
277 char name[0]; /* semaphore name */
279 struct create_semaphore_reply
281 int handle; /* handle to the semaphore */
285 /* Release a semaphore */
286 struct release_semaphore_request
288 int handle; /* handle to the semaphore */
289 unsigned int count; /* count to add to semaphore */
291 struct release_semaphore_reply
293 unsigned int prev_count; /* previous semaphore count */
297 /* Open a named object (event, mutex, semaphore) */
298 struct open_named_obj_request
300 int type; /* object type (see below) */
301 unsigned int access; /* wanted access rights */
302 int inherit; /* inherit flag */
303 char name[0]; /* object name */
305 enum open_named_obj { OPEN_EVENT, OPEN_MUTEX, OPEN_SEMAPHORE, OPEN_MAPPING };
307 struct open_named_obj_reply
309 int handle; /* handle to the object */
313 /* Create a file */
314 struct create_file_request
316 unsigned int access; /* wanted access rights */
317 int inherit; /* inherit flag */
318 unsigned int sharing; /* sharing flags */
319 int create; /* file create action */
320 unsigned int attrs; /* file attributes for creation */
321 char name[0]; /* file name */
323 struct create_file_reply
325 int handle; /* handle to the file */
329 /* Get a Unix fd to read from a file */
330 struct get_read_fd_request
332 int handle; /* handle to the file */
336 /* Get a Unix fd to write to a file */
337 struct get_write_fd_request
339 int handle; /* handle to the file */
343 /* Set a file current position */
344 struct set_file_pointer_request
346 int handle; /* handle to the file */
347 int low; /* position low word */
348 int high; /* position high word */
349 int whence; /* whence to seek */
351 struct set_file_pointer_reply
353 int low; /* new position low word */
354 int high; /* new position high word */
358 /* Truncate (or extend) a file */
359 struct truncate_file_request
361 int handle; /* handle to the file */
365 /* Set a file access and modification times */
366 struct set_file_time_request
368 int handle; /* handle to the file */
369 time_t access_time; /* last access time */
370 time_t write_time; /* last write time */
374 /* Flush a file buffers */
375 struct flush_file_request
377 int handle; /* handle to the file */
381 /* Get information about a file */
382 struct get_file_info_request
384 int handle; /* handle to the file */
386 struct get_file_info_reply
388 int type; /* file type */
389 int attr; /* file attributes */
390 time_t access_time; /* last access time */
391 time_t write_time; /* last write time */
392 int size_high; /* file size */
393 int size_low; /* file size */
394 int links; /* number of links */
395 int index_high; /* unique index */
396 int index_low; /* unique index */
397 unsigned int serial; /* volume serial number */
401 /* Lock a region of a file */
402 struct lock_file_request
404 int handle; /* handle to the file */
405 unsigned int offset_low; /* offset of start of lock */
406 unsigned int offset_high; /* offset of start of lock */
407 unsigned int count_low; /* count of bytes to lock */
408 unsigned int count_high; /* count of bytes to lock */
412 /* Unlock a region of a file */
413 struct unlock_file_request
415 int handle; /* handle to the file */
416 unsigned int offset_low; /* offset of start of unlock */
417 unsigned int offset_high; /* offset of start of unlock */
418 unsigned int count_low; /* count of bytes to unlock */
419 unsigned int count_high; /* count of bytes to unlock */
423 /* Create an anonymous pipe */
424 struct create_pipe_request
426 int inherit; /* inherit flag */
428 struct create_pipe_reply
430 int handle_read; /* handle to the read-side of the pipe */
431 int handle_write; /* handle to the write-side of the pipe */
435 /* Allocate a console for the current process */
436 struct alloc_console_request
441 /* Free the console of the current process */
442 struct free_console_request
447 /* Open a handle to the process console */
448 struct open_console_request
450 int output; /* input or output? */
451 unsigned int access; /* wanted access rights */
452 int inherit; /* inherit flag */
454 struct open_console_reply
456 int handle; /* handle to the console */
460 /* Set a console file descriptor */
461 struct set_console_fd_request
463 int handle; /* handle to the console */
464 int pid; /* pid of xterm (hack) */
468 /* Get a console mode (input or output) */
469 struct get_console_mode_request
471 int handle; /* handle to the console */
473 struct get_console_mode_reply
475 int mode; /* console mode */
479 /* Set a console mode (input or output) */
480 struct set_console_mode_request
482 int handle; /* handle to the console */
483 int mode; /* console mode */
487 /* Set info about a console (output only) */
488 struct set_console_info_request
490 int handle; /* handle to the console */
491 int mask; /* setting mask (see below) */
492 int cursor_size; /* size of cursor (percentage filled) */
493 int cursor_visible;/* cursor visibility flag */
494 char title[0]; /* console title */
496 #define SET_CONSOLE_INFO_CURSOR 0x01
497 #define SET_CONSOLE_INFO_TITLE 0x02
499 /* Get info about a console (output only) */
500 struct get_console_info_request
502 int handle; /* handle to the console */
504 struct get_console_info_reply
506 int cursor_size; /* size of cursor (percentage filled) */
507 int cursor_visible;/* cursor visibility flag */
508 int pid; /* pid of xterm (hack) */
509 /* char title[0]; */ /* console title */
513 /* Create a change notification */
514 struct create_change_notification_request
516 int subtree; /* watch all the subtree */
517 int filter; /* notification filter */
519 struct create_change_notification_reply
521 int handle; /* handle to the change notification */
525 /* Create a file mapping */
526 struct create_mapping_request
528 int size_high; /* mapping size */
529 int size_low; /* mapping size */
530 int protect; /* protection flags (see below) */
531 int handle; /* file handle */
532 char name[0]; /* object name */
534 struct create_mapping_reply
536 int handle; /* handle to the mapping */
538 /* protection flags */
539 #define VPROT_READ 0x01
540 #define VPROT_WRITE 0x02
541 #define VPROT_EXEC 0x04
542 #define VPROT_WRITECOPY 0x08
543 #define VPROT_GUARD 0x10
544 #define VPROT_NOCACHE 0x20
545 #define VPROT_COMMITTED 0x40
548 /* Get information about a file mapping */
549 struct get_mapping_info_request
551 int handle; /* handle to the mapping */
553 struct get_mapping_info_reply
555 int size_high; /* mapping size */
556 int size_low; /* mapping size */
557 int protect; /* protection flags */
561 /* Create a device */
562 struct create_device_request
564 unsigned int access; /* wanted access rights */
565 int inherit; /* inherit flag */
566 int id; /* client private id */
568 struct create_device_reply
570 int handle; /* handle to the device */
574 /* client-side functions */
576 #ifndef __WINE_SERVER__
578 #include "server/request.h"
580 /* client communication functions */
581 extern void CLIENT_SendRequest( enum request req, int pass_fd,
582 int n, ... /* arg_1, len_1, etc. */ );
583 extern unsigned int CLIENT_WaitReply( int *len, int *passed_fd,
584 int n, ... /* arg_1, len_1, etc. */ );
585 extern unsigned int CLIENT_WaitSimpleReply( void *reply, int len, int *passed_fd );
587 struct _THDB;
588 extern int CLIENT_NewThread( struct _THDB *thdb, int *thandle, int *phandle );
589 extern int CLIENT_SetDebug( int level );
590 extern int CLIENT_InitThread(void);
591 extern int CLIENT_CloseHandle( int handle );
592 extern int CLIENT_DuplicateHandle( int src_process, int src_handle, int dst_process,
593 int dst_handle, DWORD access, BOOL32 inherit, DWORD options );
594 extern int CLIENT_OpenProcess( void *pid, DWORD access, BOOL32 inherit );
595 #endif /* __WINE_SERVER__ */
597 #endif /* __WINE_SERVER_H */