Remember the allocated string to free it.
[wine/multimedia.git] / server / change.c
blob50f193eded79cdcfcd9003b758e5cf7629acadd3
1 /*
2 * Server-side change notification management
4 * Copyright (C) 1998 Alexandre Julliard
5 */
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 #include "winerror.h"
12 #include "winnt.h"
14 #include "handle.h"
15 #include "thread.h"
16 #include "request.h"
18 struct change
20 struct object obj; /* object header */
21 int subtree; /* watch all the subtree */
22 int filter; /* notification filter */
25 static void change_dump( struct object *obj, int verbose );
26 static int change_signaled( struct object *obj, struct thread *thread );
28 static const struct object_ops change_ops =
30 sizeof(struct change),
31 change_dump,
32 add_queue,
33 remove_queue,
34 change_signaled,
35 no_satisfied,
36 no_read_fd,
37 no_write_fd,
38 no_flush,
39 no_get_file_info,
40 no_destroy
44 static struct change *create_change_notification( int subtree, int filter )
46 struct change *change;
47 if ((change = alloc_object( &change_ops )))
49 change->subtree = subtree;
50 change->filter = filter;
52 return change;
55 static void change_dump( struct object *obj, int verbose )
57 struct change *change = (struct change *)obj;
58 assert( obj->ops == &change_ops );
59 fprintf( stderr, "Change notification sub=%d filter=%08x\n",
60 change->subtree, change->filter );
63 static int change_signaled( struct object *obj, struct thread *thread )
65 /* struct change *change = (struct change *)obj;*/
66 assert( obj->ops == &change_ops );
67 return 0; /* never signaled for now */
70 /* create a change notification */
71 DECL_HANDLER(create_change_notification)
73 struct change *change;
75 req->handle = -1;
76 if ((change = create_change_notification( req->subtree, req->filter )))
78 req->handle = alloc_handle( current->process, change,
79 STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE, 0 );
80 release_object( change );