Commit 31f6f0ee authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Set file user pointer in get_next_device_request handler.

parent e78d7b08
...@@ -503,7 +503,6 @@ static int device_file_close_handle( struct object *obj, struct process *process ...@@ -503,7 +503,6 @@ static int device_file_close_handle( struct object *obj, struct process *process
memset( &params, 0, sizeof(params) ); memset( &params, 0, sizeof(params) );
params.close.major = IRP_MJ_CLOSE; params.close.major = IRP_MJ_CLOSE;
params.close.file = file->user_ptr;
if ((irp = create_irp( file, &params, NULL ))) if ((irp = create_irp( file, &params, NULL )))
{ {
...@@ -529,26 +528,27 @@ static void device_file_destroy( struct object *obj ) ...@@ -529,26 +528,27 @@ static void device_file_destroy( struct object *obj )
release_object( file->device ); release_object( file->device );
} }
static void set_file_user_ptr( struct device_file *file, client_ptr_t ptr ) static void fill_irp_params( struct irp_call *irp, irp_params_t *params )
{ {
struct irp_call *irp; *params = irp->params;
if (file->user_ptr == ptr) return; /* nothing to do */
file->user_ptr = ptr;
/* update already queued irps */ switch (params->major)
LIST_FOR_EACH_ENTRY( irp, &file->requests, struct irp_call, dev_entry )
{
switch (irp->params.major)
{ {
case IRP_MJ_CLOSE: irp->params.close.file = ptr; break; case IRP_MJ_CLOSE:
case IRP_MJ_READ: irp->params.read.file = ptr; break; params->close.file = irp->file->user_ptr;
case IRP_MJ_WRITE: irp->params.write.file = ptr; break; break;
case IRP_MJ_FLUSH_BUFFERS: irp->params.flush.file = ptr; break; case IRP_MJ_READ:
case IRP_MJ_DEVICE_CONTROL: irp->params.ioctl.file = ptr; break; params->read.file = irp->file->user_ptr;
} break;
case IRP_MJ_WRITE:
params->write.file = irp->file->user_ptr;
break;
case IRP_MJ_FLUSH_BUFFERS:
params->flush.file = irp->file->user_ptr;
break;
case IRP_MJ_DEVICE_CONTROL:
params->ioctl.file = irp->file->user_ptr;
break;
} }
} }
...@@ -580,7 +580,6 @@ static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ...@@ -580,7 +580,6 @@ static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos
params.read.major = IRP_MJ_READ; params.read.major = IRP_MJ_READ;
params.read.key = 0; params.read.key = 0;
params.read.pos = pos; params.read.pos = pos;
params.read.file = file->user_ptr;
return queue_irp( file, &params, async ); return queue_irp( file, &params, async );
} }
...@@ -593,7 +592,6 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ...@@ -593,7 +592,6 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos
params.write.major = IRP_MJ_WRITE; params.write.major = IRP_MJ_WRITE;
params.write.key = 0; params.write.key = 0;
params.write.pos = pos; params.write.pos = pos;
params.write.file = file->user_ptr;
return queue_irp( file, &params, async ); return queue_irp( file, &params, async );
} }
...@@ -604,7 +602,6 @@ static int device_file_flush( struct fd *fd, struct async *async ) ...@@ -604,7 +602,6 @@ static int device_file_flush( struct fd *fd, struct async *async )
memset( &params, 0, sizeof(params) ); memset( &params, 0, sizeof(params) );
params.flush.major = IRP_MJ_FLUSH_BUFFERS; params.flush.major = IRP_MJ_FLUSH_BUFFERS;
params.flush.file = file->user_ptr;
return queue_irp( file, &params, async ); return queue_irp( file, &params, async );
} }
...@@ -616,7 +613,6 @@ static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *as ...@@ -616,7 +613,6 @@ static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
memset( &params, 0, sizeof(params) ); memset( &params, 0, sizeof(params) );
params.ioctl.major = IRP_MJ_DEVICE_CONTROL; params.ioctl.major = IRP_MJ_DEVICE_CONTROL;
params.ioctl.code = code; params.ioctl.code = code;
params.ioctl.file = file->user_ptr;
return queue_irp( file, &params, async ); return queue_irp( file, &params, async );
} }
...@@ -752,7 +748,6 @@ void free_kernel_objects( struct object *obj ) ...@@ -752,7 +748,6 @@ void free_kernel_objects( struct object *obj )
/* abuse IRP_MJ_CLEANUP to request client to free no longer valid kernel object */ /* abuse IRP_MJ_CLEANUP to request client to free no longer valid kernel object */
memset( &params, 0, sizeof(params) ); memset( &params, 0, sizeof(params) );
params.cleanup.major = IRP_MJ_CLEANUP; params.cleanup.major = IRP_MJ_CLEANUP;
params.cleanup.obj = kernel_object->user_ptr;
if ((irp = create_irp( NULL, &params, NULL ))) if ((irp = create_irp( NULL, &params, NULL )))
{ {
...@@ -869,13 +864,13 @@ DECL_HANDLER(get_next_device_request) ...@@ -869,13 +864,13 @@ DECL_HANDLER(get_next_device_request)
reply->client_thread = get_kernel_object_ptr( manager, &irp->thread->obj ); reply->client_thread = get_kernel_object_ptr( manager, &irp->thread->obj );
reply->client_tid = get_thread_id( irp->thread ); reply->client_tid = get_thread_id( irp->thread );
} }
reply->params = irp->params;
iosb = irp->iosb; iosb = irp->iosb;
reply->in_size = iosb->in_size; reply->in_size = iosb->in_size;
reply->out_size = iosb->out_size; reply->out_size = iosb->out_size;
if (iosb->in_size > get_reply_max_size()) set_error( STATUS_BUFFER_OVERFLOW ); if (iosb->in_size > get_reply_max_size()) set_error( STATUS_BUFFER_OVERFLOW );
else if (!irp->file || (reply->next = alloc_handle( current->process, irp, 0, 0 ))) else if (!irp->file || (reply->next = alloc_handle( current->process, irp, 0, 0 )))
{ {
fill_irp_params( irp, &reply->params );
set_reply_data_ptr( iosb->in_data, iosb->in_size ); set_reply_data_ptr( iosb->in_data, iosb->in_size );
iosb->in_data = NULL; iosb->in_data = NULL;
iosb->in_size = 0; iosb->in_size = 0;
...@@ -897,7 +892,7 @@ DECL_HANDLER(set_irp_result) ...@@ -897,7 +892,7 @@ DECL_HANDLER(set_irp_result)
if ((irp = (struct irp_call *)get_handle_obj( current->process, req->handle, 0, &irp_call_ops ))) if ((irp = (struct irp_call *)get_handle_obj( current->process, req->handle, 0, &irp_call_ops )))
{ {
if (irp->file) set_file_user_ptr( irp->file, req->file_ptr ); if (irp->file) irp->file->user_ptr = req->file_ptr;
set_irp_result( irp, req->status, get_req_data(), get_req_data_size(), req->size ); set_irp_result( irp, req->status, get_req_data(), get_req_data_size(), req->size );
close_handle( current->process, req->handle ); /* avoid an extra round-trip for close */ close_handle( current->process, req->handle ); /* avoid an extra round-trip for close */
release_object( irp ); release_object( irp );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment