Jacek Caban : ntoskrnl.exe: Associate file object with server object before calling IRP routine.

Alexandre Julliard julliard at winehq.org
Fri May 3 15:46:18 CDT 2019


Module: wine
Branch: master
Commit: bd94c43fcf1552a08856a35b15767e620850e204
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bd94c43fcf1552a08856a35b15767e620850e204

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri May  3 15:40:57 2019 +0200

ntoskrnl.exe: Associate file object with server object before calling IRP routine.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/ntoskrnl.c   | 12 +++++-------
 include/wine/server_protocol.h |  3 +--
 server/device.c                |  2 --
 server/protocol.def            |  1 -
 server/request.h               |  3 +--
 server/trace.c                 |  1 -
 6 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 016245d..bfc8d27 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -562,7 +562,6 @@ static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp,
     {
         req->handle   = wine_server_obj_handle( irp_handle );
         req->status   = irp->IoStatus.u.Status;
-        req->file_ptr = wine_server_client_ptr( file );
         if (irp->IoStatus.u.Status >= 0)
         {
             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;
     FILE_OBJECT *file;
     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 );
 
@@ -615,12 +616,9 @@ static NTSTATUS dispatch_create( const irp_params_t *params, void *in_buff, ULON
     file->Size = sizeof(*file);
     file->DeviceObject = device;
 
-    if (!(irp = IoAllocateIrp( device->StackSize, FALSE )))
-    {
-        ObDereferenceObject( file );
-        return STATUS_NO_MEMORY;
-    }
+    if (!(irp = IoAllocateIrp( device->StackSize, FALSE ))) return STATUS_NO_MEMORY;
 
+    ObReferenceObject( file );
     irpsp = IoGetNextIrpStackLocation( irp );
     irpsp->MajorFunction = IRP_MJ_CREATE;
     irpsp->FileObject = file;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 17d2654..a45d092 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -3429,7 +3429,6 @@ struct set_irp_result_request
     obj_handle_t handle;
     unsigned int status;
     data_size_t  size;
-    client_ptr_t file_ptr;
     /* VARARG(data,bytes); */
 };
 struct set_irp_result_reply
@@ -6695,6 +6694,6 @@ union generic_reply
     struct resume_process_reply resume_process_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 582
+#define SERVER_PROTOCOL_VERSION 583
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/device.c b/server/device.c
index e2364d2..6885bf0 100644
--- a/server/device.c
+++ b/server/device.c
@@ -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->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 );
         close_handle( current->process, req->handle );  /* avoid an extra round-trip for close */
         release_object( irp );
diff --git a/server/protocol.def b/server/protocol.def
index fc7c4d0..21008d7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2476,7 +2476,6 @@ enum message_type
     obj_handle_t handle;          /* handle to the irp */
     unsigned int status;          /* status of the irp */
     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 */
 @END
 
diff --git a/server/request.h b/server/request.h
index b46a1d9..07918df 100644
--- a/server/request.h
+++ b/server/request.h
@@ -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, status) == 16 );
 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) == 32 );
+C_ASSERT( sizeof(struct set_irp_result_request) == 24 );
 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, sharing) == 20 );
diff --git a/server/trace.c b/server/trace.c
index f149ed2..28bf3dd 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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, ", status=%08x", req->status );
     fprintf( stderr, ", size=%u", req->size );
-    dump_uint64( ", file_ptr=", &req->file_ptr );
     dump_varargs_bytes( ", data=", cur_size );
 }
 




More information about the wine-cvs mailing list