Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Server-side request handling |
| 3 | * |
| 4 | * Copyright (C) 1998 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
François Gouget | 1425941 | 2001-11-06 20:57:11 +0000 | [diff] [blame] | 21 | #include "config.h" |
Francois Gouget | 386cf6e | 2001-10-14 16:25:47 +0000 | [diff] [blame] | 22 | #include "wine/port.h" |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 23 | |
Alexandre Julliard | aa0ebd0 | 1998-12-30 12:06:45 +0000 | [diff] [blame] | 24 | #include <assert.h> |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 25 | #include <errno.h> |
| 26 | #include <fcntl.h> |
Steven Edwards | 037c8a1 | 2003-02-11 22:27:13 +0000 | [diff] [blame] | 27 | #ifdef HAVE_PWD_H |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 28 | #include <pwd.h> |
Steven Edwards | 037c8a1 | 2003-02-11 22:27:13 +0000 | [diff] [blame] | 29 | #endif |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 30 | #include <signal.h> |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 33 | #include <stdarg.h> |
| 34 | #include <string.h> |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 35 | #include <sys/stat.h> |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 36 | #include <sys/time.h> |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 37 | #include <sys/types.h> |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 38 | #ifdef HAVE_SYS_SOCKET_H |
| 39 | # include <sys/socket.h> |
| 40 | #endif |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 41 | #ifdef HAVE_SYS_WAIT_H |
| 42 | # include <sys/wait.h> |
| 43 | #endif |
Steven Edwards | 037c8a1 | 2003-02-11 22:27:13 +0000 | [diff] [blame] | 44 | #ifdef HAVE_SYS_UIO_H |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 45 | #include <sys/uio.h> |
Steven Edwards | 037c8a1 | 2003-02-11 22:27:13 +0000 | [diff] [blame] | 46 | #endif |
| 47 | #ifdef HAVE_SYS_UN_H |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 48 | #include <sys/un.h> |
Steven Edwards | 037c8a1 | 2003-02-11 22:27:13 +0000 | [diff] [blame] | 49 | #endif |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 50 | #include <unistd.h> |
Steven Edwards | 5727918 | 2005-03-04 12:38:36 +0000 | [diff] [blame] | 51 | #ifdef HAVE_POLL_H |
| 52 | #include <poll.h> |
| 53 | #endif |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | 4ec9e11 | 2006-05-28 18:27:02 +0200 | [diff] [blame] | 55 | #include "ntstatus.h" |
| 56 | #define WIN32_NO_STATUS |
Alexandre Julliard | 435e2e6 | 2002-12-10 22:56:43 +0000 | [diff] [blame] | 57 | #include "windef.h" |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 58 | #include "winbase.h" |
Alexandre Julliard | 4b46112 | 1999-01-31 19:04:30 +0000 | [diff] [blame] | 59 | #include "wincon.h" |
Alexandre Julliard | 4ec9e11 | 2006-05-28 18:27:02 +0200 | [diff] [blame] | 60 | #include "winternl.h" |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 61 | #include "wine/library.h" |
| 62 | |
Alexandre Julliard | 863637b | 2003-01-30 00:26:44 +0000 | [diff] [blame] | 63 | #include "file.h" |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 64 | #include "process.h" |
Alexandre Julliard | 5bc7808 | 1999-06-22 17:26:53 +0000 | [diff] [blame] | 65 | #define WANT_REQUEST_HANDLERS |
| 66 | #include "request.h" |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 67 | |
| 68 | /* Some versions of glibc don't define this */ |
| 69 | #ifndef SCM_RIGHTS |
| 70 | #define SCM_RIGHTS 1 |
| 71 | #endif |
| 72 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 73 | /* path names for server master Unix socket */ |
| 74 | static const char * const server_socket_name = "socket"; /* name of the socket file */ |
| 75 | static const char * const server_lock_name = "lock"; /* name of the server lock file */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 76 | |
| 77 | struct master_socket |
| 78 | { |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 79 | struct object obj; /* object header */ |
| 80 | struct fd *fd; /* file descriptor of the master socket */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | static void master_socket_dump( struct object *obj, int verbose ); |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 84 | static void master_socket_destroy( struct object *obj ); |
Alexandre Julliard | cf27a7f | 2003-02-14 20:27:09 +0000 | [diff] [blame] | 85 | static void master_socket_poll_event( struct fd *fd, int event ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 86 | |
| 87 | static const struct object_ops master_socket_ops = |
| 88 | { |
| 89 | sizeof(struct master_socket), /* size */ |
| 90 | master_socket_dump, /* dump */ |
Alexandre Julliard | 8382eb0 | 2007-12-05 18:16:42 +0100 | [diff] [blame] | 91 | no_get_type, /* get_type */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 92 | no_add_queue, /* add_queue */ |
| 93 | NULL, /* remove_queue */ |
| 94 | NULL, /* signaled */ |
| 95 | NULL, /* satisfied */ |
Mike McCormack | f92fff6 | 2005-04-24 17:35:52 +0000 | [diff] [blame] | 96 | no_signal, /* signal */ |
Alexandre Julliard | 863637b | 2003-01-30 00:26:44 +0000 | [diff] [blame] | 97 | no_get_fd, /* get_fd */ |
Alexandre Julliard | 28beba3 | 2005-12-12 14:57:40 +0100 | [diff] [blame] | 98 | no_map_access, /* map_access */ |
Rob Shearman | c1707d8 | 2007-10-03 13:10:37 +0100 | [diff] [blame] | 99 | default_get_sd, /* get_sd */ |
| 100 | default_set_sd, /* set_sd */ |
Vitaliy Margolen | baffcb9 | 2005-11-22 14:55:42 +0000 | [diff] [blame] | 101 | no_lookup_name, /* lookup_name */ |
Alexandre Julliard | 7e71c1d | 2007-03-22 11:44:29 +0100 | [diff] [blame] | 102 | no_open_file, /* open_file */ |
Alexandre Julliard | b9b1ea9 | 2005-06-09 15:39:52 +0000 | [diff] [blame] | 103 | no_close_handle, /* close_handle */ |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 104 | master_socket_destroy /* destroy */ |
Alexandre Julliard | 863637b | 2003-01-30 00:26:44 +0000 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | static const struct fd_ops master_socket_fd_ops = |
| 108 | { |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 109 | NULL, /* get_poll_events */ |
| 110 | master_socket_poll_event, /* poll_event */ |
Alexandre Julliard | 3f05759 | 2007-04-12 20:21:53 +0200 | [diff] [blame] | 111 | NULL, /* flush */ |
| 112 | NULL, /* get_fd_type */ |
Alexandre Julliard | 6357143 | 2007-04-16 14:45:03 +0200 | [diff] [blame] | 113 | NULL, /* ioctl */ |
Alexandre Julliard | 3f05759 | 2007-04-12 20:21:53 +0200 | [diff] [blame] | 114 | NULL, /* queue_async */ |
Alexandre Julliard | 72bff2e | 2007-04-10 17:07:27 +0200 | [diff] [blame] | 115 | NULL, /* reselect_async */ |
Alexandre Julliard | 3f05759 | 2007-04-12 20:21:53 +0200 | [diff] [blame] | 116 | NULL /* cancel_async */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 117 | }; |
| 118 | |
| 119 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 120 | struct thread *current = NULL; /* thread handling the current request */ |
Alexandre Julliard | 908464d | 2000-11-01 03:11:12 +0000 | [diff] [blame] | 121 | unsigned int global_error = 0; /* global error code for when no thread is current */ |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 122 | timeout_t server_start_time = 0; /* server startup time */ |
Alexandre Julliard | 161160f | 2008-04-17 12:41:34 +0200 | [diff] [blame] | 123 | int server_dir_fd = -1; /* file descriptor for the server dir */ |
| 124 | int config_dir_fd = -1; /* file descriptor for the config dir */ |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 125 | |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 126 | static struct master_socket *master_socket; /* the master socket object */ |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 127 | static struct timeout_user *master_timeout; |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 128 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 129 | /* complain about a protocol error and terminate the client connection */ |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 130 | void fatal_protocol_error( struct thread *thread, const char *err, ... ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 131 | { |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 132 | va_list args; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 133 | |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 134 | va_start( args, err ); |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 135 | fprintf( stderr, "Protocol error:%04x: ", thread->id ); |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 136 | vfprintf( stderr, err, args ); |
| 137 | va_end( args ); |
Alexandre Julliard | 12f29b5 | 2000-03-17 15:16:57 +0000 | [diff] [blame] | 138 | thread->exit_code = 1; |
| 139 | kill_thread( thread, 1 ); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Alexandre Julliard | d90e964 | 2001-02-21 04:21:50 +0000 | [diff] [blame] | 142 | /* complain about a protocol error and terminate the client connection */ |
| 143 | void fatal_protocol_perror( struct thread *thread, const char *err, ... ) |
| 144 | { |
| 145 | va_list args; |
| 146 | |
| 147 | va_start( args, err ); |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 148 | fprintf( stderr, "Protocol error:%04x: ", thread->id ); |
Alexandre Julliard | d90e964 | 2001-02-21 04:21:50 +0000 | [diff] [blame] | 149 | vfprintf( stderr, err, args ); |
| 150 | perror( " " ); |
| 151 | va_end( args ); |
| 152 | thread->exit_code = 1; |
| 153 | kill_thread( thread, 1 ); |
| 154 | } |
| 155 | |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 156 | /* die on a fatal error */ |
Alexandre Julliard | 6c8d917 | 2000-08-26 04:40:07 +0000 | [diff] [blame] | 157 | void fatal_error( const char *err, ... ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 158 | { |
| 159 | va_list args; |
| 160 | |
| 161 | va_start( args, err ); |
| 162 | fprintf( stderr, "wineserver: " ); |
| 163 | vfprintf( stderr, err, args ); |
| 164 | va_end( args ); |
| 165 | exit(1); |
| 166 | } |
| 167 | |
| 168 | /* die on a fatal error */ |
Alexandre Julliard | 6c8d917 | 2000-08-26 04:40:07 +0000 | [diff] [blame] | 169 | void fatal_perror( const char *err, ... ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 170 | { |
| 171 | va_list args; |
| 172 | |
| 173 | va_start( args, err ); |
| 174 | fprintf( stderr, "wineserver: " ); |
| 175 | vfprintf( stderr, err, args ); |
| 176 | perror( " " ); |
| 177 | va_end( args ); |
| 178 | exit(1); |
| 179 | } |
| 180 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 181 | /* allocate the reply data */ |
Alexandre Julliard | 0f273c1 | 2006-07-26 10:43:25 +0200 | [diff] [blame] | 182 | void *set_reply_data_size( data_size_t size ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 183 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 184 | assert( size <= get_reply_max_size() ); |
| 185 | if (size && !(current->reply_data = mem_alloc( size ))) size = 0; |
| 186 | current->reply_size = size; |
| 187 | return current->reply_data; |
| 188 | } |
Alexandre Julliard | d90e964 | 2001-02-21 04:21:50 +0000 | [diff] [blame] | 189 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 190 | /* write the remaining part of the reply */ |
| 191 | void write_reply( struct thread *thread ) |
| 192 | { |
| 193 | int ret; |
Alexandre Julliard | 5bc7808 | 1999-06-22 17:26:53 +0000 | [diff] [blame] | 194 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 195 | if ((ret = write( get_unix_fd( thread->reply_fd ), |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 196 | (char *)thread->reply_data + thread->reply_size - thread->reply_towrite, |
| 197 | thread->reply_towrite )) >= 0) |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 198 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 199 | if (!(thread->reply_towrite -= ret)) |
Alexandre Julliard | 67a7499 | 2001-02-27 02:09:16 +0000 | [diff] [blame] | 200 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 201 | free( thread->reply_data ); |
| 202 | thread->reply_data = NULL; |
| 203 | /* sent everything, can go back to waiting for requests */ |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 204 | set_fd_events( thread->request_fd, POLLIN ); |
| 205 | set_fd_events( thread->reply_fd, 0 ); |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 206 | } |
| 207 | return; |
| 208 | } |
| 209 | if (errno == EPIPE) |
| 210 | kill_thread( thread, 0 ); /* normal death */ |
| 211 | else if (errno != EWOULDBLOCK && errno != EAGAIN) |
| 212 | fatal_protocol_perror( thread, "reply write" ); |
| 213 | } |
| 214 | |
| 215 | /* send a reply to the current thread */ |
| 216 | static void send_reply( union generic_reply *reply ) |
| 217 | { |
| 218 | int ret; |
| 219 | |
| 220 | if (!current->reply_size) |
| 221 | { |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 222 | if ((ret = write( get_unix_fd( current->reply_fd ), |
| 223 | reply, sizeof(*reply) )) != sizeof(*reply)) goto error; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 224 | } |
| 225 | else |
| 226 | { |
| 227 | struct iovec vec[2]; |
| 228 | |
Francois Gouget | 0763abf | 2002-04-01 21:08:16 +0000 | [diff] [blame] | 229 | vec[0].iov_base = (void *)reply; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 230 | vec[0].iov_len = sizeof(*reply); |
| 231 | vec[1].iov_base = current->reply_data; |
| 232 | vec[1].iov_len = current->reply_size; |
| 233 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 234 | if ((ret = writev( get_unix_fd( current->reply_fd ), vec, 2 )) < sizeof(*reply)) goto error; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 235 | |
| 236 | if ((current->reply_towrite = current->reply_size - (ret - sizeof(*reply)))) |
| 237 | { |
| 238 | /* couldn't write it all, wait for POLLOUT */ |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 239 | set_fd_events( current->reply_fd, POLLOUT ); |
| 240 | set_fd_events( current->request_fd, 0 ); |
Alexandre Julliard | 67a7499 | 2001-02-27 02:09:16 +0000 | [diff] [blame] | 241 | return; |
| 242 | } |
Alexandre Julliard | d90e964 | 2001-02-21 04:21:50 +0000 | [diff] [blame] | 243 | } |
Michael Stefaniuc | 5ceccec | 2006-10-09 23:34:36 +0200 | [diff] [blame] | 244 | free( current->reply_data ); |
| 245 | current->reply_data = NULL; |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 246 | return; |
| 247 | |
| 248 | error: |
| 249 | if (ret >= 0) |
| 250 | fatal_protocol_error( current, "partial write %d\n", ret ); |
| 251 | else if (errno == EPIPE) |
| 252 | kill_thread( current, 0 ); /* normal death */ |
| 253 | else |
| 254 | fatal_protocol_perror( current, "reply write" ); |
| 255 | } |
| 256 | |
| 257 | /* call a request handler */ |
| 258 | static void call_req_handler( struct thread *thread ) |
| 259 | { |
| 260 | union generic_reply reply; |
| 261 | enum request req = thread->req.request_header.req; |
| 262 | |
| 263 | current = thread; |
| 264 | current->reply_size = 0; |
| 265 | clear_error(); |
| 266 | memset( &reply, 0, sizeof(reply) ); |
| 267 | |
| 268 | if (debug_level) trace_request(); |
Alexandre Julliard | 67a7499 | 2001-02-27 02:09:16 +0000 | [diff] [blame] | 269 | |
| 270 | if (req < REQ_NB_REQUESTS) |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 271 | req_handlers[req]( ¤t->req, &reply ); |
Alexandre Julliard | 4ec9e11 | 2006-05-28 18:27:02 +0200 | [diff] [blame] | 272 | else |
| 273 | set_error( STATUS_NOT_IMPLEMENTED ); |
| 274 | |
| 275 | if (current) |
| 276 | { |
| 277 | if (current->reply_fd) |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 278 | { |
Alexandre Julliard | 4ec9e11 | 2006-05-28 18:27:02 +0200 | [diff] [blame] | 279 | reply.reply_header.error = current->error; |
| 280 | reply.reply_header.reply_size = current->reply_size; |
| 281 | if (debug_level) trace_reply( req, &reply ); |
| 282 | send_reply( &reply ); |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 283 | } |
Alexandre Julliard | 5558652 | 2006-06-08 10:26:02 +0200 | [diff] [blame] | 284 | else |
| 285 | { |
| 286 | current->exit_code = 1; |
| 287 | kill_thread( current, 1 ); /* no way to continue without reply fd */ |
| 288 | } |
Alexandre Julliard | ebe29ef | 1999-06-26 08:43:26 +0000 | [diff] [blame] | 289 | } |
Alexandre Julliard | 4ec9e11 | 2006-05-28 18:27:02 +0200 | [diff] [blame] | 290 | current = NULL; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 291 | } |
| 292 | |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 293 | /* read a request from a thread */ |
| 294 | void read_request( struct thread *thread ) |
| 295 | { |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 296 | int ret; |
| 297 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 298 | if (!thread->req_toread) /* no pending request */ |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 299 | { |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 300 | if ((ret = read( get_unix_fd( thread->request_fd ), &thread->req, |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 301 | sizeof(thread->req) )) != sizeof(thread->req)) goto error; |
| 302 | if (!(thread->req_toread = thread->req.request_header.request_size)) |
| 303 | { |
| 304 | /* no data, handle request at once */ |
| 305 | call_req_handler( thread ); |
| 306 | return; |
| 307 | } |
| 308 | if (!(thread->req_data = malloc( thread->req_toread ))) |
Alexandre Julliard | 5522446 | 2006-07-27 14:39:33 +0200 | [diff] [blame] | 309 | { |
| 310 | fatal_protocol_error( thread, "no memory for %u bytes request %d\n", |
| 311 | thread->req_toread, thread->req.request_header.req ); |
| 312 | return; |
| 313 | } |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 314 | } |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 315 | |
| 316 | /* read the variable sized data */ |
| 317 | for (;;) |
| 318 | { |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 319 | ret = read( get_unix_fd( thread->request_fd ), |
| 320 | (char *)thread->req_data + thread->req.request_header.request_size |
| 321 | - thread->req_toread, |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 322 | thread->req_toread ); |
| 323 | if (ret <= 0) break; |
| 324 | if (!(thread->req_toread -= ret)) |
| 325 | { |
| 326 | call_req_handler( thread ); |
| 327 | free( thread->req_data ); |
| 328 | thread->req_data = NULL; |
| 329 | return; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | error: |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 334 | if (!ret) /* closed pipe */ |
| 335 | kill_thread( thread, 0 ); |
| 336 | else if (ret > 0) |
| 337 | fatal_protocol_error( thread, "partial read %d\n", ret ); |
Alexandre Julliard | 4b29d66 | 2001-06-19 18:23:13 +0000 | [diff] [blame] | 338 | else if (errno != EWOULDBLOCK && errno != EAGAIN) |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 339 | fatal_protocol_perror( thread, "read" ); |
| 340 | } |
| 341 | |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 342 | /* receive a file descriptor on the process socket */ |
| 343 | int receive_fd( struct process *process ) |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 344 | { |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 345 | struct iovec vec; |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 346 | struct send_fd data; |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 347 | struct msghdr msghdr; |
| 348 | int fd = -1, ret; |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 349 | |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 350 | #ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 351 | msghdr.msg_accrightslen = sizeof(int); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 352 | msghdr.msg_accrights = (void *)&fd; |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 353 | #else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 354 | char cmsg_buffer[256]; |
| 355 | msghdr.msg_control = cmsg_buffer; |
| 356 | msghdr.msg_controllen = sizeof(cmsg_buffer); |
| 357 | msghdr.msg_flags = 0; |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 358 | #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 359 | |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 360 | msghdr.msg_name = NULL; |
| 361 | msghdr.msg_namelen = 0; |
| 362 | msghdr.msg_iov = &vec; |
| 363 | msghdr.msg_iovlen = 1; |
| 364 | vec.iov_base = (void *)&data; |
| 365 | vec.iov_len = sizeof(data); |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 366 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 367 | ret = recvmsg( get_unix_fd( process->msg_fd ), &msghdr, 0 ); |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 368 | |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 369 | #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 370 | if (ret > 0) |
| 371 | { |
| 372 | struct cmsghdr *cmsg; |
| 373 | for (cmsg = CMSG_FIRSTHDR( &msghdr ); cmsg; cmsg = CMSG_NXTHDR( &msghdr, cmsg )) |
| 374 | { |
| 375 | if (cmsg->cmsg_level != SOL_SOCKET) continue; |
| 376 | if (cmsg->cmsg_type == SCM_RIGHTS) fd = *(int *)CMSG_DATA(cmsg); |
| 377 | } |
| 378 | } |
| 379 | #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 380 | |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 381 | if (ret == sizeof(data)) |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 382 | { |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 383 | struct thread *thread; |
| 384 | |
| 385 | if (data.tid) thread = get_thread_from_id( data.tid ); |
Alexandre Julliard | 0502638 | 2005-03-01 10:56:18 +0000 | [diff] [blame] | 386 | else thread = (struct thread *)grab_object( get_process_first_thread( process )); |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 387 | |
Alexandre Julliard | 714156d | 2002-08-13 18:24:27 +0000 | [diff] [blame] | 388 | if (!thread || thread->process != process || thread->state == TERMINATED) |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 389 | { |
| 390 | if (debug_level) |
Alexandre Julliard | 91befe1 | 2003-02-01 01:38:40 +0000 | [diff] [blame] | 391 | fprintf( stderr, "%04x: *fd* %d <- %d bad thread id\n", |
| 392 | data.tid, data.fd, fd ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 393 | close( fd ); |
| 394 | } |
| 395 | else |
| 396 | { |
| 397 | if (debug_level) |
Alexandre Julliard | 91befe1 | 2003-02-01 01:38:40 +0000 | [diff] [blame] | 398 | fprintf( stderr, "%04x: *fd* %d <- %d\n", |
| 399 | thread->id, data.fd, fd ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 400 | thread_add_inflight_fd( thread, data.fd, fd ); |
| 401 | } |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 402 | if (thread) release_object( thread ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 403 | return 0; |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 404 | } |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 405 | |
Alexandre Julliard | 0a36462 | 2006-03-27 12:14:24 +0200 | [diff] [blame] | 406 | if (!ret) |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 407 | { |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 408 | kill_process( process, 0 ); |
Alexandre Julliard | 0a36462 | 2006-03-27 12:14:24 +0200 | [diff] [blame] | 409 | } |
| 410 | else if (ret > 0) |
| 411 | { |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 412 | fprintf( stderr, "Protocol error: process %04x: partial recvmsg %d for fd\n", |
| 413 | process->id, ret ); |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 414 | if (fd != -1) close( fd ); |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 415 | kill_process( process, 1 ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 416 | } |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 417 | else |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 418 | { |
| 419 | if (errno != EWOULDBLOCK && errno != EAGAIN) |
| 420 | { |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 421 | fprintf( stderr, "Protocol error: process %04x: ", process->id ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 422 | perror( "recvmsg" ); |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 423 | kill_process( process, 1 ); |
Alexandre Julliard | f524240 | 2001-02-28 21:45:23 +0000 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | return -1; |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 427 | } |
| 428 | |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 429 | /* send an fd to a client */ |
Alexandre Julliard | 5188574 | 2002-05-30 20:12:58 +0000 | [diff] [blame] | 430 | int send_client_fd( struct process *process, int fd, obj_handle_t handle ) |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 431 | { |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 432 | struct iovec vec; |
| 433 | struct msghdr msghdr; |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 434 | int ret; |
| 435 | |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 436 | #ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 437 | msghdr.msg_accrightslen = sizeof(fd); |
| 438 | msghdr.msg_accrights = (void *)&fd; |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 439 | #else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 440 | char cmsg_buffer[256]; |
| 441 | struct cmsghdr *cmsg; |
| 442 | msghdr.msg_control = cmsg_buffer; |
| 443 | msghdr.msg_controllen = sizeof(cmsg_buffer); |
| 444 | msghdr.msg_flags = 0; |
| 445 | cmsg = CMSG_FIRSTHDR( &msghdr ); |
| 446 | cmsg->cmsg_len = CMSG_LEN( sizeof(fd) ); |
| 447 | cmsg->cmsg_level = SOL_SOCKET; |
| 448 | cmsg->cmsg_type = SCM_RIGHTS; |
| 449 | *(int *)CMSG_DATA(cmsg) = fd; |
| 450 | msghdr.msg_controllen = cmsg->cmsg_len; |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 451 | #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 452 | |
Alexandre Julliard | 1797152 | 2010-09-30 11:53:07 +0200 | [diff] [blame] | 453 | msghdr.msg_name = NULL; |
| 454 | msghdr.msg_namelen = 0; |
| 455 | msghdr.msg_iov = &vec; |
| 456 | msghdr.msg_iovlen = 1; |
| 457 | |
| 458 | vec.iov_base = (void *)&handle; |
| 459 | vec.iov_len = sizeof(handle); |
| 460 | |
| 461 | if (debug_level) |
| 462 | fprintf( stderr, "%04x: *fd* %04x -> %d\n", current ? current->id : process->id, handle, fd ); |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 463 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 464 | ret = sendmsg( get_unix_fd( process->msg_fd ), &msghdr, 0 ); |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 465 | |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 466 | if (ret == sizeof(handle)) return 0; |
| 467 | |
| 468 | if (ret >= 0) |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 469 | { |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 470 | fprintf( stderr, "Protocol error: process %04x: partial sendmsg %d\n", process->id, ret ); |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 471 | kill_process( process, 1 ); |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 472 | } |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 473 | else if (errno == EPIPE) |
| 474 | { |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 475 | kill_process( process, 0 ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 476 | } |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 477 | else |
| 478 | { |
Alexandre Julliard | 202ef69 | 2006-06-07 14:20:38 +0200 | [diff] [blame] | 479 | fprintf( stderr, "Protocol error: process %04x: ", process->id ); |
Alexandre Julliard | 8859d77 | 2001-03-01 22:13:49 +0000 | [diff] [blame] | 480 | perror( "sendmsg" ); |
Alexandre Julliard | 81977b7 | 2006-09-21 11:14:45 +0200 | [diff] [blame] | 481 | kill_process( process, 1 ); |
Alexandre Julliard | d549f69 | 2000-12-22 02:04:15 +0000 | [diff] [blame] | 482 | } |
| 483 | return -1; |
| 484 | } |
| 485 | |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 486 | /* get current tick count to return to client */ |
| 487 | unsigned int get_tick_count(void) |
| 488 | { |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 489 | return (current_time - server_start_time) / 10000; |
Alexandre Julliard | 516e40e | 2001-10-17 17:48:49 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 492 | static void master_socket_dump( struct object *obj, int verbose ) |
Alexandre Julliard | 338e757 | 1998-12-27 15:28:54 +0000 | [diff] [blame] | 493 | { |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 494 | struct master_socket *sock = (struct master_socket *)obj; |
| 495 | assert( obj->ops == &master_socket_ops ); |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 496 | fprintf( stderr, "Master socket fd=%p\n", sock->fd ); |
| 497 | } |
| 498 | |
| 499 | static void master_socket_destroy( struct object *obj ) |
| 500 | { |
| 501 | struct master_socket *sock = (struct master_socket *)obj; |
| 502 | assert( obj->ops == &master_socket_ops ); |
| 503 | release_object( sock->fd ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | /* handle a socket event */ |
Alexandre Julliard | cf27a7f | 2003-02-14 20:27:09 +0000 | [diff] [blame] | 507 | static void master_socket_poll_event( struct fd *fd, int event ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 508 | { |
Alexandre Julliard | cf27a7f | 2003-02-14 20:27:09 +0000 | [diff] [blame] | 509 | struct master_socket *sock = get_fd_user( fd ); |
| 510 | assert( master_socket->obj.ops == &master_socket_ops ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 511 | |
| 512 | assert( sock == master_socket ); /* there is only one master socket */ |
| 513 | |
| 514 | if (event & (POLLERR | POLLHUP)) |
| 515 | { |
| 516 | /* this is not supposed to happen */ |
| 517 | fprintf( stderr, "wineserver: Error on master socket\n" ); |
Alexandre Julliard | 3a4c04d | 2006-08-14 20:40:31 +0200 | [diff] [blame] | 518 | set_fd_events( sock->fd, -1 ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 519 | } |
| 520 | else if (event & POLLIN) |
| 521 | { |
| 522 | struct sockaddr_un dummy; |
Mike McCormack | e659f1e | 2005-08-09 10:37:50 +0000 | [diff] [blame] | 523 | unsigned int len = sizeof(dummy); |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 524 | int client = accept( get_unix_fd( master_socket->fd ), (struct sockaddr *) &dummy, &len ); |
Alexandre Julliard | 09cc91d | 2001-04-04 00:11:13 +0000 | [diff] [blame] | 525 | if (client == -1) return; |
| 526 | fcntl( client, F_SETFL, O_NONBLOCK ); |
Alexandre Julliard | c316f0e | 2006-07-19 14:00:10 +0200 | [diff] [blame] | 527 | create_process( client, NULL, 0 ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 528 | } |
| 529 | } |
| 530 | |
| 531 | /* remove the socket upon exit */ |
| 532 | static void socket_cleanup(void) |
| 533 | { |
Alexandre Julliard | c10c9ef | 2000-08-11 21:16:53 +0000 | [diff] [blame] | 534 | static int do_it_once; |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 535 | if (!do_it_once++) unlink( server_socket_name ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 538 | /* create a directory and check its permissions */ |
| 539 | static void create_dir( const char *name, struct stat *st ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 540 | { |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 541 | if (lstat( name, st ) == -1) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 542 | { |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 543 | if (errno != ENOENT) fatal_perror( "lstat %s", name ); |
Francois Gouget | 10e3d96 | 2005-03-01 11:00:06 +0000 | [diff] [blame] | 544 | if (mkdir( name, 0700 ) == -1 && errno != EEXIST) fatal_perror( "mkdir %s", name ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 545 | if (lstat( name, st ) == -1) fatal_perror( "lstat %s", name ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 546 | } |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 547 | if (!S_ISDIR(st->st_mode)) fatal_error( "%s is not a directory\n", name ); |
| 548 | if (st->st_uid != getuid()) fatal_error( "%s is not owned by you\n", name ); |
| 549 | if (st->st_mode & 077) fatal_error( "%s must not be accessible by other users\n", name ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | /* create the server directory and chdir to it */ |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 553 | static void create_server_dir( const char *dir ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 554 | { |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 555 | char *p, *server_dir; |
| 556 | struct stat st, st2; |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 557 | |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 558 | if (!(server_dir = strdup( dir ))) fatal_error( "out of memory\n" ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 559 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 560 | /* first create the base directory if needed */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 561 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 562 | p = strrchr( server_dir, '/' ); |
| 563 | *p = 0; |
| 564 | create_dir( server_dir, &st ); |
Alexandre Julliard | b8dd37d | 2001-08-09 21:22:33 +0000 | [diff] [blame] | 565 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 566 | /* now create the server directory */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 567 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 568 | *p = '/'; |
| 569 | create_dir( server_dir, &st ); |
| 570 | |
| 571 | if (chdir( server_dir ) == -1) fatal_perror( "chdir %s", server_dir ); |
Alexandre Julliard | 161160f | 2008-04-17 12:41:34 +0200 | [diff] [blame] | 572 | if ((server_dir_fd = open( ".", O_RDONLY )) == -1) fatal_perror( "open %s", server_dir ); |
| 573 | if (fstat( server_dir_fd, &st2 ) == -1) fatal_perror( "stat %s", server_dir ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 574 | if (st.st_dev != st2.st_dev || st.st_ino != st2.st_ino) |
| 575 | fatal_error( "chdir did not end up in %s\n", server_dir ); |
| 576 | |
| 577 | free( server_dir ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 578 | } |
| 579 | |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 580 | /* create the lock file and return its file descriptor */ |
| 581 | static int create_server_lock(void) |
| 582 | { |
| 583 | struct stat st; |
| 584 | int fd; |
| 585 | |
| 586 | if (lstat( server_lock_name, &st ) == -1) |
| 587 | { |
| 588 | if (errno != ENOENT) |
| 589 | fatal_perror( "lstat %s/%s", wine_get_server_dir(), server_lock_name ); |
| 590 | } |
| 591 | else |
| 592 | { |
| 593 | if (!S_ISREG(st.st_mode)) |
| 594 | fatal_error( "%s/%s is not a regular file\n", wine_get_server_dir(), server_lock_name ); |
| 595 | } |
| 596 | |
| 597 | if ((fd = open( server_lock_name, O_CREAT|O_TRUNC|O_WRONLY, 0600 )) == -1) |
| 598 | fatal_perror( "error creating %s/%s", wine_get_server_dir(), server_lock_name ); |
| 599 | return fd; |
| 600 | } |
| 601 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 602 | /* wait for the server lock */ |
| 603 | int wait_for_lock(void) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 604 | { |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 605 | const char *server_dir = wine_get_server_dir(); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 606 | int fd, r; |
| 607 | struct flock fl; |
Alexandre Julliard | 0b6a79c | 2000-12-15 20:57:00 +0000 | [diff] [blame] | 608 | |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 609 | if (!server_dir) return 0; /* no server dir, so no lock to wait on */ |
| 610 | |
| 611 | create_server_dir( server_dir ); |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 612 | fd = create_server_lock(); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 613 | |
| 614 | fl.l_type = F_WRLCK; |
| 615 | fl.l_whence = SEEK_SET; |
| 616 | fl.l_start = 0; |
| 617 | fl.l_len = 1; |
| 618 | r = fcntl( fd, F_SETLKW, &fl ); |
| 619 | close(fd); |
| 620 | |
| 621 | return r; |
| 622 | } |
| 623 | |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 624 | /* kill the wine server holding the lock */ |
| 625 | int kill_lock_owner( int sig ) |
| 626 | { |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 627 | const char *server_dir = wine_get_server_dir(); |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 628 | int fd, i, ret = 0; |
| 629 | pid_t pid = 0; |
| 630 | struct flock fl; |
| 631 | |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 632 | if (!server_dir) return 0; /* no server dir, nothing to do */ |
| 633 | |
| 634 | create_server_dir( server_dir ); |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 635 | fd = create_server_lock(); |
| 636 | |
Alexandre Julliard | 307cb09 | 2008-01-02 16:13:08 +0100 | [diff] [blame] | 637 | for (i = 1; i <= 20; i++) |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 638 | { |
| 639 | fl.l_type = F_WRLCK; |
| 640 | fl.l_whence = SEEK_SET; |
| 641 | fl.l_start = 0; |
| 642 | fl.l_len = 1; |
| 643 | if (fcntl( fd, F_GETLK, &fl ) == -1) goto done; |
| 644 | if (fl.l_type != F_WRLCK) goto done; /* the file is not locked */ |
| 645 | if (!pid) /* first time around */ |
| 646 | { |
| 647 | if (!(pid = fl.l_pid)) goto done; /* shouldn't happen */ |
| 648 | if (sig == -1) |
| 649 | { |
| 650 | if (kill( pid, SIGINT ) == -1) goto done; |
| 651 | kill( pid, SIGCONT ); |
| 652 | ret = 1; |
| 653 | } |
| 654 | else /* just send the specified signal and return */ |
| 655 | { |
| 656 | ret = (kill( pid, sig ) != -1); |
| 657 | goto done; |
| 658 | } |
| 659 | } |
| 660 | else if (fl.l_pid != pid) goto done; /* no longer the same process */ |
Alexandre Julliard | 307cb09 | 2008-01-02 16:13:08 +0100 | [diff] [blame] | 661 | usleep( 50000 * i ); |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 662 | } |
| 663 | /* waited long enough, now kill it */ |
| 664 | kill( pid, SIGKILL ); |
| 665 | |
| 666 | done: |
| 667 | close( fd ); |
| 668 | return ret; |
| 669 | } |
| 670 | |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 671 | /* acquire the main server lock */ |
| 672 | static void acquire_lock(void) |
| 673 | { |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 674 | struct sockaddr_un addr; |
| 675 | struct stat st; |
| 676 | struct flock fl; |
| 677 | int fd, slen, got_lock = 0; |
| 678 | |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 679 | fd = create_server_lock(); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 680 | |
| 681 | fl.l_type = F_WRLCK; |
| 682 | fl.l_whence = SEEK_SET; |
| 683 | fl.l_start = 0; |
| 684 | fl.l_len = 1; |
| 685 | if (fcntl( fd, F_SETLK, &fl ) != -1) |
| 686 | { |
| 687 | /* check for crashed server */ |
| 688 | if (stat( server_socket_name, &st ) != -1 && /* there is a leftover socket */ |
| 689 | stat( "core", &st ) != -1 && st.st_size) /* and there is a non-empty core file */ |
| 690 | { |
| 691 | fprintf( stderr, |
| 692 | "Warning: a previous instance of the wine server seems to have crashed.\n" |
| 693 | "Please run 'gdb %s %s/core',\n" |
| 694 | "type 'backtrace' at the gdb prompt and report the results. Thanks.\n\n", |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 695 | server_argv0, wine_get_server_dir() ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 696 | } |
| 697 | unlink( server_socket_name ); /* we got the lock, we can safely remove the socket */ |
| 698 | got_lock = 1; |
| 699 | /* in that case we reuse fd without closing it, this ensures |
| 700 | * that we hold the lock until the process exits */ |
| 701 | } |
| 702 | else |
| 703 | { |
| 704 | switch(errno) |
| 705 | { |
| 706 | case ENOLCK: |
| 707 | break; |
| 708 | case EACCES: |
| 709 | /* check whether locks work at all on this file system */ |
| 710 | if (fcntl( fd, F_GETLK, &fl ) == -1) break; |
| 711 | /* fall through */ |
| 712 | case EAGAIN: |
| 713 | exit(2); /* we didn't get the lock, exit with special status */ |
| 714 | default: |
Alexandre Julliard | 40043ed | 2002-08-16 20:02:15 +0000 | [diff] [blame] | 715 | fatal_perror( "fcntl %s/%s", wine_get_server_dir(), server_lock_name ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 716 | } |
| 717 | /* it seems we can't use locks on this fs, so we will use the socket existence as lock */ |
| 718 | close( fd ); |
| 719 | } |
| 720 | |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 721 | if ((fd = socket( AF_UNIX, SOCK_STREAM, 0 )) == -1) fatal_perror( "socket" ); |
| 722 | addr.sun_family = AF_UNIX; |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 723 | strcpy( addr.sun_path, server_socket_name ); |
Juergen Lock | 2d33ab9 | 2000-02-13 16:03:29 +0000 | [diff] [blame] | 724 | slen = sizeof(addr) - sizeof(addr.sun_path) + strlen(addr.sun_path) + 1; |
Alexandre Julliard | 5537dbb | 2003-03-28 00:36:12 +0000 | [diff] [blame] | 725 | #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN |
Juergen Lock | 2d33ab9 | 2000-02-13 16:03:29 +0000 | [diff] [blame] | 726 | addr.sun_len = slen; |
| 727 | #endif |
| 728 | if (bind( fd, (struct sockaddr *)&addr, slen ) == -1) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 729 | { |
| 730 | if ((errno == EEXIST) || (errno == EADDRINUSE)) |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 731 | { |
| 732 | if (got_lock) |
| 733 | fatal_error( "couldn't bind to the socket even though we hold the lock\n" ); |
| 734 | exit(2); /* we didn't get the lock, exit with special status */ |
| 735 | } |
| 736 | fatal_perror( "bind" ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 737 | } |
| 738 | atexit( socket_cleanup ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 739 | chmod( server_socket_name, 0600 ); /* make sure no other user can connect */ |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 740 | if (listen( fd, 5 ) == -1) fatal_perror( "listen" ); |
| 741 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 742 | if (!(master_socket = alloc_object( &master_socket_ops )) || |
Alexandre Julliard | f85437c | 2007-04-10 22:25:07 +0200 | [diff] [blame] | 743 | !(master_socket->fd = create_anonymous_fd( &master_socket_fd_ops, fd, &master_socket->obj, 0 ))) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 744 | fatal_error( "out of memory\n" ); |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 745 | set_fd_events( master_socket->fd, POLLIN ); |
Alexandre Julliard | b00fb17 | 2006-03-22 20:32:04 +0100 | [diff] [blame] | 746 | make_object_static( &master_socket->obj ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | /* open the master server socket and start waiting for new clients */ |
| 750 | void open_master_socket(void) |
| 751 | { |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 752 | const char *server_dir = wine_get_server_dir(); |
Alexandre Julliard | 161160f | 2008-04-17 12:41:34 +0200 | [diff] [blame] | 753 | const char *config_dir = wine_get_config_dir(); |
Alexandre Julliard | 7ad5be9 | 2003-03-14 04:08:42 +0000 | [diff] [blame] | 754 | int fd, pid, status, sync_pipe[2]; |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 755 | char dummy; |
| 756 | |
| 757 | /* make sure no request is larger than the maximum size */ |
| 758 | assert( sizeof(union generic_request) == sizeof(struct request_max_size) ); |
| 759 | assert( sizeof(union generic_reply) == sizeof(struct request_max_size) ); |
| 760 | |
Alexandre Julliard | 161160f | 2008-04-17 12:41:34 +0200 | [diff] [blame] | 761 | if (!server_dir) fatal_error( "directory %s cannot be accessed\n", config_dir ); |
| 762 | if (chdir( config_dir ) == -1) fatal_perror( "chdir to %s", config_dir ); |
| 763 | if ((config_dir_fd = open( ".", O_RDONLY )) == -1) fatal_perror( "open %s", config_dir ); |
| 764 | |
Alexandre Julliard | c5c599d | 2006-03-31 13:06:04 +0200 | [diff] [blame] | 765 | create_server_dir( server_dir ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 766 | |
Alexandre Julliard | 7ad5be9 | 2003-03-14 04:08:42 +0000 | [diff] [blame] | 767 | if (!foreground) |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 768 | { |
Alexandre Julliard | 7ad5be9 | 2003-03-14 04:08:42 +0000 | [diff] [blame] | 769 | if (pipe( sync_pipe ) == -1) fatal_perror( "pipe" ); |
| 770 | pid = fork(); |
| 771 | switch( pid ) |
| 772 | { |
| 773 | case 0: /* child */ |
| 774 | setsid(); |
| 775 | close( sync_pipe[0] ); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 776 | |
Alexandre Julliard | 7ad5be9 | 2003-03-14 04:08:42 +0000 | [diff] [blame] | 777 | acquire_lock(); |
| 778 | |
| 779 | /* close stdin and stdout */ |
| 780 | if ((fd = open( "/dev/null", O_RDWR )) != -1) |
| 781 | { |
| 782 | dup2( fd, 0 ); |
| 783 | dup2( fd, 1 ); |
| 784 | close( fd ); |
| 785 | } |
| 786 | |
| 787 | /* signal parent */ |
Eric Pouech | 2e0b533 | 2006-01-27 16:17:51 +0100 | [diff] [blame] | 788 | dummy = 0; |
Alexandre Julliard | 7ad5be9 | 2003-03-14 04:08:42 +0000 | [diff] [blame] | 789 | write( sync_pipe[1], &dummy, 1 ); |
| 790 | close( sync_pipe[1] ); |
| 791 | break; |
| 792 | |
| 793 | case -1: |
| 794 | fatal_perror( "fork" ); |
| 795 | break; |
| 796 | |
| 797 | default: /* parent */ |
| 798 | close( sync_pipe[1] ); |
| 799 | |
| 800 | /* wait for child to signal us and then exit */ |
| 801 | if (read( sync_pipe[0], &dummy, 1 ) == 1) _exit(0); |
| 802 | |
| 803 | /* child terminated, propagate exit status */ |
| 804 | wait4( pid, &status, 0, NULL ); |
| 805 | if (WIFEXITED(status)) _exit( WEXITSTATUS(status) ); |
| 806 | _exit(1); |
| 807 | } |
| 808 | } |
| 809 | else /* remain in the foreground */ |
| 810 | { |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 811 | acquire_lock(); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 812 | } |
Alexandre Julliard | d804111 | 2000-04-14 14:42:41 +0000 | [diff] [blame] | 813 | |
Alexandre Julliard | cd1c7fc | 2006-12-29 16:56:11 +0100 | [diff] [blame] | 814 | /* init the process tracing mechanism */ |
| 815 | init_tracing_mechanism(); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 816 | } |
| 817 | |
Alexandre Julliard | f5e0f0c | 2002-04-03 22:51:18 +0000 | [diff] [blame] | 818 | /* master socket timer expiration handler */ |
| 819 | static void close_socket_timeout( void *arg ) |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 820 | { |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 821 | master_timeout = NULL; |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 822 | flush_registry(); |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 823 | if (debug_level) fprintf( stderr, "wineserver: exiting (pid=%ld)\n", (long) getpid() ); |
| 824 | |
| 825 | #ifdef DEBUG_OBJECTS |
Alexandre Julliard | b00fb17 | 2006-03-22 20:32:04 +0100 | [diff] [blame] | 826 | close_objects(); /* shut down everything properly */ |
Alexandre Julliard | 4144b5b | 2002-06-20 23:21:27 +0000 | [diff] [blame] | 827 | #endif |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 828 | exit( 0 ); |
Alexandre Julliard | 2fe5777 | 2000-01-25 01:40:27 +0000 | [diff] [blame] | 829 | } |
| 830 | |
Alexandre Julliard | f5e0f0c | 2002-04-03 22:51:18 +0000 | [diff] [blame] | 831 | /* close the master socket and stop waiting for new clients */ |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 832 | void close_master_socket( timeout_t timeout ) |
Alexandre Julliard | f5e0f0c | 2002-04-03 22:51:18 +0000 | [diff] [blame] | 833 | { |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 834 | if (master_socket) |
Alexandre Julliard | 3a4c04d | 2006-08-14 20:40:31 +0200 | [diff] [blame] | 835 | { |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 836 | release_object( master_socket ); |
| 837 | master_socket = NULL; |
Alexandre Julliard | 3a4c04d | 2006-08-14 20:40:31 +0200 | [diff] [blame] | 838 | } |
Alexandre Julliard | af268c6 | 2008-01-02 16:16:00 +0100 | [diff] [blame] | 839 | if (master_timeout) /* cancel previous timeout */ |
| 840 | remove_timeout_user( master_timeout ); |
| 841 | |
Alexandre Julliard | 2f1e73c | 2008-01-07 17:19:05 +0100 | [diff] [blame] | 842 | master_timeout = add_timeout_user( timeout, close_socket_timeout, NULL ); |
Alexandre Julliard | 338e757 | 1998-12-27 15:28:54 +0000 | [diff] [blame] | 843 | } |