Added command line tool to access the registry.
[wine/multimedia.git] / include / server.h
blobfcce2a57b8e3a902734e8daf77a89822ae0ac014
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 /* Get information about a handle */
179 struct get_handle_info_request
181 int handle; /* handle we are interested in */
183 struct get_handle_info_reply
185 int flags; /* handle flags */
189 /* Set a handle information */
190 struct set_handle_info_request
192 int handle; /* handle we are interested in */
193 int flags; /* new handle flags */
194 int mask; /* mask for flags to set */
198 /* Duplicate a handle */
199 struct dup_handle_request
201 int src_process; /* src process handle */
202 int src_handle; /* src handle to duplicate */
203 int dst_process; /* dst process handle */
204 unsigned int access; /* wanted access rights */
205 int inherit; /* inherit flag */
206 int options; /* duplicate options (see below) */
208 #define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
209 #define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
210 #define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
211 struct dup_handle_reply
213 int handle; /* duplicated handle in dst process */
217 /* Open a handle to a process */
218 struct open_process_request
220 void* pid; /* process id to open */
221 unsigned int access; /* wanted access rights */
222 int inherit; /* inherit flag */
224 struct open_process_reply
226 int handle; /* handle to the process */
230 /* Wait for handles */
231 struct select_request
233 int count; /* handles count */
234 int flags; /* wait flags (see below) */
235 int timeout; /* timeout in ms */
236 /* int handles[] */
238 struct select_reply
240 int signaled; /* signaled handle */
241 /* void* apcs[]; */ /* async procedures to call */
243 #define SELECT_ALL 1
244 #define SELECT_ALERTABLE 2
245 #define SELECT_TIMEOUT 4
248 /* Create an event */
249 struct create_event_request
251 int manual_reset; /* manual reset event */
252 int initial_state; /* initial state of the event */
253 int inherit; /* inherit flag */
254 char name[0]; /* event name */
256 struct create_event_reply
258 int handle; /* handle to the event */
261 /* Event operation */
262 struct event_op_request
264 int handle; /* handle to event */
265 int op; /* event operation (see below) */
267 enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
270 /* Create a mutex */
271 struct create_mutex_request
273 int owned; /* initially owned? */
274 int inherit; /* inherit flag */
275 char name[0]; /* mutex name */
277 struct create_mutex_reply
279 int handle; /* handle to the mutex */
283 /* Release a mutex */
284 struct release_mutex_request
286 int handle; /* handle to the mutex */
290 /* Create a semaphore */
291 struct create_semaphore_request
293 unsigned int initial; /* initial count */
294 unsigned int max; /* maximum count */
295 int inherit; /* inherit flag */
296 char name[0]; /* semaphore name */
298 struct create_semaphore_reply
300 int handle; /* handle to the semaphore */
304 /* Release a semaphore */
305 struct release_semaphore_request
307 int handle; /* handle to the semaphore */
308 unsigned int count; /* count to add to semaphore */
310 struct release_semaphore_reply
312 unsigned int prev_count; /* previous semaphore count */
316 /* Open a named object (event, mutex, semaphore) */
317 struct open_named_obj_request
319 int type; /* object type (see below) */
320 unsigned int access; /* wanted access rights */
321 int inherit; /* inherit flag */
322 char name[0]; /* object name */
324 enum open_named_obj { OPEN_EVENT, OPEN_MUTEX, OPEN_SEMAPHORE, OPEN_MAPPING };
326 struct open_named_obj_reply
328 int handle; /* handle to the object */
332 /* Create a file */
333 struct create_file_request
335 unsigned int access; /* wanted access rights */
336 int inherit; /* inherit flag */
337 unsigned int sharing; /* sharing flags */
338 int create; /* file create action */
339 unsigned int attrs; /* file attributes for creation */
340 char name[0]; /* file name */
342 struct create_file_reply
344 int handle; /* handle to the file */
348 /* Get a Unix fd to read from a file */
349 struct get_read_fd_request
351 int handle; /* handle to the file */
355 /* Get a Unix fd to write to a file */
356 struct get_write_fd_request
358 int handle; /* handle to the file */
362 /* Set a file current position */
363 struct set_file_pointer_request
365 int handle; /* handle to the file */
366 int low; /* position low word */
367 int high; /* position high word */
368 int whence; /* whence to seek */
370 struct set_file_pointer_reply
372 int low; /* new position low word */
373 int high; /* new position high word */
377 /* Truncate (or extend) a file */
378 struct truncate_file_request
380 int handle; /* handle to the file */
384 /* Set a file access and modification times */
385 struct set_file_time_request
387 int handle; /* handle to the file */
388 time_t access_time; /* last access time */
389 time_t write_time; /* last write time */
393 /* Flush a file buffers */
394 struct flush_file_request
396 int handle; /* handle to the file */
400 /* Get information about a file */
401 struct get_file_info_request
403 int handle; /* handle to the file */
405 struct get_file_info_reply
407 int type; /* file type */
408 int attr; /* file attributes */
409 time_t access_time; /* last access time */
410 time_t write_time; /* last write time */
411 int size_high; /* file size */
412 int size_low; /* file size */
413 int links; /* number of links */
414 int index_high; /* unique index */
415 int index_low; /* unique index */
416 unsigned int serial; /* volume serial number */
420 /* Lock a region of a file */
421 struct lock_file_request
423 int handle; /* handle to the file */
424 unsigned int offset_low; /* offset of start of lock */
425 unsigned int offset_high; /* offset of start of lock */
426 unsigned int count_low; /* count of bytes to lock */
427 unsigned int count_high; /* count of bytes to lock */
431 /* Unlock a region of a file */
432 struct unlock_file_request
434 int handle; /* handle to the file */
435 unsigned int offset_low; /* offset of start of unlock */
436 unsigned int offset_high; /* offset of start of unlock */
437 unsigned int count_low; /* count of bytes to unlock */
438 unsigned int count_high; /* count of bytes to unlock */
442 /* Create an anonymous pipe */
443 struct create_pipe_request
445 int inherit; /* inherit flag */
447 struct create_pipe_reply
449 int handle_read; /* handle to the read-side of the pipe */
450 int handle_write; /* handle to the write-side of the pipe */
454 /* Allocate a console for the current process */
455 struct alloc_console_request
460 /* Free the console of the current process */
461 struct free_console_request
466 /* Open a handle to the process console */
467 struct open_console_request
469 int output; /* input or output? */
470 unsigned int access; /* wanted access rights */
471 int inherit; /* inherit flag */
473 struct open_console_reply
475 int handle; /* handle to the console */
479 /* Set a console file descriptor */
480 struct set_console_fd_request
482 int handle; /* handle to the console */
483 int pid; /* pid of xterm (hack) */
487 /* Get a console mode (input or output) */
488 struct get_console_mode_request
490 int handle; /* handle to the console */
492 struct get_console_mode_reply
494 int mode; /* console mode */
498 /* Set a console mode (input or output) */
499 struct set_console_mode_request
501 int handle; /* handle to the console */
502 int mode; /* console mode */
506 /* Set info about a console (output only) */
507 struct set_console_info_request
509 int handle; /* handle to the console */
510 int mask; /* setting mask (see below) */
511 int cursor_size; /* size of cursor (percentage filled) */
512 int cursor_visible;/* cursor visibility flag */
513 char title[0]; /* console title */
515 #define SET_CONSOLE_INFO_CURSOR 0x01
516 #define SET_CONSOLE_INFO_TITLE 0x02
518 /* Get info about a console (output only) */
519 struct get_console_info_request
521 int handle; /* handle to the console */
523 struct get_console_info_reply
525 int cursor_size; /* size of cursor (percentage filled) */
526 int cursor_visible;/* cursor visibility flag */
527 int pid; /* pid of xterm (hack) */
528 /* char title[0]; */ /* console title */
532 /* Add input records to a console input queue */
533 struct write_console_input_request
535 int handle; /* handle to the console input */
536 int count; /* number of input records */
537 /* INPUT_RECORD records[0]; */ /* input records */
539 struct write_console_input_reply
541 int written; /* number of records written */
544 /* Fetch input records from a console input queue */
545 struct read_console_input_request
547 int handle; /* handle to the console input */
548 int count; /* max number of records to retrieve */
549 int flush; /* flush the retrieved records from the queue? */
551 struct read_console_input_reply
553 /* INPUT_RECORD records[0]; */ /* input records */
557 /* Create a change notification */
558 struct create_change_notification_request
560 int subtree; /* watch all the subtree */
561 int filter; /* notification filter */
563 struct create_change_notification_reply
565 int handle; /* handle to the change notification */
569 /* Create a file mapping */
570 struct create_mapping_request
572 int size_high; /* mapping size */
573 int size_low; /* mapping size */
574 int protect; /* protection flags (see below) */
575 int inherit; /* inherit flag */
576 int handle; /* file handle */
577 char name[0]; /* object name */
579 struct create_mapping_reply
581 int handle; /* handle to the mapping */
583 /* protection flags */
584 #define VPROT_READ 0x01
585 #define VPROT_WRITE 0x02
586 #define VPROT_EXEC 0x04
587 #define VPROT_WRITECOPY 0x08
588 #define VPROT_GUARD 0x10
589 #define VPROT_NOCACHE 0x20
590 #define VPROT_COMMITTED 0x40
593 /* Get information about a file mapping */
594 struct get_mapping_info_request
596 int handle; /* handle to the mapping */
598 struct get_mapping_info_reply
600 int size_high; /* mapping size */
601 int size_low; /* mapping size */
602 int protect; /* protection flags */
606 /* Create a device */
607 struct create_device_request
609 unsigned int access; /* wanted access rights */
610 int inherit; /* inherit flag */
611 int id; /* client private id */
613 struct create_device_reply
615 int handle; /* handle to the device */
619 /* Create a snapshot */
620 struct create_snapshot_request
622 int inherit; /* inherit flag */
623 int flags; /* snapshot flags (TH32CS_*) */
625 struct create_snapshot_reply
627 int handle; /* handle to the snapshot */
631 /* Get the next process from a snapshot */
632 struct next_process_request
634 int handle; /* handle to the snapshot */
635 int reset; /* reset snapshot position? */
637 struct next_process_reply
639 void* pid; /* process id */
640 int threads; /* number of threads */
641 int priority; /* process priority */
645 /* client-side functions */
647 #ifndef __WINE_SERVER__
649 #include "server/request.h"
651 /* client communication functions */
652 extern void CLIENT_SendRequest( enum request req, int pass_fd,
653 int n, ... /* arg_1, len_1, etc. */ );
654 extern unsigned int CLIENT_WaitReply( int *len, int *passed_fd,
655 int n, ... /* arg_1, len_1, etc. */ );
656 extern unsigned int CLIENT_WaitSimpleReply( void *reply, int len, int *passed_fd );
658 struct _THDB;
659 extern int CLIENT_NewThread( struct _THDB *thdb, int *thandle, int *phandle );
660 extern int CLIENT_SetDebug( int level );
661 extern int CLIENT_InitThread(void);
662 #endif /* __WINE_SERVER__ */
664 #endif /* __WINE_SERVER_H */