Built a complete translation table for RtlNtStatusToDosError.
[wine.git] / server / device.c
blobb2c038e1c8847cc64ef0d8018b3146f9f55d1fd3
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 "winerror.h"
20 #include "winbase.h"
22 #include "handle.h"
23 #include "thread.h"
24 #include "request.h"
26 struct device
28 struct object obj; /* object header */
29 int id; /* client identifier */
32 static void device_dump( struct object *obj, int verbose );
33 static int device_get_info( struct object *obj, struct get_file_info_request *req );
35 static const struct object_ops device_ops =
37 sizeof(struct device), /* size */
38 device_dump, /* dump */
39 no_add_queue, /* add_queue */
40 NULL, /* remove_queue */
41 NULL, /* signaled */
42 NULL, /* satisfied */
43 NULL, /* get_poll_events */
44 NULL, /* poll_event */
45 no_read_fd, /* get_read_fd */
46 no_write_fd, /* get_write_fd */
47 no_flush, /* flush */
48 device_get_info, /* get_file_info */
49 no_destroy /* destroy */
52 static struct device *create_device( int id )
54 struct device *dev;
55 if ((dev = alloc_object( &device_ops, -1 )))
57 dev->id = id;
59 return dev;
62 static void device_dump( struct object *obj, int verbose )
64 struct device *dev = (struct device *)obj;
65 assert( obj->ops == &device_ops );
66 fprintf( stderr, "Device id=%08x\n", dev->id );
69 static int device_get_info( struct object *obj, struct get_file_info_request *req )
71 struct device *dev = (struct device *)obj;
72 assert( obj->ops == &device_ops );
73 req->type = FILE_TYPE_UNKNOWN;
74 req->attr = dev->id; /* hack! */
75 req->access_time = 0;
76 req->write_time = 0;
77 req->size_high = 0;
78 req->size_low = 0;
79 req->links = 0;
80 req->index_high = 0;
81 req->index_low = 0;
82 req->serial = 0;
83 return 1;
86 /* create a device */
87 DECL_HANDLER(create_device)
89 struct device *dev;
91 req->handle = -1;
92 if ((dev = create_device( req->id )))
94 req->handle = alloc_handle( current->process, dev, req->access, req->inherit );
95 release_object( dev );