Rearrange winver detection code and cache the winver value we
[wine.git] / server / change.c
blob679df12c8038414e091259e8830a81688ab510e7
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"
17 struct change
19 struct object obj; /* object header */
20 int subtree; /* watch all the subtree */
21 int filter; /* notification filter */
24 static void change_dump( struct object *obj, int verbose );
25 static int change_signaled( struct object *obj, struct thread *thread );
26 static void change_destroy( struct object *obj );
28 static const struct object_ops change_ops =
30 change_dump,
31 add_queue,
32 remove_queue,
33 change_signaled,
34 no_satisfied,
35 no_read_fd,
36 no_write_fd,
37 no_flush,
38 no_get_file_info,
39 change_destroy
43 static struct object *create_change_notification( int subtree, int filter )
45 struct change *change;
46 if (!(change = mem_alloc( sizeof(*change) ))) return NULL;
47 init_object( &change->obj, &change_ops, NULL );
48 change->subtree = subtree;
49 change->filter = filter;
50 return &change->obj;
53 static void change_dump( struct object *obj, int verbose )
55 struct change *change = (struct change *)obj;
56 assert( obj->ops == &change_ops );
57 fprintf( stderr, "Change notification sub=%d filter=%08x\n",
58 change->subtree, change->filter );
61 static int change_signaled( struct object *obj, struct thread *thread )
63 /* struct change *change = (struct change *)obj;*/
64 assert( obj->ops == &change_ops );
65 return 0; /* never signaled for now */
68 static void change_destroy( struct object *obj )
70 struct change *change = (struct change *)obj;
71 assert( obj->ops == &change_ops );
72 free( change );
75 /* create a change notification */
76 DECL_HANDLER(create_change_notification)
78 struct object *obj;
79 struct create_change_notification_reply reply = { -1 };
81 if ((obj = create_change_notification( req->subtree, req->filter )))
83 reply.handle = alloc_handle( current->process, obj,
84 STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE, 0 );
85 release_object( obj );
87 send_reply( current, -1, 1, &reply, sizeof(reply) );