Commit c583953b authored by Alexandre Julliard's avatar Alexandre Julliard

server: Use the correct process when looking for a mapped dll.

parent 541e7ba7
...@@ -147,6 +147,7 @@ static int fill_create_process_event( struct debug_event *event, const void *arg ...@@ -147,6 +147,7 @@ static int fill_create_process_event( struct debug_event *event, const void *arg
struct process *process = thread->process; struct process *process = thread->process;
struct process_dll *exe_module = get_process_exe_module( process ); struct process_dll *exe_module = get_process_exe_module( process );
const client_ptr_t *entry = arg; const client_ptr_t *entry = arg;
struct file *file;
obj_handle_t handle; obj_handle_t handle;
/* documented: PROCESS_VM_READ | PROCESS_VM_WRITE */ /* documented: PROCESS_VM_READ | PROCESS_VM_WRITE */
...@@ -170,8 +171,12 @@ static int fill_create_process_event( struct debug_event *event, const void *arg ...@@ -170,8 +171,12 @@ static int fill_create_process_event( struct debug_event *event, const void *arg
event->data.create_process.unicode = 1; event->data.create_process.unicode = 1;
/* the doc says write access too, but this doesn't seem a good idea */ /* the doc says write access too, but this doesn't seem a good idea */
event->data.create_process.file = open_mapping_file( debugger, exe_module->base, GENERIC_READ, if ((file = get_mapping_file( process, exe_module->base, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE ); FILE_SHARE_READ | FILE_SHARE_WRITE )))
{
event->data.create_process.file = alloc_handle( debugger, file, GENERIC_READ, 0 );
release_object( file );
}
return 1; return 1;
} }
...@@ -191,8 +196,10 @@ static int fill_exit_process_event( struct debug_event *event, const void *arg ) ...@@ -191,8 +196,10 @@ static int fill_exit_process_event( struct debug_event *event, const void *arg )
static int fill_load_dll_event( struct debug_event *event, const void *arg ) static int fill_load_dll_event( struct debug_event *event, const void *arg )
{ {
struct process *process = event->sender->process;
struct process *debugger = event->debugger->process; struct process *debugger = event->debugger->process;
const struct process_dll *dll = arg; const struct process_dll *dll = arg;
struct file *file;
event->data.load_dll.handle = 0; event->data.load_dll.handle = 0;
event->data.load_dll.base = dll->base; event->data.load_dll.base = dll->base;
...@@ -200,8 +207,11 @@ static int fill_load_dll_event( struct debug_event *event, const void *arg ) ...@@ -200,8 +207,11 @@ static int fill_load_dll_event( struct debug_event *event, const void *arg )
event->data.load_dll.dbg_size = dll->dbg_size; event->data.load_dll.dbg_size = dll->dbg_size;
event->data.load_dll.name = dll->name; event->data.load_dll.name = dll->name;
event->data.load_dll.unicode = 1; event->data.load_dll.unicode = 1;
event->data.load_dll.handle = open_mapping_file( debugger, dll->base, GENERIC_READ, if ((file = get_mapping_file( process, dll->base, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE )))
FILE_SHARE_READ | FILE_SHARE_WRITE ); {
event->data.load_dll.handle = alloc_handle( debugger, file, GENERIC_READ, 0 );
release_object( file );
}
return 1; return 1;
} }
......
...@@ -149,8 +149,8 @@ extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ...@@ -149,8 +149,8 @@ extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner
extern struct mapping *get_mapping_obj( struct process *process, obj_handle_t handle, extern struct mapping *get_mapping_obj( struct process *process, obj_handle_t handle,
unsigned int access ); unsigned int access );
extern obj_handle_t open_mapping_file( struct process *process, client_ptr_t base, extern struct file *get_mapping_file( struct process *process, client_ptr_t base,
unsigned int access, unsigned int sharing ); unsigned int access, unsigned int sharing );
extern void free_mapped_views( struct process *process ); extern void free_mapped_views( struct process *process );
extern int get_page_size(void); extern int get_page_size(void);
......
...@@ -733,19 +733,14 @@ struct mapping *get_mapping_obj( struct process *process, obj_handle_t handle, u ...@@ -733,19 +733,14 @@ struct mapping *get_mapping_obj( struct process *process, obj_handle_t handle, u
return (struct mapping *)get_handle_obj( process, handle, access, &mapping_ops ); return (struct mapping *)get_handle_obj( process, handle, access, &mapping_ops );
} }
/* open a new file handle to the file backing the mapping */ /* open a new file for the file descriptor backing the mapping */
obj_handle_t open_mapping_file( struct process *process, client_ptr_t base, struct file *get_mapping_file( struct process *process, client_ptr_t base,
unsigned int access, unsigned int sharing ) unsigned int access, unsigned int sharing )
{ {
obj_handle_t handle;
struct memory_view *view = find_mapped_view( process, base ); struct memory_view *view = find_mapped_view( process, base );
struct file *file;
if (!view || !view->fd) return 0; if (!view || !view->fd) return NULL;
if (!(file = create_file_for_fd_obj( view->fd, access, sharing ))) return 0; return create_file_for_fd_obj( view->fd, access, sharing );
handle = alloc_handle( process, file, access, 0 );
release_object( file );
return handle;
} }
static void mapping_dump( struct object *obj, int verbose ) static void mapping_dump( struct object *obj, int verbose )
......
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