server: Allow creating file kernel objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9784c3fd6f
commit
dcaeddd4db
|
@ -847,7 +847,6 @@ static void test_ob_reference(const WCHAR *test_path)
|
||||||
|
|
||||||
status = ObReferenceObjectByHandle(file_handle2, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj2, NULL);
|
status = ObReferenceObjectByHandle(file_handle2, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj2, NULL);
|
||||||
ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
|
ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
|
||||||
todo_wine
|
|
||||||
ok(obj1 == obj2, "obj1 != obj2\n");
|
ok(obj1 == obj2, "obj1 != obj2\n");
|
||||||
|
|
||||||
file = obj1;
|
file = obj1;
|
||||||
|
|
|
@ -54,11 +54,12 @@
|
||||||
|
|
||||||
struct file
|
struct file
|
||||||
{
|
{
|
||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
struct fd *fd; /* file descriptor for this file */
|
struct fd *fd; /* file descriptor for this file */
|
||||||
unsigned int access; /* file access (FILE_READ_DATA etc.) */
|
unsigned int access; /* file access (FILE_READ_DATA etc.) */
|
||||||
mode_t mode; /* file stat.st_mode */
|
mode_t mode; /* file stat.st_mode */
|
||||||
uid_t uid; /* file stat.st_uid */
|
uid_t uid; /* file stat.st_uid */
|
||||||
|
struct list kernel_object; /* list of kernel object pointers */
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int generic_file_map_access( unsigned int access );
|
static unsigned int generic_file_map_access( unsigned int access );
|
||||||
|
@ -70,6 +71,7 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd
|
||||||
static struct object *file_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
|
static struct object *file_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
|
||||||
static struct object *file_open_file( struct object *obj, unsigned int access,
|
static struct object *file_open_file( struct object *obj, unsigned int access,
|
||||||
unsigned int sharing, unsigned int options );
|
unsigned int sharing, unsigned int options );
|
||||||
|
static struct list *file_get_kernel_obj_list( struct object *obj );
|
||||||
static void file_destroy( struct object *obj );
|
static void file_destroy( struct object *obj );
|
||||||
|
|
||||||
static int file_get_poll_events( struct fd *fd );
|
static int file_get_poll_events( struct fd *fd );
|
||||||
|
@ -94,7 +96,7 @@ static const struct object_ops file_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
file_open_file, /* open_file */
|
file_open_file, /* open_file */
|
||||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
file_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
file_destroy /* destroy */
|
file_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -136,6 +138,7 @@ struct file *create_file_for_fd( int fd, unsigned int access, unsigned int shari
|
||||||
|
|
||||||
file->mode = st.st_mode;
|
file->mode = st.st_mode;
|
||||||
file->access = default_fd_map_access( &file->obj, access );
|
file->access = default_fd_map_access( &file->obj, access );
|
||||||
|
list_init( &file->kernel_object );
|
||||||
if (!(file->fd = create_anonymous_fd( &file_fd_ops, fd, &file->obj,
|
if (!(file->fd = create_anonymous_fd( &file_fd_ops, fd, &file->obj,
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT )))
|
FILE_SYNCHRONOUS_IO_NONALERT )))
|
||||||
{
|
{
|
||||||
|
@ -162,6 +165,7 @@ struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigne
|
||||||
{
|
{
|
||||||
file->mode = st.st_mode;
|
file->mode = st.st_mode;
|
||||||
file->access = default_fd_map_access( &file->obj, access );
|
file->access = default_fd_map_access( &file->obj, access );
|
||||||
|
list_init( &file->kernel_object );
|
||||||
if (!(file->fd = dup_fd_object( fd, access, sharing, FILE_SYNCHRONOUS_IO_NONALERT )))
|
if (!(file->fd = dup_fd_object( fd, access, sharing, FILE_SYNCHRONOUS_IO_NONALERT )))
|
||||||
{
|
{
|
||||||
release_object( file );
|
release_object( file );
|
||||||
|
@ -181,6 +185,7 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_
|
||||||
file->mode = mode;
|
file->mode = mode;
|
||||||
file->uid = ~(uid_t)0;
|
file->uid = ~(uid_t)0;
|
||||||
file->fd = fd;
|
file->fd = fd;
|
||||||
|
list_init( &file->kernel_object );
|
||||||
grab_object( fd );
|
grab_object( fd );
|
||||||
set_fd_user( fd, &file_fd_ops, &file->obj );
|
set_fd_user( fd, &file_fd_ops, &file->obj );
|
||||||
return &file->obj;
|
return &file->obj;
|
||||||
|
@ -631,6 +636,12 @@ static struct object *file_open_file( struct object *obj, unsigned int access,
|
||||||
return new_file;
|
return new_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct list *file_get_kernel_obj_list( struct object *obj )
|
||||||
|
{
|
||||||
|
struct file *file = (struct file *)obj;
|
||||||
|
return &file->kernel_object;
|
||||||
|
}
|
||||||
|
|
||||||
static void file_destroy( struct object *obj )
|
static void file_destroy( struct object *obj )
|
||||||
{
|
{
|
||||||
struct file *file = (struct file *)obj;
|
struct file *file = (struct file *)obj;
|
||||||
|
|
Loading…
Reference in New Issue