French translation of the README file.
[wine.git] / server / device.c
blob61ead6cb7d1ec029c5783eb7b49c663edef36df3
1 /*
2 * Server-side device management
4 * Copyright (C) 1999 Alexandre Julliard
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.
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.
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
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * FIXME:
23 * all this stuff is a simple hack to avoid breaking
24 * client-side device support.
27 #include <assert.h>
28 #include <fcntl.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
33 #include "winbase.h"
35 #include "handle.h"
36 #include "thread.h"
37 #include "request.h"
39 struct device
41 struct object obj; /* object header */
42 int id; /* client identifier */
45 static void device_dump( struct object *obj, int verbose );
46 static int device_get_info( struct object *obj, struct get_file_info_reply *reply, int *flags );
48 static const struct object_ops device_ops =
50 sizeof(struct device), /* size */
51 device_dump, /* dump */
52 no_add_queue, /* add_queue */
53 NULL, /* remove_queue */
54 NULL, /* signaled */
55 NULL, /* satisfied */
56 NULL, /* get_poll_events */
57 NULL, /* poll_event */
58 no_get_fd, /* get_fd */
59 no_flush, /* flush */
60 device_get_info, /* get_file_info */
61 NULL, /* queue_async */
62 no_destroy /* destroy */
65 static struct device *create_device( int id )
67 struct device *dev;
68 if ((dev = alloc_object( &device_ops, -1 )))
70 dev->id = id;
72 return dev;
75 static void device_dump( struct object *obj, int verbose )
77 struct device *dev = (struct device *)obj;
78 assert( obj->ops == &device_ops );
79 fprintf( stderr, "Device id=%08x\n", dev->id );
82 static int device_get_info( struct object *obj, struct get_file_info_reply *reply, int *flags )
84 struct device *dev = (struct device *)obj;
85 assert( obj->ops == &device_ops );
87 if (reply)
89 reply->type = FILE_TYPE_UNKNOWN;
90 reply->attr = dev->id; /* hack! */
91 reply->access_time = 0;
92 reply->write_time = 0;
93 reply->size_high = 0;
94 reply->size_low = 0;
95 reply->links = 0;
96 reply->index_high = 0;
97 reply->index_low = 0;
98 reply->serial = 0;
100 *flags = 0;
101 return FD_TYPE_DEFAULT;
104 /* create a device */
105 DECL_HANDLER(create_device)
107 struct device *dev;
109 reply->handle = 0;
110 if ((dev = create_device( req->id )))
112 reply->handle = alloc_handle( current->process, dev, req->access, req->inherit );
113 release_object( dev );