Change WSACleanup - wsinfo is a static structure now.
[wine.git] / server / device.c
blob5c197345c3fdcb848eb63a820491d4850fc689f6
1 /*
2 * Server-side device management
4 * Copyright (C) 1999 Alexandre Julliard
5 */
7 /*
8 * FIXME:
9 * all this stuff is a simple hack to avoid breaking
10 * client-side device support.
13 #include <assert.h>
14 #include <fcntl.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
19 #include "winbase.h"
21 #include "handle.h"
22 #include "thread.h"
23 #include "request.h"
25 struct device
27 struct object obj; /* object header */
28 int id; /* client identifier */
31 static void device_dump( struct object *obj, int verbose );
32 static int device_get_info( struct object *obj, struct get_file_info_request *req );
34 static const struct object_ops device_ops =
36 sizeof(struct device), /* size */
37 device_dump, /* dump */
38 no_add_queue, /* add_queue */
39 NULL, /* remove_queue */
40 NULL, /* signaled */
41 NULL, /* satisfied */
42 NULL, /* get_poll_events */
43 NULL, /* poll_event */
44 no_get_fd, /* get_fd */
45 no_flush, /* flush */
46 device_get_info, /* get_file_info */
47 no_destroy /* destroy */
50 static struct device *create_device( int id )
52 struct device *dev;
53 if ((dev = alloc_object( &device_ops, -1 )))
55 dev->id = id;
57 return dev;
60 static void device_dump( struct object *obj, int verbose )
62 struct device *dev = (struct device *)obj;
63 assert( obj->ops == &device_ops );
64 fprintf( stderr, "Device id=%08x\n", dev->id );
67 static int device_get_info( struct object *obj, struct get_file_info_request *req )
69 struct device *dev = (struct device *)obj;
70 assert( obj->ops == &device_ops );
71 req->type = FILE_TYPE_UNKNOWN;
72 req->attr = dev->id; /* hack! */
73 req->access_time = 0;
74 req->write_time = 0;
75 req->size_high = 0;
76 req->size_low = 0;
77 req->links = 0;
78 req->index_high = 0;
79 req->index_low = 0;
80 req->serial = 0;
81 return 1;
84 /* create a device */
85 DECL_HANDLER(create_device)
87 struct device *dev;
89 req->handle = 0;
90 if ((dev = create_device( req->id )))
92 req->handle = alloc_handle( current->process, dev, req->access, req->inherit );
93 release_object( dev );