Handle suspend/resume_thread requests in phase STARTING correctly.
[wine/multimedia.git] / include / server.h
blob50bc466c507765863375ca781d39d9e3543ac7f7
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) */
47 int suspend; /* new thread should be suspended on creation */
48 int tinherit; /* inherit flag for thread handle */
49 int pinherit; /* inherit flag for process handle */
51 struct new_thread_reply
53 void* tid; /* thread id */
54 int thandle; /* thread handle (in the current process) */
55 void* pid; /* process id (created if necessary) */
56 int phandle; /* process handle (in the current process) */
60 /* Set the server debug level */
61 struct set_debug_request
63 int level; /* New debug level */
67 /* Initialize a thread; called from the child after fork()/clone() */
68 struct init_thread_request
70 int unix_pid; /* Unix pid of new thread */
71 char cmd_line[0]; /* Thread command line */
75 /* Terminate a process */
76 struct terminate_process_request
78 int handle; /* process handle to terminate */
79 int exit_code; /* process exit code */
83 /* Terminate a thread */
84 struct terminate_thread_request
86 int handle; /* thread handle to terminate */
87 int exit_code; /* thread exit code */
91 /* Retrieve information about a process */
92 struct get_process_info_request
94 int handle; /* process handle */
96 struct get_process_info_reply
98 void* pid; /* server process id */
99 int exit_code; /* process exit code */
100 int priority; /* priority class */
101 int process_affinity; /* process affinity mask */
102 int system_affinity; /* system affinity mask */
106 /* Set a process informations */
107 struct set_process_info_request
109 int handle; /* process handle */
110 int mask; /* setting mask (see below) */
111 int priority; /* priority class */
112 int affinity; /* affinity mask */
114 #define SET_PROCESS_INFO_PRIORITY 0x01
115 #define SET_PROCESS_INFO_AFFINITY 0x02
118 /* Retrieve information about a thread */
119 struct get_thread_info_request
121 int handle; /* thread handle */
123 struct get_thread_info_reply
125 void* pid; /* server thread id */
126 int exit_code; /* thread exit code */
127 int priority; /* thread priority level */
131 /* Set a thread informations */
132 struct set_thread_info_request
134 int handle; /* thread handle */
135 int mask; /* setting mask (see below) */
136 int priority; /* priority class */
137 int affinity; /* affinity mask */
139 #define SET_THREAD_INFO_PRIORITY 0x01
140 #define SET_THREAD_INFO_AFFINITY 0x02
143 /* Suspend a thread */
144 struct suspend_thread_request
146 int handle; /* thread handle */
148 struct suspend_thread_reply
150 int count; /* new suspend count */
154 /* Resume a thread */
155 struct resume_thread_request
157 int handle; /* thread handle */
159 struct resume_thread_reply
161 int count; /* new suspend count */
165 /* Queue an APC for a thread */
166 struct queue_apc_request
168 int handle; /* thread handle */
169 void* func; /* function to call */
170 void* param; /* param for function to call */
174 /* Close a handle for the current process */
175 struct close_handle_request
177 int handle; /* handle to close */
181 /* Get information about a handle */
182 struct get_handle_info_request
184 int handle; /* handle we are interested in */
186 struct get_handle_info_reply
188 int flags; /* handle flags */
192 /* Set a handle information */
193 struct set_handle_info_request
195 int handle; /* handle we are interested in */
196 int flags; /* new handle flags */
197 int mask; /* mask for flags to set */
201 /* Duplicate a handle */
202 struct dup_handle_request
204 int src_process; /* src process handle */
205 int src_handle; /* src handle to duplicate */
206 int dst_process; /* dst process handle */
207 unsigned int access; /* wanted access rights */
208 int inherit; /* inherit flag */
209 int options; /* duplicate options (see below) */
211 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
212 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
213 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
214 struct dup_handle_reply
216 int handle; /* duplicated handle in dst process */
220 /* Open a handle to a process */
221 struct open_process_request
223 void* pid; /* process id to open */
224 unsigned int access; /* wanted access rights */
225 int inherit; /* inherit flag */
227 struct open_process_reply
229 int handle; /* handle to the process */
233 /* Wait for handles */
234 struct select_request
236 int count; /* handles count */
237 int flags; /* wait flags (see below) */
238 int timeout; /* timeout in ms */
239 /* int handles[] */
241 struct select_reply
243 int signaled; /* signaled handle */
244 /* void* apcs[]; */ /* async procedures to call */
246 #define SELECT_ALL 1
247 #define SELECT_ALERTABLE 2
248 #define SELECT_TIMEOUT 4
251 /* Create an event */
252 struct create_event_request
254 int manual_reset; /* manual reset event */
255 int initial_state; /* initial state of the event */
256 int inherit; /* inherit flag */
257 char name[0]; /* event name */
259 struct create_event_reply
261 int handle; /* handle to the event */
264 /* Event operation */
265 struct event_op_request
267 int handle; /* handle to event */
268 int op; /* event operation (see below) */
270 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
273 /* Create a mutex */
274 struct create_mutex_request
276 int owned; /* initially owned? */
277 int inherit; /* inherit flag */
278 char name[0]; /* mutex name */
280 struct create_mutex_reply
282 int handle; /* handle to the mutex */
286 /* Release a mutex */
287 struct release_mutex_request
289 int handle; /* handle to the mutex */
293 /* Create a semaphore */
294 struct create_semaphore_request
296 unsigned int initial; /* initial count */
297 unsigned int max; /* maximum count */
298 int inherit; /* inherit flag */
299 char name[0]; /* semaphore name */
301 struct create_semaphore_reply
303 int handle; /* handle to the semaphore */
307 /* Release a semaphore */
308 struct release_semaphore_request
310 int handle; /* handle to the semaphore */
311 unsigned int count; /* count to add to semaphore */
313 struct release_semaphore_reply
315 unsigned int prev_count; /* previous semaphore count */
319 /* Open a named object (event, mutex, semaphore) */
320 struct open_named_obj_request
322 int type; /* object type (see below) */
323 unsigned int access; /* wanted access rights */
324 int inherit; /* inherit flag */
325 char name[0]; /* object name */
327 enum open_named_obj { OPEN_EVENT, OPEN_MUTEX, OPEN_SEMAPHORE, OPEN_MAPPING };
329 struct open_named_obj_reply
331 int handle; /* handle to the object */
335 /* Create a file */
336 struct create_file_request
338 unsigned int access; /* wanted access rights */
339 int inherit; /* inherit flag */
340 unsigned int sharing; /* sharing flags */
341 int create; /* file create action */
342 unsigned int attrs; /* file attributes for creation */
343 char name[0]; /* file name */
345 struct create_file_reply
347 int handle; /* handle to the file */
351 /* Get a Unix fd to read from a file */
352 struct get_read_fd_request
354 int handle; /* handle to the file */
358 /* Get a Unix fd to write to a file */
359 struct get_write_fd_request
361 int handle; /* handle to the file */
365 /* Set a file current position */
366 struct set_file_pointer_request
368 int handle; /* handle to the file */
369 int low; /* position low word */
370 int high; /* position high word */
371 int whence; /* whence to seek */
373 struct set_file_pointer_reply
375 int low; /* new position low word */
376 int high; /* new position high word */
380 /* Truncate (or extend) a file */
381 struct truncate_file_request
383 int handle; /* handle to the file */
387 /* Set a file access and modification times */
388 struct set_file_time_request
390 int handle; /* handle to the file */
391 time_t access_time; /* last access time */
392 time_t write_time; /* last write time */
396 /* Flush a file buffers */
397 struct flush_file_request
399 int handle; /* handle to the file */
403 /* Get information about a file */
404 struct get_file_info_request
406 int handle; /* handle to the file */
408 struct get_file_info_reply
410 int type; /* file type */
411 int attr; /* file attributes */
412 time_t access_time; /* last access time */
413 time_t write_time; /* last write time */
414 int size_high; /* file size */
415 int size_low; /* file size */
416 int links; /* number of links */
417 int index_high; /* unique index */
418 int index_low; /* unique index */
419 unsigned int serial; /* volume serial number */
423 /* Lock a region of a file */
424 struct lock_file_request
426 int handle; /* handle to the file */
427 unsigned int offset_low; /* offset of start of lock */
428 unsigned int offset_high; /* offset of start of lock */
429 unsigned int count_low; /* count of bytes to lock */
430 unsigned int count_high; /* count of bytes to lock */
434 /* Unlock a region of a file */
435 struct unlock_file_request
437 int handle; /* handle to the file */
438 unsigned int offset_low; /* offset of start of unlock */
439 unsigned int offset_high; /* offset of start of unlock */
440 unsigned int count_low; /* count of bytes to unlock */
441 unsigned int count_high; /* count of bytes to unlock */
445 /* Create an anonymous pipe */
446 struct create_pipe_request
448 int inherit; /* inherit flag */
450 struct create_pipe_reply
452 int handle_read; /* handle to the read-side of the pipe */
453 int handle_write; /* handle to the write-side of the pipe */
457 /* Allocate a console for the current process */
458 struct alloc_console_request
463 /* Free the console of the current process */
464 struct free_console_request
469 /* Open a handle to the process console */
470 struct open_console_request
472 int output; /* input or output? */
473 unsigned int access; /* wanted access rights */
474 int inherit; /* inherit flag */
476 struct open_console_reply
478 int handle; /* handle to the console */
482 /* Set a console file descriptor */
483 struct set_console_fd_request
485 int handle; /* handle to the console */
486 int pid; /* pid of xterm (hack) */
490 /* Get a console mode (input or output) */
491 struct get_console_mode_request
493 int handle; /* handle to the console */
495 struct get_console_mode_reply
497 int mode; /* console mode */
501 /* Set a console mode (input or output) */
502 struct set_console_mode_request
504 int handle; /* handle to the console */
505 int mode; /* console mode */
509 /* Set info about a console (output only) */
510 struct set_console_info_request
512 int handle; /* handle to the console */
513 int mask; /* setting mask (see below) */
514 int cursor_size; /* size of cursor (percentage filled) */
515 int cursor_visible;/* cursor visibility flag */
516 char title[0]; /* console title */
518 #define SET_CONSOLE_INFO_CURSOR 0x01
519 #define SET_CONSOLE_INFO_TITLE 0x02
521 /* Get info about a console (output only) */
522 struct get_console_info_request
524 int handle; /* handle to the console */
526 struct get_console_info_reply
528 int cursor_size; /* size of cursor (percentage filled) */
529 int cursor_visible;/* cursor visibility flag */
530 int pid; /* pid of xterm (hack) */
531 /* char title[0]; */ /* console title */
535 /* Add input records to a console input queue */
536 struct write_console_input_request
538 int handle; /* handle to the console input */
539 int count; /* number of input records */
540 /* INPUT_RECORD records[0]; */ /* input records */
542 struct write_console_input_reply
544 int written; /* number of records written */
547 /* Fetch input records from a console input queue */
548 struct read_console_input_request
550 int handle; /* handle to the console input */
551 int count; /* max number of records to retrieve */
552 int flush; /* flush the retrieved records from the queue? */
554 struct read_console_input_reply
556 /* INPUT_RECORD records[0]; */ /* input records */
560 /* Create a change notification */
561 struct create_change_notification_request
563 int subtree; /* watch all the subtree */
564 int filter; /* notification filter */
566 struct create_change_notification_reply
568 int handle; /* handle to the change notification */
572 /* Create a file mapping */
573 struct create_mapping_request
575 int size_high; /* mapping size */
576 int size_low; /* mapping size */
577 int protect; /* protection flags (see below) */
578 int inherit; /* inherit flag */
579 int handle; /* file handle */
580 char name[0]; /* object name */
582 struct create_mapping_reply
584 int handle; /* handle to the mapping */
586 /* protection flags */
587 #define VPROT_READ 0x01
588 #define VPROT_WRITE 0x02
589 #define VPROT_EXEC 0x04
590 #define VPROT_WRITECOPY 0x08
591 #define VPROT_GUARD 0x10
592 #define VPROT_NOCACHE 0x20
593 #define VPROT_COMMITTED 0x40
596 /* Get information about a file mapping */
597 struct get_mapping_info_request
599 int handle; /* handle to the mapping */
601 struct get_mapping_info_reply
603 int size_high; /* mapping size */
604 int size_low; /* mapping size */
605 int protect; /* protection flags */
609 /* Create a device */
610 struct create_device_request
612 unsigned int access; /* wanted access rights */
613 int inherit; /* inherit flag */
614 int id; /* client private id */
616 struct create_device_reply
618 int handle; /* handle to the device */
622 /* Create a snapshot */
623 struct create_snapshot_request
625 int inherit; /* inherit flag */
626 int flags; /* snapshot flags (TH32CS_*) */
628 struct create_snapshot_reply
630 int handle; /* handle to the snapshot */
634 /* Get the next process from a snapshot */
635 struct next_process_request
637 int handle; /* handle to the snapshot */
638 int reset; /* reset snapshot position? */
640 struct next_process_reply
642 void* pid; /* process id */
643 int threads; /* number of threads */
644 int priority; /* process priority */
648 /* client-side functions */
650 #ifndef __WINE_SERVER__
652 #include "server/request.h"
654 /* client communication functions */
655 extern void CLIENT_SendRequest( enum request req, int pass_fd,
656 int n, ... /* arg_1, len_1, etc. */ );
657 extern unsigned int CLIENT_WaitReply( int *len, int *passed_fd,
658 int n, ... /* arg_1, len_1, etc. */ );
659 extern unsigned int CLIENT_WaitSimpleReply( void *reply, int len, int *passed_fd );
661 struct _THDB;
662 extern int CLIENT_NewThread( struct _THDB *thdb,
663 LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
664 int *thandle, int *phandle );
665 extern int CLIENT_SetDebug( int level );
666 extern int CLIENT_InitThread(void);
667 #endif /* __WINE_SERVER__ */
669 #endif /* __WINE_SERVER_H */