server: No longer store the mapping object in the dll structure.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Alexandre Julliard 2017-09-26 15:00:04 +02:00
parent bc39a7460e
commit ab182dbf06
9 changed files with 16 additions and 53 deletions

View File

@ -1677,9 +1677,7 @@ static void load_builtin_callback( void *module, const char *filename )
SERVER_START_REQ( load_dll ) SERVER_START_REQ( load_dll )
{ {
req->mapping = 0;
req->base = wine_server_client_ptr( module ); req->base = wine_server_client_ptr( module );
req->size = nt->OptionalHeader.SizeOfImage;
req->dbg_offset = nt->FileHeader.PointerToSymbolTable; req->dbg_offset = nt->FileHeader.PointerToSymbolTable;
req->dbg_size = nt->FileHeader.NumberOfSymbols; req->dbg_size = nt->FileHeader.NumberOfSymbols;
req->name = wine_server_client_ptr( &wm->ldr.FullDllName.Buffer ); req->name = wine_server_client_ptr( &wm->ldr.FullDllName.Buffer );
@ -1895,9 +1893,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
SERVER_START_REQ( load_dll ) SERVER_START_REQ( load_dll )
{ {
req->mapping = wine_server_obj_handle( mapping );
req->base = wine_server_client_ptr( module ); req->base = wine_server_client_ptr( module );
req->size = nt->OptionalHeader.SizeOfImage;
req->dbg_offset = nt->FileHeader.PointerToSymbolTable; req->dbg_offset = nt->FileHeader.PointerToSymbolTable;
req->dbg_size = nt->FileHeader.NumberOfSymbols; req->dbg_size = nt->FileHeader.NumberOfSymbols;
req->name = wine_server_client_ptr( &wm->ldr.FullDllName.Buffer ); req->name = wine_server_client_ptr( &wm->ldr.FullDllName.Buffer );

View File

@ -991,9 +991,9 @@ struct get_dll_info_reply
{ {
struct reply_header __header; struct reply_header __header;
client_ptr_t entry_point; client_ptr_t entry_point;
data_size_t size;
data_size_t filename_len; data_size_t filename_len;
/* VARARG(filename,unicode_str); */ /* VARARG(filename,unicode_str); */
char __pad_20[4];
}; };
@ -1029,14 +1029,12 @@ struct resume_thread_reply
struct load_dll_request struct load_dll_request
{ {
struct request_header __header; struct request_header __header;
obj_handle_t mapping; data_size_t dbg_offset;
mod_handle_t base; mod_handle_t base;
client_ptr_t name; client_ptr_t name;
data_size_t size; data_size_t dbg_size;
int dbg_offset;
int dbg_size;
/* VARARG(filename,unicode_str); */ /* VARARG(filename,unicode_str); */
char __pad_44[4]; char __pad_36[4];
}; };
struct load_dll_reply struct load_dll_reply
{ {
@ -6463,6 +6461,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 540 #define SERVER_PROTOCOL_VERSION 541
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -148,7 +148,6 @@ extern struct mapping *get_mapping_obj( struct process *process, obj_handle_t ha
unsigned int access ); unsigned int access );
extern obj_handle_t open_mapping_file( struct process *process, client_ptr_t base, extern obj_handle_t open_mapping_file( struct process *process, client_ptr_t base,
unsigned int access, unsigned int sharing ); unsigned int access, unsigned int sharing );
extern struct mapping *grab_mapping_unless_removable( struct mapping *mapping );
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);

View File

@ -747,12 +747,6 @@ obj_handle_t open_mapping_file( struct process *process, client_ptr_t base,
return handle; return handle;
} }
struct mapping *grab_mapping_unless_removable( struct mapping *mapping )
{
if (is_fd_removable( mapping->fd )) return NULL;
return (struct mapping *)grab_object( mapping );
}
static void mapping_dump( struct object *obj, int verbose ) static void mapping_dump( struct object *obj, int verbose )
{ {
struct mapping *mapping = (struct mapping *)obj; struct mapping *mapping = (struct mapping *)obj;

View File

@ -735,9 +735,8 @@ static inline struct process_dll *find_process_dll( struct process *process, mod
} }
/* add a dll to a process list */ /* add a dll to a process list */
static struct process_dll *process_load_dll( struct process *process, struct mapping *mapping, static struct process_dll *process_load_dll( struct process *process, mod_handle_t base,
mod_handle_t base, const WCHAR *filename, const WCHAR *filename, data_size_t name_len )
data_size_t name_len )
{ {
struct process_dll *dll; struct process_dll *dll;
@ -750,7 +749,6 @@ static struct process_dll *process_load_dll( struct process *process, struct map
if ((dll = mem_alloc( sizeof(*dll) ))) if ((dll = mem_alloc( sizeof(*dll) )))
{ {
dll->mapping = NULL;
dll->base = base; dll->base = base;
dll->filename = NULL; dll->filename = NULL;
dll->namelen = name_len; dll->namelen = name_len;
@ -759,7 +757,6 @@ static struct process_dll *process_load_dll( struct process *process, struct map
free( dll ); free( dll );
return NULL; return NULL;
} }
if (mapping) dll->mapping = grab_mapping_unless_removable( mapping );
list_add_tail( &process->dlls, &dll->entry ); list_add_tail( &process->dlls, &dll->entry );
} }
return dll; return dll;
@ -772,7 +769,6 @@ static void process_unload_dll( struct process *process, mod_handle_t base )
if (dll && (&dll->entry != list_head( &process->dlls ))) /* main exe can't be unloaded */ if (dll && (&dll->entry != list_head( &process->dlls ))) /* main exe can't be unloaded */
{ {
if (dll->mapping) release_object( dll->mapping );
free( dll->filename ); free( dll->filename );
list_remove( &dll->entry ); list_remove( &dll->entry );
free( dll ); free( dll );
@ -866,7 +862,6 @@ static void process_killed( struct process *process )
while ((ptr = list_head( &process->dlls ))) while ((ptr = list_head( &process->dlls )))
{ {
struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry ); struct process_dll *dll = LIST_ENTRY( ptr, struct process_dll, entry );
if (dll->mapping) release_object( dll->mapping );
free( dll->filename ); free( dll->filename );
list_remove( &dll->entry ); list_remove( &dll->entry );
free( dll ); free( dll );
@ -1491,15 +1486,9 @@ DECL_HANDLER(write_process_memory)
DECL_HANDLER(load_dll) DECL_HANDLER(load_dll)
{ {
struct process_dll *dll; struct process_dll *dll;
struct mapping *mapping = NULL;
if (req->mapping && !(mapping = get_mapping_obj( current->process, req->mapping, SECTION_QUERY ))) if ((dll = process_load_dll( current->process, req->base, get_req_data(), get_req_data_size() )))
return;
if ((dll = process_load_dll( current->process, mapping, req->base,
get_req_data(), get_req_data_size() )))
{ {
dll->size = req->size;
dll->dbg_offset = req->dbg_offset; dll->dbg_offset = req->dbg_offset;
dll->dbg_size = req->dbg_size; dll->dbg_size = req->dbg_size;
dll->name = req->name; dll->name = req->name;
@ -1507,7 +1496,6 @@ DECL_HANDLER(load_dll)
if (is_process_init_done( current->process )) if (is_process_init_done( current->process ))
generate_debug_event( current, LOAD_DLL_DEBUG_EVENT, dll ); generate_debug_event( current, LOAD_DLL_DEBUG_EVENT, dll );
} }
if (mapping) release_object( mapping );
} }
/* notify the server that a dll is being unloaded */ /* notify the server that a dll is being unloaded */
@ -1533,7 +1521,6 @@ DECL_HANDLER(get_dll_info)
if (dll) if (dll)
{ {
reply->size = dll->size;
reply->entry_point = 0; /* FIXME */ reply->entry_point = 0; /* FIXME */
reply->filename_len = dll->namelen; reply->filename_len = dll->namelen;
if (dll->filename) if (dll->filename)

View File

@ -36,10 +36,8 @@ enum startup_state { STARTUP_IN_PROGRESS, STARTUP_DONE, STARTUP_ABORTED };
struct process_dll struct process_dll
{ {
struct list entry; /* entry in per-process dll list */ struct list entry; /* entry in per-process dll list */
struct mapping *mapping; /* dll file */
mod_handle_t base; /* dll base address (in process addr space) */ mod_handle_t base; /* dll base address (in process addr space) */
client_ptr_t name; /* ptr to ptr to name (in process addr space) */ client_ptr_t name; /* ptr to ptr to name (in process addr space) */
data_size_t size; /* dll size */
int dbg_offset; /* debug info offset */ int dbg_offset; /* debug info offset */
int dbg_size; /* debug info size */ int dbg_size; /* debug info size */
data_size_t namelen; /* length of dll file name */ data_size_t namelen; /* length of dll file name */

View File

@ -917,7 +917,6 @@ struct rawinput_device
mod_handle_t base_address; /* base address of module */ mod_handle_t base_address; /* base address of module */
@REPLY @REPLY
client_ptr_t entry_point; client_ptr_t entry_point;
data_size_t size; /* module size */
data_size_t filename_len; /* buffer len in bytes required to store filename */ data_size_t filename_len; /* buffer len in bytes required to store filename */
VARARG(filename,unicode_str); /* file name of module */ VARARG(filename,unicode_str); /* file name of module */
@END @END
@ -941,12 +940,10 @@ struct rawinput_device
/* Notify the server that a dll has been loaded */ /* Notify the server that a dll has been loaded */
@REQ(load_dll) @REQ(load_dll)
obj_handle_t mapping; /* file mapping handle */ data_size_t dbg_offset; /* debug info offset */
mod_handle_t base; /* base address */ mod_handle_t base; /* base address */
client_ptr_t name; /* ptr to ptr to name (in process addr space) */ client_ptr_t name; /* ptr to ptr to name (in process addr space) */
data_size_t size; /* dll size */ data_size_t dbg_size; /* debug info size */
int dbg_offset; /* debug info offset */
int dbg_size; /* debug info size */
VARARG(filename,unicode_str); /* file name of dll */ VARARG(filename,unicode_str); /* file name of dll */
@END @END

View File

@ -848,8 +848,7 @@ C_ASSERT( FIELD_OFFSET(struct get_dll_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_dll_info_request, base_address) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_dll_info_request, base_address) == 16 );
C_ASSERT( sizeof(struct get_dll_info_request) == 24 ); C_ASSERT( sizeof(struct get_dll_info_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, entry_point) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, entry_point) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, size) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, filename_len) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, filename_len) == 20 );
C_ASSERT( sizeof(struct get_dll_info_reply) == 24 ); C_ASSERT( sizeof(struct get_dll_info_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct suspend_thread_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct suspend_thread_request, handle) == 12 );
C_ASSERT( sizeof(struct suspend_thread_request) == 16 ); C_ASSERT( sizeof(struct suspend_thread_request) == 16 );
@ -859,13 +858,11 @@ C_ASSERT( FIELD_OFFSET(struct resume_thread_request, handle) == 12 );
C_ASSERT( sizeof(struct resume_thread_request) == 16 ); C_ASSERT( sizeof(struct resume_thread_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct resume_thread_reply, count) == 8 ); C_ASSERT( FIELD_OFFSET(struct resume_thread_reply, count) == 8 );
C_ASSERT( sizeof(struct resume_thread_reply) == 16 ); C_ASSERT( sizeof(struct resume_thread_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, mapping) == 12 ); C_ASSERT( FIELD_OFFSET(struct load_dll_request, dbg_offset) == 12 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, base) == 16 ); C_ASSERT( FIELD_OFFSET(struct load_dll_request, base) == 16 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, name) == 24 ); C_ASSERT( FIELD_OFFSET(struct load_dll_request, name) == 24 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, size) == 32 ); C_ASSERT( FIELD_OFFSET(struct load_dll_request, dbg_size) == 32 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, dbg_offset) == 36 ); C_ASSERT( sizeof(struct load_dll_request) == 40 );
C_ASSERT( FIELD_OFFSET(struct load_dll_request, dbg_size) == 40 );
C_ASSERT( sizeof(struct load_dll_request) == 48 );
C_ASSERT( FIELD_OFFSET(struct unload_dll_request, base) == 16 ); C_ASSERT( FIELD_OFFSET(struct unload_dll_request, base) == 16 );
C_ASSERT( sizeof(struct unload_dll_request) == 24 ); C_ASSERT( sizeof(struct unload_dll_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct queue_apc_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct queue_apc_request, handle) == 12 );

View File

@ -1422,7 +1422,6 @@ static void dump_get_dll_info_request( const struct get_dll_info_request *req )
static void dump_get_dll_info_reply( const struct get_dll_info_reply *req ) static void dump_get_dll_info_reply( const struct get_dll_info_reply *req )
{ {
dump_uint64( " entry_point=", &req->entry_point ); dump_uint64( " entry_point=", &req->entry_point );
fprintf( stderr, ", size=%u", req->size );
fprintf( stderr, ", filename_len=%u", req->filename_len ); fprintf( stderr, ", filename_len=%u", req->filename_len );
dump_varargs_unicode_str( ", filename=", cur_size ); dump_varargs_unicode_str( ", filename=", cur_size );
} }
@ -1449,12 +1448,10 @@ static void dump_resume_thread_reply( const struct resume_thread_reply *req )
static void dump_load_dll_request( const struct load_dll_request *req ) static void dump_load_dll_request( const struct load_dll_request *req )
{ {
fprintf( stderr, " mapping=%04x", req->mapping ); fprintf( stderr, " dbg_offset=%u", req->dbg_offset );
dump_uint64( ", base=", &req->base ); dump_uint64( ", base=", &req->base );
dump_uint64( ", name=", &req->name ); dump_uint64( ", name=", &req->name );
fprintf( stderr, ", size=%u", req->size ); fprintf( stderr, ", dbg_size=%u", req->dbg_size );
fprintf( stderr, ", dbg_offset=%d", req->dbg_offset );
fprintf( stderr, ", dbg_size=%d", req->dbg_size );
dump_varargs_unicode_str( ", filename=", cur_size ); dump_varargs_unicode_str( ", filename=", cur_size );
} }