server: Store a filename for memory views of .so dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d129a89d22
commit
9ce326eea0
|
@ -981,7 +981,8 @@ static void fill_builtin_image_info( void *module, pe_image_info_t *info )
|
|||
/***********************************************************************
|
||||
* dlopen_dll
|
||||
*/
|
||||
static NTSTATUS dlopen_dll( const char *so_name, void **ret_module, pe_image_info_t *image_info )
|
||||
static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name,
|
||||
void **ret_module, pe_image_info_t *image_info )
|
||||
{
|
||||
struct builtin_module *builtin;
|
||||
void *module, *handle;
|
||||
|
@ -1028,7 +1029,7 @@ static NTSTATUS dlopen_dll( const char *so_name, void **ret_module, pe_image_inf
|
|||
dlclose( handle );
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
virtual_create_builtin_view( module, image_info );
|
||||
virtual_create_builtin_view( module, nt_name, image_info );
|
||||
*ret_module = module;
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
|
@ -1107,7 +1108,7 @@ static NTSTATUS CDECL load_so_dll( UNICODE_STRING *nt_name, void **module )
|
|||
len = nt_name->Length / sizeof(WCHAR);
|
||||
if (len > 3 && !wcsicmp( nt_name->Buffer + len - 3, soW )) nt_name->Length -= 3 * sizeof(WCHAR);
|
||||
|
||||
status = dlopen_dll( unix_name, module, &info );
|
||||
status = dlopen_dll( unix_name, nt_name, module, &info );
|
||||
free( unix_name );
|
||||
return status;
|
||||
}
|
||||
|
@ -1261,7 +1262,7 @@ static NTSTATUS open_builtin_file( char *name, OBJECT_ATTRIBUTES *attr, HANDLE *
|
|||
{
|
||||
pe_image_info_t info;
|
||||
|
||||
if (!dlopen_dll( name, module, &info ))
|
||||
if (!dlopen_dll( name, attr->ObjectName, module, &info ))
|
||||
{
|
||||
virtual_fill_image_information( &info, image_info );
|
||||
status = STATUS_SUCCESS;
|
||||
|
|
|
@ -179,7 +179,8 @@ extern void *anon_mmap_alloc( size_t size, int prot ) DECLSPEC_HIDDEN;
|
|||
extern void virtual_init(void) DECLSPEC_HIDDEN;
|
||||
extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
|
||||
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_name,
|
||||
pe_image_info_t *info ) DECLSPEC_HIDDEN;
|
||||
extern TEB *virtual_alloc_first_teb(void) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN;
|
||||
extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -2483,7 +2483,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
|
|||
/***********************************************************************
|
||||
* virtual_create_builtin_view
|
||||
*/
|
||||
NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info )
|
||||
NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_name, pe_image_info_t *info )
|
||||
{
|
||||
NTSTATUS status;
|
||||
sigset_t sigset;
|
||||
|
@ -2500,7 +2500,7 @@ NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info )
|
|||
VPROT_COMMITTED | VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC );
|
||||
if (!status)
|
||||
{
|
||||
TRACE( "created %p-%p\n", base, (char *)base + size );
|
||||
TRACE( "created %p-%p for %s\n", base, (char *)base + size, debugstr_us(nt_name) );
|
||||
|
||||
/* The PE header is always read-only, no write, no execute. */
|
||||
set_page_vprot( base, page_size, VPROT_COMMITTED | VPROT_READ );
|
||||
|
@ -2521,6 +2521,7 @@ NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info )
|
|||
req->base = wine_server_client_ptr( view->base );
|
||||
req->size = size;
|
||||
wine_server_add_data( req, info, sizeof(*info) );
|
||||
wine_server_add_data( req, nt_name->Buffer, nt_name->Length );
|
||||
status = wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
|
|
@ -1923,6 +1923,7 @@ struct map_view_request
|
|||
mem_size_t size;
|
||||
file_pos_t start;
|
||||
/* VARARG(image,pe_image_info); */
|
||||
/* VARARG(name,unicode_str); */
|
||||
};
|
||||
struct map_view_reply
|
||||
{
|
||||
|
@ -6265,7 +6266,7 @@ union generic_reply
|
|||
|
||||
/* ### protocol_version begin ### */
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 674
|
||||
#define SERVER_PROTOCOL_VERSION 675
|
||||
|
||||
/* ### protocol_version end ### */
|
||||
|
||||
|
|
|
@ -134,6 +134,8 @@ struct memory_view
|
|||
client_ptr_t base; /* view base address (in process addr space) */
|
||||
mem_size_t size; /* view size */
|
||||
file_pos_t start; /* start offset in mapping */
|
||||
data_size_t namelen;
|
||||
WCHAR name[1]; /* filename for .so dll image views */
|
||||
};
|
||||
|
||||
|
||||
|
@ -1000,6 +1002,12 @@ const pe_image_info_t *get_view_image_info( const struct memory_view *view, clie
|
|||
/* get the file name for a mapped view */
|
||||
int get_view_nt_name( const struct memory_view *view, struct unicode_str *name )
|
||||
{
|
||||
if (view->namelen) /* .so builtin */
|
||||
{
|
||||
name->str = view->name;
|
||||
name->len = view->namelen;
|
||||
return 1;
|
||||
}
|
||||
if (!view->fd) return 0;
|
||||
get_nt_name( view->fd, name );
|
||||
return 1;
|
||||
|
@ -1157,6 +1165,7 @@ DECL_HANDLER(map_view)
|
|||
{
|
||||
struct mapping *mapping = NULL;
|
||||
struct memory_view *view;
|
||||
data_size_t namelen = 0;
|
||||
|
||||
if (!req->size || (req->base & page_mask) || req->base + req->size < req->base) /* overflow */
|
||||
{
|
||||
|
@ -1175,13 +1184,16 @@ DECL_HANDLER(map_view)
|
|||
|
||||
if (!req->mapping) /* image mapping for a .so dll */
|
||||
{
|
||||
if (!(view = mem_alloc( sizeof(*view) ))) return;
|
||||
if (get_req_data_size() > sizeof(view->image)) namelen = get_req_data_size() - sizeof(view->image);
|
||||
if (!(view = mem_alloc( offsetof( struct memory_view, name[namelen] )))) return;
|
||||
memset( view, 0, sizeof(*view) );
|
||||
view->base = req->base;
|
||||
view->size = req->size;
|
||||
view->start = req->start;
|
||||
view->flags = SEC_IMAGE;
|
||||
view->base = req->base;
|
||||
view->size = req->size;
|
||||
view->start = req->start;
|
||||
view->flags = SEC_IMAGE;
|
||||
view->namelen = namelen;
|
||||
memcpy( &view->image, get_req_data(), min( sizeof(view->image), get_req_data_size() ));
|
||||
memcpy( view->name, (pe_image_info_t *)get_req_data() + 1, namelen );
|
||||
add_process_view( current, view );
|
||||
return;
|
||||
}
|
||||
|
@ -1204,12 +1216,13 @@ DECL_HANDLER(map_view)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if ((view = mem_alloc( sizeof(*view) )))
|
||||
if ((view = mem_alloc( offsetof( struct memory_view, name[namelen] ))))
|
||||
{
|
||||
view->base = req->base;
|
||||
view->size = req->size;
|
||||
view->start = req->start;
|
||||
view->flags = mapping->flags;
|
||||
view->namelen = namelen;
|
||||
view->fd = !is_fd_removable( mapping->fd ) ? (struct fd *)grab_object( mapping->fd ) : NULL;
|
||||
view->committed = mapping->committed ? (struct ranges *)grab_object( mapping->committed ) : NULL;
|
||||
view->shared = mapping->shared ? (struct shared_map *)grab_object( mapping->shared ) : NULL;
|
||||
|
|
|
@ -1540,6 +1540,7 @@ enum server_fd_type
|
|||
mem_size_t size; /* view size */
|
||||
file_pos_t start; /* start offset in mapping */
|
||||
VARARG(image,pe_image_info);/* image info for .so builtins */
|
||||
VARARG(name,unicode_str); /* image filename for .so builtins */
|
||||
@END
|
||||
|
||||
|
||||
|
|
|
@ -1308,7 +1308,7 @@ static void dump_varargs_pe_image_info( const char *prefix, data_size_t size )
|
|||
info.header_size, info.file_size, info.checksum );
|
||||
dump_client_cpu( ",cpu=", &info.cpu );
|
||||
fputc( '}', stderr );
|
||||
remove_data( size );
|
||||
remove_data( min( size, sizeof(info) ));
|
||||
}
|
||||
|
||||
static void dump_varargs_rawinput_devices(const char *prefix, data_size_t size )
|
||||
|
@ -2158,6 +2158,7 @@ static void dump_map_view_request( const struct map_view_request *req )
|
|||
dump_uint64( ", size=", &req->size );
|
||||
dump_uint64( ", start=", &req->start );
|
||||
dump_varargs_pe_image_info( ", image=", cur_size );
|
||||
dump_varargs_unicode_str( ", name=", cur_size );
|
||||
}
|
||||
|
||||
static void dump_unmap_view_request( const struct unmap_view_request *req )
|
||||
|
|
Loading…
Reference in New Issue