ntoskrnl.exe: Associate file object with server object before calling IRP routine.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
29914d583f
commit
bd94c43fcf
|
@ -562,7 +562,6 @@ static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp,
|
||||||
{
|
{
|
||||||
req->handle = wine_server_obj_handle( irp_handle );
|
req->handle = wine_server_obj_handle( irp_handle );
|
||||||
req->status = irp->IoStatus.u.Status;
|
req->status = irp->IoStatus.u.Status;
|
||||||
req->file_ptr = wine_server_client_ptr( file );
|
|
||||||
if (irp->IoStatus.u.Status >= 0)
|
if (irp->IoStatus.u.Status >= 0)
|
||||||
{
|
{
|
||||||
req->size = irp->IoStatus.Information;
|
req->size = irp->IoStatus.Information;
|
||||||
|
@ -606,8 +605,10 @@ static NTSTATUS dispatch_create( const irp_params_t *params, void *in_buff, ULON
|
||||||
IO_STACK_LOCATION *irpsp;
|
IO_STACK_LOCATION *irpsp;
|
||||||
FILE_OBJECT *file;
|
FILE_OBJECT *file;
|
||||||
DEVICE_OBJECT *device = wine_server_get_ptr( params->create.device );
|
DEVICE_OBJECT *device = wine_server_get_ptr( params->create.device );
|
||||||
|
HANDLE handle = wine_server_ptr_handle( params->create.file );
|
||||||
|
|
||||||
if (!(file = alloc_kernel_object( IoFileObjectType, NULL, sizeof(*file), 1 ))) return STATUS_NO_MEMORY;
|
if (!(file = alloc_kernel_object( IoFileObjectType, handle, sizeof(*file), 0 )))
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "device %p -> file %p\n", device, file );
|
TRACE( "device %p -> file %p\n", device, file );
|
||||||
|
|
||||||
|
@ -615,12 +616,9 @@ static NTSTATUS dispatch_create( const irp_params_t *params, void *in_buff, ULON
|
||||||
file->Size = sizeof(*file);
|
file->Size = sizeof(*file);
|
||||||
file->DeviceObject = device;
|
file->DeviceObject = device;
|
||||||
|
|
||||||
if (!(irp = IoAllocateIrp( device->StackSize, FALSE )))
|
if (!(irp = IoAllocateIrp( device->StackSize, FALSE ))) return STATUS_NO_MEMORY;
|
||||||
{
|
|
||||||
ObDereferenceObject( file );
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ObReferenceObject( file );
|
||||||
irpsp = IoGetNextIrpStackLocation( irp );
|
irpsp = IoGetNextIrpStackLocation( irp );
|
||||||
irpsp->MajorFunction = IRP_MJ_CREATE;
|
irpsp->MajorFunction = IRP_MJ_CREATE;
|
||||||
irpsp->FileObject = file;
|
irpsp->FileObject = file;
|
||||||
|
|
|
@ -3429,7 +3429,6 @@ struct set_irp_result_request
|
||||||
obj_handle_t handle;
|
obj_handle_t handle;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
data_size_t size;
|
data_size_t size;
|
||||||
client_ptr_t file_ptr;
|
|
||||||
/* VARARG(data,bytes); */
|
/* VARARG(data,bytes); */
|
||||||
};
|
};
|
||||||
struct set_irp_result_reply
|
struct set_irp_result_reply
|
||||||
|
@ -6695,6 +6694,6 @@ union generic_reply
|
||||||
struct resume_process_reply resume_process_reply;
|
struct resume_process_reply resume_process_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 582
|
#define SERVER_PROTOCOL_VERSION 583
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||||
|
|
|
@ -943,8 +943,6 @@ 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 && irp->file->device->manager)
|
|
||||||
set_kernel_object( irp->file->device->manager, &irp->file->obj, 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 );
|
||||||
|
|
|
@ -2476,7 +2476,6 @@ enum message_type
|
||||||
obj_handle_t handle; /* handle to the irp */
|
obj_handle_t handle; /* handle to the irp */
|
||||||
unsigned int status; /* status of the irp */
|
unsigned int status; /* status of the irp */
|
||||||
data_size_t size; /* result size (input or output depending on the operation) */
|
data_size_t size; /* result size (input or output depending on the operation) */
|
||||||
client_ptr_t file_ptr; /* opaque pointer to the file object */
|
|
||||||
VARARG(data,bytes); /* output data of the irp */
|
VARARG(data,bytes); /* output data of the irp */
|
||||||
@END
|
@END
|
||||||
|
|
||||||
|
|
|
@ -1656,8 +1656,7 @@ C_ASSERT( sizeof(struct ioctl_reply) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, handle) == 12 );
|
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, handle) == 12 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, status) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, status) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, size) == 20 );
|
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, size) == 20 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct set_irp_result_request, file_ptr) == 24 );
|
C_ASSERT( sizeof(struct set_irp_result_request) == 24 );
|
||||||
C_ASSERT( sizeof(struct set_irp_result_request) == 32 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, access) == 12 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, access) == 12 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, options) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, options) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, sharing) == 20 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, sharing) == 20 );
|
||||||
|
|
|
@ -3014,7 +3014,6 @@ static void dump_set_irp_result_request( const struct set_irp_result_request *re
|
||||||
fprintf( stderr, " handle=%04x", req->handle );
|
fprintf( stderr, " handle=%04x", req->handle );
|
||||||
fprintf( stderr, ", status=%08x", req->status );
|
fprintf( stderr, ", status=%08x", req->status );
|
||||||
fprintf( stderr, ", size=%u", req->size );
|
fprintf( stderr, ", size=%u", req->size );
|
||||||
dump_uint64( ", file_ptr=", &req->file_ptr );
|
|
||||||
dump_varargs_bytes( ", data=", cur_size );
|
dump_varargs_bytes( ", data=", cur_size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue