Commit 101da2b5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Store IRP client pointer on server side.

parent dfe20465
...@@ -557,6 +557,7 @@ struct dispatch_context ...@@ -557,6 +557,7 @@ struct dispatch_context
{ {
irp_params_t params; irp_params_t params;
HANDLE handle; HANDLE handle;
IRP *irp;
ULONG in_size; ULONG in_size;
void *in_buff; void *in_buff;
}; };
...@@ -570,6 +571,7 @@ static void dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_conte ...@@ -570,6 +571,7 @@ static void dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_conte
KeQueryTickCount( &count ); /* update the global KeTickCount */ KeQueryTickCount( &count ); /* update the global KeTickCount */
context->irp = irp;
device->CurrentIrp = irp; device->CurrentIrp = irp;
IoCallDriver( device, irp ); IoCallDriver( device, irp );
device->CurrentIrp = NULL; device->CurrentIrp = NULL;
...@@ -931,9 +933,10 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) ...@@ -931,9 +933,10 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
SERVER_START_REQ( get_next_device_request ) SERVER_START_REQ( get_next_device_request )
{ {
req->manager = wine_server_obj_handle( manager ); req->manager = wine_server_obj_handle( manager );
req->prev = wine_server_obj_handle( context.handle ); req->prev = wine_server_obj_handle( context.handle );
req->status = status; req->user_ptr = wine_server_client_ptr( context.irp );
req->status = status;
wine_server_set_reply( req, context.in_buff, context.in_size ); wine_server_set_reply( req, context.in_buff, context.in_size );
if (!(status = wine_server_call( req ))) if (!(status = wine_server_call( req )))
{ {
...@@ -949,6 +952,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) ...@@ -949,6 +952,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
if (status == STATUS_BUFFER_OVERFLOW) if (status == STATUS_BUFFER_OVERFLOW)
context.in_size = reply->in_size; context.in_size = reply->in_size;
} }
context.irp = NULL;
} }
SERVER_END_REQ; SERVER_END_REQ;
......
...@@ -5252,6 +5252,7 @@ struct get_next_device_request_request ...@@ -5252,6 +5252,7 @@ struct get_next_device_request_request
obj_handle_t manager; obj_handle_t manager;
obj_handle_t prev; obj_handle_t prev;
unsigned int status; unsigned int status;
client_ptr_t user_ptr;
}; };
struct get_next_device_request_reply struct get_next_device_request_reply
{ {
...@@ -6694,6 +6695,6 @@ union generic_reply ...@@ -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 583 #define SERVER_PROTOCOL_VERSION 584
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -52,6 +52,7 @@ struct irp_call ...@@ -52,6 +52,7 @@ struct irp_call
struct async *async; /* pending async op */ struct async *async; /* pending async op */
irp_params_t params; /* irp parameters */ irp_params_t params; /* irp parameters */
struct iosb *iosb; /* I/O status block */ 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 ); 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 ...@@ -351,6 +352,7 @@ static struct irp_call *create_irp( struct device_file *file, const irp_params_t
irp->async = NULL; irp->async = NULL;
irp->params = *params; irp->params = *params;
irp->iosb = NULL; irp->iosb = NULL;
irp->user_ptr = 0;
if (async) irp->iosb = async_get_iosb( async ); if (async) irp->iosb = async_get_iosb( async );
if (!irp->iosb && !(irp->iosb = create_iosb( NULL, 0, 0 ))) if (!irp->iosb && !(irp->iosb = create_iosb( NULL, 0, 0 )))
...@@ -886,13 +888,17 @@ DECL_HANDLER(get_next_device_request) ...@@ -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 */ 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) if (manager->current_call)
{ {
irp = manager->current_call; irp = manager->current_call;
irp->user_ptr = req->user_ptr;
if (req->status) if (req->status)
set_irp_result( irp, req->status, NULL, 0, 0 ); set_irp_result( irp, req->status, NULL, 0, 0 );
else if (irp->async) else if (irp->async)
set_async_pending( irp->async, irp->file && is_fd_overlapped( irp->file->fd ) ); set_async_pending( irp->async, irp->file && is_fd_overlapped( irp->file->fd ) );
free_irp_params( irp ); free_irp_params( irp );
release_object( irp ); release_object( irp );
manager->current_call = NULL; manager->current_call = NULL;
......
...@@ -3633,6 +3633,7 @@ struct handle_info ...@@ -3633,6 +3633,7 @@ struct handle_info
obj_handle_t manager; /* handle to the device manager */ obj_handle_t manager; /* handle to the device manager */
obj_handle_t prev; /* handle to the previous irp */ obj_handle_t prev; /* handle to the previous irp */
unsigned int status; /* status of the previous irp */ unsigned int status; /* status of the previous irp */
client_ptr_t user_ptr; /* user pointer of the previous irp */
@REPLY @REPLY
irp_params_t params; /* irp parameters */ irp_params_t params; /* irp parameters */
obj_handle_t next; /* handle to the next irp */ obj_handle_t next; /* handle to the next irp */
......
...@@ -2287,7 +2287,8 @@ C_ASSERT( sizeof(struct delete_device_request) == 24 ); ...@@ -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, manager) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_request, prev) == 16 ); 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( 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, params) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_next_device_request_reply, next) == 40 ); 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 ); C_ASSERT( FIELD_OFFSET(struct get_next_device_request_reply, client_tid) == 44 );
......
...@@ -4282,6 +4282,7 @@ static void dump_get_next_device_request_request( const struct get_next_device_r ...@@ -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, " manager=%04x", req->manager );
fprintf( stderr, ", prev=%04x", req->prev ); fprintf( stderr, ", prev=%04x", req->prev );
fprintf( stderr, ", status=%08x", req->status ); 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 ) static void dump_get_next_device_request_reply( const struct get_next_device_request_reply *req )
......
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