server: Pass file object handle in IRP_CALL_CREATE request.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
781dd9a145
commit
29914d583f
|
@ -662,6 +662,7 @@ typedef union
|
||||||
unsigned int sharing;
|
unsigned int sharing;
|
||||||
unsigned int options;
|
unsigned int options;
|
||||||
client_ptr_t device;
|
client_ptr_t device;
|
||||||
|
obj_handle_t file;
|
||||||
} create;
|
} create;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -6694,6 +6695,6 @@ union generic_reply
|
||||||
struct resume_process_reply resume_process_reply;
|
struct resume_process_reply resume_process_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 581
|
#define SERVER_PROTOCOL_VERSION 582
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||||
|
|
|
@ -539,32 +539,49 @@ static void device_file_destroy( struct object *obj )
|
||||||
release_object( file->device );
|
release_object( file->device );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_irp_params( struct device_manager *manager, struct irp_call *irp, irp_params_t *params )
|
static int fill_irp_params( struct device_manager *manager, struct irp_call *irp, irp_params_t *params )
|
||||||
{
|
{
|
||||||
*params = irp->params;
|
switch (irp->params.type)
|
||||||
|
|
||||||
switch (params->type)
|
|
||||||
{
|
{
|
||||||
case IRP_CALL_NONE:
|
case IRP_CALL_NONE:
|
||||||
case IRP_CALL_CREATE:
|
|
||||||
case IRP_CALL_FREE:
|
case IRP_CALL_FREE:
|
||||||
break;
|
break;
|
||||||
|
case IRP_CALL_CREATE:
|
||||||
|
irp->params.create.file = alloc_handle( current->process, irp->file,
|
||||||
|
irp->params.create.access, 0 );
|
||||||
|
if (!irp->params.create.file) return 0;
|
||||||
|
break;
|
||||||
case IRP_CALL_CLOSE:
|
case IRP_CALL_CLOSE:
|
||||||
params->close.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
irp->params.close.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
||||||
break;
|
break;
|
||||||
case IRP_CALL_READ:
|
case IRP_CALL_READ:
|
||||||
params->read.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
irp->params.read.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
||||||
params->read.out_size = irp->iosb->out_size;
|
irp->params.read.out_size = irp->iosb->out_size;
|
||||||
break;
|
break;
|
||||||
case IRP_CALL_WRITE:
|
case IRP_CALL_WRITE:
|
||||||
params->write.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
irp->params.write.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
||||||
break;
|
break;
|
||||||
case IRP_CALL_FLUSH:
|
case IRP_CALL_FLUSH:
|
||||||
params->flush.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
irp->params.flush.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
||||||
break;
|
break;
|
||||||
case IRP_CALL_IOCTL:
|
case IRP_CALL_IOCTL:
|
||||||
params->ioctl.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
irp->params.ioctl.file = get_kernel_object_ptr( manager, &irp->file->obj );
|
||||||
params->ioctl.out_size = irp->iosb->out_size;
|
irp->params.ioctl.out_size = irp->iosb->out_size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*params = irp->params;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_irp_params( struct irp_call *irp )
|
||||||
|
{
|
||||||
|
switch (irp->params.type)
|
||||||
|
{
|
||||||
|
case IRP_CALL_CREATE:
|
||||||
|
close_handle( current->process, irp->params.create.file );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,15 +892,17 @@ DECL_HANDLER(get_next_device_request)
|
||||||
close_handle( current->process, req->prev ); /* avoid an extra round-trip for close */
|
close_handle( current->process, req->prev ); /* avoid an extra round-trip for close */
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
}
|
}
|
||||||
clear_error();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manager->current_call)
|
if (manager->current_call)
|
||||||
{
|
{
|
||||||
|
free_irp_params( manager->current_call );
|
||||||
release_object( manager->current_call );
|
release_object( manager->current_call );
|
||||||
manager->current_call = NULL;
|
manager->current_call = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear_error();
|
||||||
|
|
||||||
if ((ptr = list_head( &manager->requests )))
|
if ((ptr = list_head( &manager->requests )))
|
||||||
{
|
{
|
||||||
irp = LIST_ENTRY( ptr, struct irp_call, mgr_entry );
|
irp = LIST_ENTRY( ptr, struct irp_call, mgr_entry );
|
||||||
|
@ -897,14 +916,18 @@ DECL_HANDLER(get_next_device_request)
|
||||||
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( manager, irp, &reply->params );
|
if (fill_irp_params( manager, irp, &reply->params ))
|
||||||
set_reply_data_ptr( iosb->in_data, iosb->in_size );
|
{
|
||||||
iosb->in_data = NULL;
|
set_reply_data_ptr( iosb->in_data, iosb->in_size );
|
||||||
iosb->in_size = 0;
|
iosb->in_data = NULL;
|
||||||
list_remove( &irp->mgr_entry );
|
iosb->in_size = 0;
|
||||||
list_init( &irp->mgr_entry );
|
list_remove( &irp->mgr_entry );
|
||||||
if (irp->file) grab_object( irp ); /* we already own the object if it's only on manager queue */
|
list_init( &irp->mgr_entry );
|
||||||
manager->current_call = irp;
|
/* we already own the object if it's only on manager queue */
|
||||||
|
if (irp->file) grab_object( irp );
|
||||||
|
manager->current_call = irp;
|
||||||
|
}
|
||||||
|
else close_handle( current->process, reply->next );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else set_error( STATUS_PENDING );
|
else set_error( STATUS_PENDING );
|
||||||
|
|
|
@ -678,6 +678,7 @@ typedef union
|
||||||
unsigned int sharing; /* sharing flags */
|
unsigned int sharing; /* sharing flags */
|
||||||
unsigned int options; /* file options */
|
unsigned int options; /* file options */
|
||||||
client_ptr_t device; /* opaque ptr for the device */
|
client_ptr_t device; /* opaque ptr for the device */
|
||||||
|
obj_handle_t file; /* file handle */
|
||||||
} create;
|
} create;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -326,7 +326,7 @@ static void dump_irp_params( const char *prefix, const irp_params_t *data )
|
||||||
fprintf( stderr, "%s{CREATE,access=%08x,sharing=%08x,options=%08x",
|
fprintf( stderr, "%s{CREATE,access=%08x,sharing=%08x,options=%08x",
|
||||||
prefix, data->create.access, data->create.sharing, data->create.options );
|
prefix, data->create.access, data->create.sharing, data->create.options );
|
||||||
dump_uint64( ",device=", &data->create.device );
|
dump_uint64( ",device=", &data->create.device );
|
||||||
fputc( '}', stderr );
|
fprintf( stderr, ",file=%08x}", data->create.file );
|
||||||
break;
|
break;
|
||||||
case IRP_CALL_CLOSE:
|
case IRP_CALL_CLOSE:
|
||||||
fprintf( stderr, "%s{CLOSE", prefix );
|
fprintf( stderr, "%s{CLOSE", prefix );
|
||||||
|
|
Loading…
Reference in New Issue