Set hwndActiveChild when maximizing a mdi child window because it is
[wine/testsucceed.git] / include / server / object.h
blob7fd65b874f9fa012b4dace4b83ef693b48037a22
1 /*
2 * Wine server objects
4 * Copyright (C) 1998 Alexandre Julliard
5 */
7 #ifndef __WINE_SERVER_OBJECT_H
8 #define __WINE_SERVER_OBJECT_H
10 #ifndef __WINE_SERVER__
11 #error This file can only be used in the Wine server
12 #endif
14 #include <sys/time.h>
15 #include "server.h"
16 #include "server/request.h"
18 /* kernel objects */
20 struct object;
21 struct object_name;
22 struct thread;
23 struct file;
24 struct wait_queue_entry;
26 /* operations valid on all objects */
27 struct object_ops
29 /* dump the object (for debugging) */
30 void (*dump)(struct object *,int);
31 /* add a thread to the object wait queue */
32 int (*add_queue)(struct object *,struct wait_queue_entry *);
33 /* remove a thread from the object wait queue */
34 void (*remove_queue)(struct object *,struct wait_queue_entry *);
35 /* is object signaled? */
36 int (*signaled)(struct object *,struct thread *);
37 /* wait satisfied; return 1 if abandoned */
38 int (*satisfied)(struct object *,struct thread *);
39 /* return a Unix fd that can be used to read from the object */
40 int (*get_read_fd)(struct object *);
41 /* return a Unix fd that can be used to write to the object */
42 int (*get_write_fd)(struct object *);
43 /* flush the object buffers */
44 int (*flush)(struct object *);
45 /* get file information */
46 int (*get_file_info)(struct object *,struct get_file_info_reply *);
47 /* destroy on refcount == 0 */
48 void (*destroy)(struct object *);
51 struct object
53 unsigned int refcount;
54 const struct object_ops *ops;
55 struct wait_queue_entry *head;
56 struct wait_queue_entry *tail;
57 struct object_name *name;
60 extern void *mem_alloc( size_t size ); /* malloc wrapper */
61 extern struct object *create_named_object( const char *name, const struct object_ops *ops,
62 size_t size );
63 extern int init_object( struct object *obj, const struct object_ops *ops, const char *name );
64 extern const char *get_object_name( struct object *obj );
65 /* grab/release_object can take any pointer, but you better make sure */
66 /* that the thing pointed to starts with a struct object... */
67 extern struct object *grab_object( void *obj );
68 extern void release_object( void *obj );
69 extern struct object *find_object( const char *name );
70 extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry );
71 extern int no_satisfied( struct object *obj, struct thread *thread );
72 extern int no_read_fd( struct object *obj );
73 extern int no_write_fd( struct object *obj );
74 extern int no_flush( struct object *obj );
75 extern int no_get_file_info( struct object *obj, struct get_file_info_reply *info );
76 extern void default_select_event( int fd, int event, void *private );
78 /* request handlers */
80 struct iovec;
81 struct thread;
83 extern void call_req_handler( struct thread *thread, enum request req,
84 void *data, int len, int fd );
85 extern void call_timeout_handler( struct thread *thread );
86 extern void call_kill_handler( struct thread *thread, int exit_code );
88 extern void trace_request( enum request req, void *data, int len, int fd );
89 extern void trace_timeout(void);
90 extern void trace_kill( int exit_code );
91 extern void trace_reply( struct thread *thread, int type, int pass_fd,
92 struct iovec *vec, int veclen );
94 /* select functions */
96 #define READ_EVENT 1
97 #define WRITE_EVENT 2
99 struct select_ops
101 void (*event)( int fd, int event, void *private );
102 void (*timeout)( int fd, void *private );
105 extern int add_select_user( int fd, int events, const struct select_ops *ops, void *private );
106 extern void remove_select_user( int fd );
107 extern void set_select_timeout( int fd, struct timeval *when );
108 extern void set_select_events( int fd, int events );
109 extern void *get_select_private_data( const struct select_ops *ops, int fd );
110 extern void select_loop(void);
112 /* socket functions */
114 extern void server_init( int fd );
115 extern int add_client( int client_fd, struct thread *self );
116 extern void remove_client( int client_fd, int exit_code );
117 extern int get_initial_client_fd(void);
118 extern void set_timeout( int client_fd, struct timeval *when );
119 extern int send_reply_v( int client_fd, int type, int pass_fd,
120 struct iovec *vec, int veclen );
122 /* process functions */
124 struct process;
126 extern struct process *create_process(void);
127 extern struct process *get_process_from_id( void *id );
128 extern struct process *get_process_from_handle( int handle, unsigned int access );
129 extern void add_process_thread( struct process *process,
130 struct thread *thread );
131 extern void remove_process_thread( struct process *process,
132 struct thread *thread );
133 extern void kill_process( struct process *process, int exit_code );
134 extern void get_process_info( struct process *process,
135 struct get_process_info_reply *reply );
136 extern void set_process_info( struct process *process,
137 struct set_process_info_request *req );
138 extern int alloc_console( struct process *process );
139 extern int free_console( struct process *process );
140 extern struct object *get_console( struct process *process, int output );
142 /* handle functions */
144 /* alloc_handle takes a void *obj for convenience, but you better make sure */
145 /* that the thing pointed to starts with a struct object... */
146 extern int alloc_handle( struct process *process, void *obj,
147 unsigned int access, int inherit );
148 extern int close_handle( struct process *process, int handle );
149 extern int set_handle_info( struct process *process, int handle,
150 int mask, int flags );
151 extern struct object *get_handle_obj( struct process *process, int handle,
152 unsigned int access, const struct object_ops *ops );
153 extern int duplicate_handle( struct process *src, int src_handle, struct process *dst,
154 int dst_handle, unsigned int access, int inherit, int options );
155 extern int open_object( const char *name, const struct object_ops *ops,
156 unsigned int access, int inherit );
158 /* event functions */
160 extern struct object *create_event( const char *name, int manual_reset, int initial_state );
161 extern int open_event( unsigned int access, int inherit, const char *name );
162 extern int pulse_event( int handle );
163 extern int set_event( int handle );
164 extern int reset_event( int handle );
167 /* mutex functions */
169 extern struct object *create_mutex( const char *name, int owned );
170 extern int open_mutex( unsigned int access, int inherit, const char *name );
171 extern int release_mutex( int handle );
172 extern void abandon_mutexes( struct thread *thread );
175 /* semaphore functions */
177 extern struct object *create_semaphore( const char *name, unsigned int initial, unsigned int max );
178 extern int open_semaphore( unsigned int access, int inherit, const char *name );
179 extern int release_semaphore( int handle, unsigned int count, unsigned int *prev_count );
182 /* file functions */
184 extern struct object *create_file( int fd, const char *name, unsigned int access,
185 unsigned int sharing, int create, unsigned int attrs );
186 extern struct file *get_file_obj( struct process *process, int handle,
187 unsigned int access );
188 extern int file_get_mmap_fd( struct file *file );
189 extern int set_file_pointer( int handle, int *low, int *high, int whence );
190 extern int truncate_file( int handle );
191 extern int set_file_time( int handle, time_t access_time, time_t write_time );
192 extern int file_lock( struct file *file, int offset_high, int offset_low,
193 int count_high, int count_low );
194 extern int file_unlock( struct file *file, int offset_high, int offset_low,
195 int count_high, int count_low );
196 extern void file_set_error(void);
199 /* pipe functions */
201 extern int create_pipe( struct object *obj[2] );
204 /* console functions */
206 struct tagINPUT_RECORD;
207 extern int create_console( int fd, struct object *obj[2] );
208 extern int set_console_fd( int handle, int fd, int pid );
209 extern int get_console_mode( int handle, int *mode );
210 extern int set_console_mode( int handle, int mode );
211 extern int set_console_info( int handle, struct set_console_info_request *req,
212 const char *title );
213 extern int get_console_info( int handle, struct get_console_info_reply *reply,
214 const char **title );
215 extern int write_console_input( int handle, int count, struct tagINPUT_RECORD *records );
216 extern int read_console_input( int handle, int count, int flush );
219 /* change notification functions */
221 extern struct object *create_change_notification( int subtree, int filter );
224 /* file mapping functions */
225 extern struct object *create_mapping( int size_high, int size_low, int protect,
226 int handle, const char *name );
227 extern int open_mapping( unsigned int access, int inherit, const char *name );
228 extern int get_mapping_info( int handle, struct get_mapping_info_reply *reply );
231 /* device functions */
232 extern struct object *create_device( int id );
235 extern int debug_level;
237 #endif /* __WINE_SERVER_OBJECT_H */