source: trunk/include/win/server.h@ 1036

Last change on this file since 1036 was 4, checked in by ktk, 26 years ago

Import

File size: 18.9 KB
Line 
1/* $Id: server.h,v 1.1 1999-05-24 20:19:18 ktk Exp $ */
2
3/*
4 * Wine server definitions
5 *
6 * Copyright (C) 1998 Alexandre Julliard
7 */
8
9#ifndef __WINE_SERVER_H
10#define __WINE_SERVER_H
11
12#include <stdlib.h>
13#include <time.h>
14
15/* message header as sent on the wire */
16struct header
17{
18 unsigned int len; /* total msg length (including this header) */
19 unsigned int type; /* msg type */
20 unsigned int seq; /* sequence number */
21};
22
23/* max msg length (not including the header) */
24#define MAX_MSG_LENGTH (16384 - sizeof(struct header))
25
26/* data structure used to pass an fd with sendmsg/recvmsg */
27struct cmsg_fd
28{
29 int len; /* sizeof structure */
30 int level; /* SOL_SOCKET */
31 int type; /* SCM_RIGHTS */
32 int fd; /* fd to pass */
33};
34
35
36/* Request structures */
37
38/* following are the definitions of all the client<->server */
39/* communication format; requests are from client to server, */
40/* replies are from server to client. All requests must have */
41/* a corresponding structure; the replies can be empty in */
42/* which case it isn't necessary to define a structure. */
43
44
45/* Create a new process from the context of the parent */
46struct new_process_request
47{
48 int inherit; /* inherit flag */
49 int inherit_all; /* inherit all handles from parent */
50 int start_flags; /* flags from startup info */
51 int hstdin; /* handle for stdin */
52 int hstdout; /* handle for stdout */
53 int hstderr; /* handle for stderr */
54 void* env_ptr; /* pointer to environment (FIXME: hack) */
55 char cmd_line[0]; /* command line */
56};
57struct new_process_reply
58{
59 void* pid; /* process id */
60 int handle; /* process handle (in the current process) */
61};
62
63
64/* Create a new thread from the context of the parent */
65struct new_thread_request
66{
67 void* pid; /* process id for the new thread */
68 int suspend; /* new thread should be suspended on creation */
69 int inherit; /* inherit flag */
70};
71struct new_thread_reply
72{
73 void* tid; /* thread id */
74 int handle; /* thread handle (in the current process) */
75};
76
77
78/* Set the server debug level */
79struct set_debug_request
80{
81 int level; /* New debug level */
82};
83
84
85/* Initialize a process; called from the new process context */
86struct init_process_request
87{
88 int dummy;
89};
90struct init_process_reply
91{
92 int start_flags; /* flags from startup info */
93 int hstdin; /* handle for stdin */
94 int hstdout; /* handle for stdout */
95 int hstderr; /* handle for stderr */
96 void* env_ptr; /* pointer to environment (FIXME: hack) */
97};
98
99
100/* Initialize a thread; called from the child after fork()/clone() */
101struct init_thread_request
102{
103 int unix_pid; /* Unix pid of new thread */
104};
105struct init_thread_reply
106{
107 void* pid; /* process id of the new thread's process */
108 void* tid; /* thread id of the new thread */
109};
110
111
112/* Terminate a process */
113struct terminate_process_request
114{
115 int handle; /* process handle to terminate */
116 int exit_code; /* process exit code */
117};
118
119
120/* Terminate a thread */
121struct terminate_thread_request
122{
123 int handle; /* thread handle to terminate */
124 int exit_code; /* thread exit code */
125};
126
127
128/* Retrieve information about a process */
129struct get_process_info_request
130{
131 int handle; /* process handle */
132};
133struct get_process_info_reply
134{
135 void* pid; /* server process id */
136 int exit_code; /* process exit code */
137 int priority; /* priority class */
138 int process_affinity; /* process affinity mask */
139 int system_affinity; /* system affinity mask */
140};
141
142
143/* Set a process informations */
144struct set_process_info_request
145{
146 int handle; /* process handle */
147 int mask; /* setting mask (see below) */
148 int priority; /* priority class */
149 int affinity; /* affinity mask */
150};
151#define SET_PROCESS_INFO_PRIORITY 0x01
152#define SET_PROCESS_INFO_AFFINITY 0x02
153
154
155/* Retrieve information about a thread */
156struct get_thread_info_request
157{
158 int handle; /* thread handle */
159};
160struct get_thread_info_reply
161{
162 void* tid; /* server thread id */
163 int exit_code; /* thread exit code */
164 int priority; /* thread priority level */
165};
166
167
168/* Set a thread informations */
169struct set_thread_info_request
170{
171 int handle; /* thread handle */
172 int mask; /* setting mask (see below) */
173 int priority; /* priority class */
174 int affinity; /* affinity mask */
175};
176#define SET_THREAD_INFO_PRIORITY 0x01
177#define SET_THREAD_INFO_AFFINITY 0x02
178
179
180/* Suspend a thread */
181struct suspend_thread_request
182{
183 int handle; /* thread handle */
184};
185struct suspend_thread_reply
186{
187 int count; /* new suspend count */
188};
189
190
191/* Resume a thread */
192struct resume_thread_request
193{
194 int handle; /* thread handle */
195};
196struct resume_thread_reply
197{
198 int count; /* new suspend count */
199};
200
201
202/* Debugger support: freeze / unfreeze */
203struct debugger_request
204{
205 int op; /* operation type */
206};
207
208enum debugger_op { DEBUGGER_FREEZE_ALL, DEBUGGER_UNFREEZE_ALL };
209
210
211/* Queue an APC for a thread */
212struct queue_apc_request
213{
214 int handle; /* thread handle */
215 void* func; /* function to call */
216 void* param; /* param for function to call */
217};
218
219
220/* Close a handle for the current process */
221struct close_handle_request
222{
223 int handle; /* handle to close */
224};
225
226
227/* Get information about a handle */
228struct get_handle_info_request
229{
230 int handle; /* handle we are interested in */
231};
232struct get_handle_info_reply
233{
234 int flags; /* handle flags */
235};
236
237
238/* Set a handle information */
239struct set_handle_info_request
240{
241 int handle; /* handle we are interested in */
242 int flags; /* new handle flags */
243 int mask; /* mask for flags to set */
244};
245
246
247/* Duplicate a handle */
248struct dup_handle_request
249{
250 int src_process; /* src process handle */
251 int src_handle; /* src handle to duplicate */
252 int dst_process; /* dst process handle */
253 unsigned int access; /* wanted access rights */
254 int inherit; /* inherit flag */
255 int options; /* duplicate options (see below) */
256};
257#define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
258#define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
259#define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
260struct dup_handle_reply
261{
262 int handle; /* duplicated handle in dst process */
263};
264
265
266/* Open a handle to a process */
267struct open_process_request
268{
269 void* pid; /* process id to open */
270 unsigned int access; /* wanted access rights */
271 int inherit; /* inherit flag */
272};
273struct open_process_reply
274{
275 int handle; /* handle to the process */
276};
277
278
279/* Wait for handles */
280struct select_request
281{
282 int count; /* handles count */
283 int flags; /* wait flags (see below) */
284 int timeout; /* timeout in ms */
285 /* int handles[] */
286};
287struct select_reply
288{
289 int signaled; /* signaled handle */
290/* void* apcs[]; */ /* async procedures to call */
291};
292#define SELECT_ALL 1
293#define SELECT_ALERTABLE 2
294#define SELECT_TIMEOUT 4
295
296
297/* Create an event */
298struct create_event_request
299{
300 int manual_reset; /* manual reset event */
301 int initial_state; /* initial state of the event */
302 int inherit; /* inherit flag */
303 char name[0]; /* event name */
304};
305struct create_event_reply
306{
307 int handle; /* handle to the event */
308};
309
310/* Event operation */
311struct event_op_request
312{
313 int handle; /* handle to event */
314 int op; /* event operation (see below) */
315};
316enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
317
318
319/* Create a mutex */
320struct create_mutex_request
321{
322 int owned; /* initially owned? */
323 int inherit; /* inherit flag */
324 char name[0]; /* mutex name */
325};
326struct create_mutex_reply
327{
328 int handle; /* handle to the mutex */
329};
330
331
332/* Release a mutex */
333struct release_mutex_request
334{
335 int handle; /* handle to the mutex */
336};
337
338
339/* Create a semaphore */
340struct create_semaphore_request
341{
342 unsigned int initial; /* initial count */
343 unsigned int max; /* maximum count */
344 int inherit; /* inherit flag */
345 char name[0]; /* semaphore name */
346};
347struct create_semaphore_reply
348{
349 int handle; /* handle to the semaphore */
350};
351
352
353/* Release a semaphore */
354struct release_semaphore_request
355{
356 int handle; /* handle to the semaphore */
357 unsigned int count; /* count to add to semaphore */
358};
359struct release_semaphore_reply
360{
361 unsigned int prev_count; /* previous semaphore count */
362};
363
364
365/* Open a named object (event, mutex, semaphore) */
366struct open_named_obj_request
367{
368 int type; /* object type (see below) */
369 unsigned int access; /* wanted access rights */
370 int inherit; /* inherit flag */
371 char name[0]; /* object name */
372};
373enum open_named_obj { OPEN_EVENT, OPEN_MUTEX, OPEN_SEMAPHORE, OPEN_MAPPING };
374
375struct open_named_obj_reply
376{
377 int handle; /* handle to the object */
378};
379
380
381/* Create a file */
382struct create_file_request
383{
384 unsigned int access; /* wanted access rights */
385 int inherit; /* inherit flag */
386 unsigned int sharing; /* sharing flags */
387 int create; /* file create action */
388 unsigned int attrs; /* file attributes for creation */
389 char name[0]; /* file name */
390};
391struct create_file_reply
392{
393 int handle; /* handle to the file */
394};
395
396
397/* Get a Unix fd to read from a file */
398struct get_read_fd_request
399{
400 int handle; /* handle to the file */
401};
402
403
404/* Get a Unix fd to write to a file */
405struct get_write_fd_request
406{
407 int handle; /* handle to the file */
408};
409
410
411/* Set a file current position */
412struct set_file_pointer_request
413{
414 int handle; /* handle to the file */
415 int low; /* position low word */
416 int high; /* position high word */
417 int whence; /* whence to seek */
418};
419struct set_file_pointer_reply
420{
421 int low; /* new position low word */
422 int high; /* new position high word */
423};
424
425
426/* Truncate (or extend) a file */
427struct truncate_file_request
428{
429 int handle; /* handle to the file */
430};
431
432
433/* Set a file access and modification times */
434struct set_file_time_request
435{
436 int handle; /* handle to the file */
437 time_t access_time; /* last access time */
438 time_t write_time; /* last write time */
439};
440
441
442/* Flush a file buffers */
443struct flush_file_request
444{
445 int handle; /* handle to the file */
446};
447
448
449/* Get information about a file */
450struct get_file_info_request
451{
452 int handle; /* handle to the file */
453};
454struct get_file_info_reply
455{
456 int type; /* file type */
457 int attr; /* file attributes */
458 time_t access_time; /* last access time */
459 time_t write_time; /* last write time */
460 int size_high; /* file size */
461 int size_low; /* file size */
462 int links; /* number of links */
463 int index_high; /* unique index */
464 int index_low; /* unique index */
465 unsigned int serial; /* volume serial number */
466};
467
468
469/* Lock a region of a file */
470struct lock_file_request
471{
472 int handle; /* handle to the file */
473 unsigned int offset_low; /* offset of start of lock */
474 unsigned int offset_high; /* offset of start of lock */
475 unsigned int count_low; /* count of bytes to lock */
476 unsigned int count_high; /* count of bytes to lock */
477};
478
479
480/* Unlock a region of a file */
481struct unlock_file_request
482{
483 int handle; /* handle to the file */
484 unsigned int offset_low; /* offset of start of unlock */
485 unsigned int offset_high; /* offset of start of unlock */
486 unsigned int count_low; /* count of bytes to unlock */
487 unsigned int count_high; /* count of bytes to unlock */
488};
489
490
491/* Create an anonymous pipe */
492struct create_pipe_request
493{
494 int inherit; /* inherit flag */
495};
496struct create_pipe_reply
497{
498 int handle_read; /* handle to the read-side of the pipe */
499 int handle_write; /* handle to the write-side of the pipe */
500};
501
502
503/* Allocate a console for the current process */
504struct alloc_console_request
505{
506};
507
508
509/* Free the console of the current process */
510struct free_console_request
511{
512};
513
514
515/* Open a handle to the process console */
516struct open_console_request
517{
518 int output; /* input or output? */
519 unsigned int access; /* wanted access rights */
520 int inherit; /* inherit flag */
521};
522struct open_console_reply
523{
524 int handle; /* handle to the console */
525};
526
527
528/* Set a console file descriptor */
529struct set_console_fd_request
530{
531 int handle; /* handle to the console */
532 int pid; /* pid of xterm (hack) */
533};
534
535
536/* Get a console mode (input or output) */
537struct get_console_mode_request
538{
539 int handle; /* handle to the console */
540};
541struct get_console_mode_reply
542{
543 int mode; /* console mode */
544};
545
546
547/* Set a console mode (input or output) */
548struct set_console_mode_request
549{
550 int handle; /* handle to the console */
551 int mode; /* console mode */
552};
553
554
555/* Set info about a console (output only) */
556struct set_console_info_request
557{
558 int handle; /* handle to the console */
559 int mask; /* setting mask (see below) */
560 int cursor_size; /* size of cursor (percentage filled) */
561 int cursor_visible;/* cursor visibility flag */
562 char title[0]; /* console title */
563};
564#define SET_CONSOLE_INFO_CURSOR 0x01
565#define SET_CONSOLE_INFO_TITLE 0x02
566
567/* Get info about a console (output only) */
568struct get_console_info_request
569{
570 int handle; /* handle to the console */
571};
572struct get_console_info_reply
573{
574 int cursor_size; /* size of cursor (percentage filled) */
575 int cursor_visible;/* cursor visibility flag */
576 int pid; /* pid of xterm (hack) */
577/* char title[0]; */ /* console title */
578};
579
580
581/* Add input records to a console input queue */
582struct write_console_input_request
583{
584 int handle; /* handle to the console input */
585 int count; /* number of input records */
586/* INPUT_RECORD records[0]; */ /* input records */
587};
588struct write_console_input_reply
589{
590 int written; /* number of records written */
591};
592
593/* Fetch input records from a console input queue */
594struct read_console_input_request
595{
596 int handle; /* handle to the console input */
597 int count; /* max number of records to retrieve */
598 int flush; /* flush the retrieved records from the queue? */
599};
600struct read_console_input_reply
601{
602/* INPUT_RECORD records[0]; */ /* input records */
603};
604
605
606/* Create a change notification */
607struct create_change_notification_request
608{
609 int subtree; /* watch all the subtree */
610 int filter; /* notification filter */
611};
612struct create_change_notification_reply
613{
614 int handle; /* handle to the change notification */
615};
616
617
618/* Create a file mapping */
619struct create_mapping_request
620{
621 int size_high; /* mapping size */
622 int size_low; /* mapping size */
623 int protect; /* protection flags (see below) */
624 int inherit; /* inherit flag */
625 int handle; /* file handle */
626 char name[0]; /* object name */
627};
628struct create_mapping_reply
629{
630 int handle; /* handle to the mapping */
631};
632/* protection flags */
633#define VPROT_READ 0x01
634#define VPROT_WRITE 0x02
635#define VPROT_EXEC 0x04
636#define VPROT_WRITECOPY 0x08
637#define VPROT_GUARD 0x10
638#define VPROT_NOCACHE 0x20
639#define VPROT_COMMITTED 0x40
640
641
642/* Get information about a file mapping */
643struct get_mapping_info_request
644{
645 int handle; /* handle to the mapping */
646};
647struct get_mapping_info_reply
648{
649 int size_high; /* mapping size */
650 int size_low; /* mapping size */
651 int protect; /* protection flags */
652};
653
654
655/* Create a device */
656struct create_device_request
657{
658 unsigned int access; /* wanted access rights */
659 int inherit; /* inherit flag */
660 int id; /* client private id */
661};
662struct create_device_reply
663{
664 int handle; /* handle to the device */
665};
666
667
668/* Create a snapshot */
669struct create_snapshot_request
670{
671 int inherit; /* inherit flag */
672 int flags; /* snapshot flags (TH32CS_*) */
673};
674struct create_snapshot_reply
675{
676 int handle; /* handle to the snapshot */
677};
678
679
680/* Get the next process from a snapshot */
681struct next_process_request
682{
683 int handle; /* handle to the snapshot */
684 int reset; /* reset snapshot position? */
685};
686struct next_process_reply
687{
688 void* pid; /* process id */
689 int threads; /* number of threads */
690 int priority; /* process priority */
691};
692
693
694/* client-side functions */
695
696#ifndef __WINE_SERVER__
697
698#include "server/request.h"
699
700/* client communication functions */
701extern void CLIENT_SendRequest( enum request req, int pass_fd,
702 int n, ... /* arg_1, len_1, etc. */ );
703extern unsigned int CLIENT_WaitReply( int *len, int *passed_fd,
704 int n, ... /* arg_1, len_1, etc. */ );
705extern unsigned int CLIENT_WaitSimpleReply( void *reply, int len, int *passed_fd );
706extern int CLIENT_InitServer(void);
707
708struct _THDB;
709extern int CLIENT_SetDebug( int level );
710extern int CLIENT_DebuggerRequest( int op );
711extern int CLIENT_InitThread(void);
712#endif /* __WINE_SERVER__ */
713
714#endif /* __WINE_SERVER_H */
Note: See TracBrowser for help on using the repository browser.