server: Store IRP client pointer on server side.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-05-28 14:09:47 +02:00 committed by Alexandre Julliard
parent dfe20465e8
commit 101da2b512
6 changed files with 19 additions and 5 deletions

View File

@ -557,6 +557,7 @@ struct dispatch_context
{
irp_params_t params;
HANDLE handle;
IRP *irp;
ULONG in_size;
void *in_buff;
};
@ -570,6 +571,7 @@ static void dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_conte
KeQueryTickCount( &count ); /* update the global KeTickCount */
context->irp = irp;
device->CurrentIrp = irp;
IoCallDriver( device, irp );
device->CurrentIrp = NULL;
@ -931,9 +933,10 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
SERVER_START_REQ( get_next_device_request )
{
req->manager = wine_server_obj_handle( manager );
req->prev = wine_server_obj_handle( context.handle );
req->status = status;
req->manager = wine_server_obj_handle( manager );
req->prev = wine_server_obj_handle( context.handle );
req->user_ptr = wine_server_client_ptr( context.irp );
req->status = status;
wine_server_set_reply( req, context.in_buff, context.in_size );
if (!(status = wine_server_call( req )))
{
@ -949,6 +952,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
if (status == STATUS_BUFFER_OVERFLOW)
context.in_size = reply->in_size;
}
context.irp = NULL;
}
SERVER_END_REQ;

View File

@ -5252,6 +5252,7 @@ struct get_next_device_request_request
obj_handle_t manager;
obj_handle_t prev;
unsigned int status;
client_ptr_t user_ptr;
};
struct get_next_device_request_reply
{
@ -6694,6 +6695,6 @@ union generic_reply
struct resume_process_reply resume_process_reply;
};
#define SERVER_PROTOCOL_VERSION 583
#define SERVER_PROTOCOL_VERSION 584
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -52,6 +52,7 @@ struct irp_call
struct async *async; /* pending async op */
irp_params_t params; /* irp parameters */
struct iosb *iosb; /* I/O status block */
client_ptr_t user_ptr; /* client side pointer */
};
static void irp_call_dump( struct object *obj, int verbose );
@ -351,6 +352,7 @@ static struct irp_call *create_irp( struct device_file *file, const irp_params_t
irp->async = NULL;
irp->params = *params;
irp->iosb = NULL;
irp->user_ptr = 0;
if (async) irp->iosb = async_get_iosb( async );
if (!irp->iosb && !(irp->iosb = create_iosb( NULL, 0, 0 )))
@ -886,13 +888,17 @@ DECL_HANDLER(get_next_device_request)
if (req->prev) close_handle( current->process, req->prev ); /* avoid an extra round-trip for close */
/* process result of previous call */
if (manager->current_call)
{
irp = manager->current_call;
irp->user_ptr = req->user_ptr;
if (req->status)
set_irp_result( irp, req->status, NULL, 0, 0 );
else if (irp->async)
set_async_pending( irp->async, irp->file && is_fd_overlapped( irp->file->fd ) );
free_irp_params( irp );
release_object( irp );
manager->current_call = NULL;

View File

@ -3633,6 +3633,7 @@ struct handle_info
obj_handle_t manager; /* handle to the device manager */
obj_handle_t prev; /* handle to the previous irp */
unsigned int status; /* status of the previous irp */
client_ptr_t user_ptr; /* user pointer of the previous irp */
@REPLY
irp_params_t params; /* irp parameters */
obj_handle_t next; /* handle to the next irp */

View File

@ -2287,7 +2287,8 @@ C_ASSERT( sizeof(struct delete_device_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_request, manager) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_request, prev) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_request, status) == 20 );
C_ASSERT( sizeof(struct get_next_device_request_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_request, user_ptr) == 24 );
C_ASSERT( sizeof(struct get_next_device_request_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_reply, params) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_reply, next) == 40 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_reply, client_tid) == 44 );

View File

@ -4282,6 +4282,7 @@ static void dump_get_next_device_request_request( const struct get_next_device_r
fprintf( stderr, " manager=%04x", req->manager );
fprintf( stderr, ", prev=%04x", req->prev );
fprintf( stderr, ", status=%08x", req->status );
dump_uint64( ", user_ptr=", &req->user_ptr );
}
static void dump_get_next_device_request_reply( const struct get_next_device_request_reply *req )