1998-12-31 16:43:48 +01:00
|
|
|
/*
|
|
|
|
* Server-side change notification management
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Alexandre Julliard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winnt.h"
|
1999-05-15 12:48:19 +02:00
|
|
|
|
|
|
|
#include "handle.h"
|
|
|
|
#include "thread.h"
|
1999-06-22 19:26:53 +02:00
|
|
|
#include "request.h"
|
1998-12-31 16:43:48 +01:00
|
|
|
|
|
|
|
struct change
|
|
|
|
{
|
|
|
|
struct object obj; /* object header */
|
|
|
|
int subtree; /* watch all the subtree */
|
|
|
|
int filter; /* notification filter */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void change_dump( struct object *obj, int verbose );
|
|
|
|
static int change_signaled( struct object *obj, struct thread *thread );
|
|
|
|
|
|
|
|
static const struct object_ops change_ops =
|
|
|
|
{
|
1999-06-22 19:26:53 +02:00
|
|
|
sizeof(struct change),
|
1998-12-31 16:43:48 +01:00
|
|
|
change_dump,
|
|
|
|
add_queue,
|
|
|
|
remove_queue,
|
|
|
|
change_signaled,
|
|
|
|
no_satisfied,
|
|
|
|
no_read_fd,
|
|
|
|
no_write_fd,
|
|
|
|
no_flush,
|
1999-01-03 12:55:56 +01:00
|
|
|
no_get_file_info,
|
1999-06-22 19:26:53 +02:00
|
|
|
no_destroy
|
1998-12-31 16:43:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-06-26 10:43:26 +02:00
|
|
|
static struct change *create_change_notification( int subtree, int filter )
|
1998-12-31 16:43:48 +01:00
|
|
|
{
|
|
|
|
struct change *change;
|
1999-06-26 10:43:26 +02:00
|
|
|
if ((change = alloc_object( &change_ops )))
|
|
|
|
{
|
|
|
|
change->subtree = subtree;
|
|
|
|
change->filter = filter;
|
|
|
|
}
|
|
|
|
return change;
|
1998-12-31 16:43:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void change_dump( struct object *obj, int verbose )
|
|
|
|
{
|
|
|
|
struct change *change = (struct change *)obj;
|
|
|
|
assert( obj->ops == &change_ops );
|
1999-01-03 12:55:56 +01:00
|
|
|
fprintf( stderr, "Change notification sub=%d filter=%08x\n",
|
|
|
|
change->subtree, change->filter );
|
1998-12-31 16:43:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int change_signaled( struct object *obj, struct thread *thread )
|
|
|
|
{
|
|
|
|
/* struct change *change = (struct change *)obj;*/
|
|
|
|
assert( obj->ops == &change_ops );
|
|
|
|
return 0; /* never signaled for now */
|
|
|
|
}
|
|
|
|
|
1999-05-15 12:48:19 +02:00
|
|
|
/* create a change notification */
|
|
|
|
DECL_HANDLER(create_change_notification)
|
|
|
|
{
|
1999-06-26 10:43:26 +02:00
|
|
|
struct change *change;
|
1999-05-15 12:48:19 +02:00
|
|
|
|
1999-06-26 10:43:26 +02:00
|
|
|
req->handle = -1;
|
|
|
|
if ((change = create_change_notification( req->subtree, req->filter )))
|
1999-05-15 12:48:19 +02:00
|
|
|
{
|
1999-06-26 10:43:26 +02:00
|
|
|
req->handle = alloc_handle( current->process, change,
|
|
|
|
STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE, 0 );
|
|
|
|
release_object( change );
|
1999-05-15 12:48:19 +02:00
|
|
|
}
|
|
|
|
}
|