Changed the macros in the msvcrt headers to static inline functions.
[wine] / server / change.c
1 /*
2  * Server-side change notification management
3  *
4  * Copyright (C) 1998 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <assert.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 #include "windef.h"
26
27 #include "handle.h"
28 #include "thread.h"
29 #include "request.h"
30
31 struct change
32 {
33     struct object  obj;      /* object header */
34     int            subtree;  /* watch all the subtree */
35     int            filter;   /* notification filter */
36 };
37
38 static void change_dump( struct object *obj, int verbose );
39 static int change_signaled( struct object *obj, struct thread *thread );
40
41 static const struct object_ops change_ops =
42 {
43     sizeof(struct change),    /* size */
44     change_dump,              /* dump */
45     add_queue,                /* add_queue */
46     remove_queue,             /* remove_queue */
47     change_signaled,          /* signaled */
48     no_satisfied,             /* satisfied */
49     no_get_fd,                /* get_fd */
50     no_destroy                /* destroy */
51 };
52
53
54 static struct change *create_change_notification( int subtree, int filter )
55 {
56     struct change *change;
57     if ((change = alloc_object( &change_ops )))
58     {
59         change->subtree = subtree;
60         change->filter  = filter;
61     }
62     return change;
63 }
64
65 static void change_dump( struct object *obj, int verbose )
66 {
67     struct change *change = (struct change *)obj;
68     assert( obj->ops == &change_ops );
69     fprintf( stderr, "Change notification sub=%d filter=%08x\n",
70              change->subtree, change->filter );
71 }
72
73 static int change_signaled( struct object *obj, struct thread *thread )
74 {
75 /*    struct change *change = (struct change *)obj;*/
76     assert( obj->ops == &change_ops );
77     return 0;  /* never signaled for now */
78 }
79
80 /* create a change notification */
81 DECL_HANDLER(create_change_notification)
82 {
83     struct change *change;
84
85     reply->handle = 0;
86     if ((change = create_change_notification( req->subtree, req->filter )))
87     {
88         reply->handle = alloc_handle( current->process, change,
89                                       STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE, 0 );
90         release_object( change );
91     }
92 }