Commit 31538a79 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move the loading of .so dlls to the Unix library.

parent 99649d78
......@@ -74,10 +74,6 @@ extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
extern int __wine_main_argc;
extern char **__wine_main_argv;
extern WCHAR **__wine_main_wargv;
/* server support */
extern const char *build_dir DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
......@@ -107,9 +103,6 @@ extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
extern void init_directories(void) DECLSPEC_HIDDEN;
/* virtual memory */
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
/* locale */
......
......@@ -67,9 +67,9 @@ extern WCHAR **__wine_main_wargv;
USHORT *uctable = NULL, *lctable = NULL;
static int main_argc;
static char **main_argv;
static char **main_envp;
int main_argc = 0;
char **main_argv = NULL;
char **main_envp = NULL;
static WCHAR **main_wargv;
static CPTABLEINFO unix_table;
......@@ -803,19 +803,6 @@ void init_environment( int argc, char *argv[], char *envp[] )
/*************************************************************************
* get_main_args
*
* Return the initial arguments.
*/
void CDECL get_main_args( int *argc, char **argv[], char **envp[] )
{
*argc = main_argc;
*argv = main_argv;
*envp = main_envp;
}
/*************************************************************************
* get_initial_environment
*
* Return the initial environment.
......
......@@ -104,6 +104,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ
server_init_process();
info_size = server_init_thread( teb->Peb, suspend );
virtual_map_user_shared_data();
virtual_create_builtin_view( ntdll_module );
init_files();
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
......
......@@ -95,7 +95,6 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
int top_down ) DECLSPEC_HIDDEN;
extern void CDECL get_main_args( int *argc, char **argv[], char **envp[] ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
extern void CDECL get_initial_directory( UNICODE_STRING *dir ) DECLSPEC_HIDDEN;
extern void CDECL get_unix_codepage( CPTABLEINFO *table ) DECLSPEC_HIDDEN;
......@@ -104,7 +103,6 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
extern void CDECL virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL virtual_create_builtin_view( void *module ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN;
extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
......@@ -132,8 +130,12 @@ extern void CDECL set_show_dot_files( BOOL enable ) DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
extern const char *build_dir DECLSPEC_HIDDEN;
extern const char *config_dir DECLSPEC_HIDDEN;
extern HMODULE ntdll_module DECLSPEC_HIDDEN;
extern USHORT *uctable DECLSPEC_HIDDEN;
extern USHORT *lctable DECLSPEC_HIDDEN;
extern int main_argc DECLSPEC_HIDDEN;
extern char **main_argv DECLSPEC_HIDDEN;
extern char **main_envp DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN;
extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern HANDLE keyed_event DECLSPEC_HIDDEN;
......@@ -181,6 +183,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o
extern void virtual_init(void) DECLSPEC_HIDDEN;
extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_create_builtin_view( void *module ) 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;
......
......@@ -2498,11 +2498,12 @@ void CDECL virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
/***********************************************************************
* virtual_create_builtin_view
*/
NTSTATUS CDECL virtual_create_builtin_view( void *module )
NTSTATUS virtual_create_builtin_view( void *module )
{
NTSTATUS status;
sigset_t sigset;
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( module );
IMAGE_DOS_HEADER *dos = module;
IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)((char *)dos + dos->e_lfanew);
SIZE_T size = nt->OptionalHeader.SizeOfImage;
IMAGE_SECTION_HEADER *sec;
struct file_view *view;
......@@ -2511,7 +2512,7 @@ NTSTATUS CDECL virtual_create_builtin_view( void *module )
size = ROUND_SIZE( module, size );
base = ROUND_ADDR( module, page_mask );
server_enter_uninterrupted_section( &csVirtual, &sigset );
if (use_locks) server_enter_uninterrupted_section( &csVirtual, &sigset );
status = create_view( &view, base, size, SEC_IMAGE | SEC_FILE | VPROT_SYSTEM |
VPROT_COMMITTED | VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC );
if (!status)
......@@ -2533,7 +2534,7 @@ NTSTATUS CDECL virtual_create_builtin_view( void *module )
}
VIRTUAL_DEBUG_DUMP_VIEW( view );
}
server_leave_uninterrupted_section( &csVirtual, &sigset );
if (use_locks) server_leave_uninterrupted_section( &csVirtual, &sigset );
return status;
}
......
......@@ -28,7 +28,7 @@ struct ldt_copy;
struct msghdr;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 57
#define NTDLL_UNIXLIB_VERSION 58
struct unix_funcs
{
......@@ -277,7 +277,6 @@ struct unix_funcs
NTSTATUS (CDECL *fast_RtlWakeConditionVariable)( RTL_CONDITION_VARIABLE *variable, int count );
/* environment functions */
void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] );
NTSTATUS (CDECL *get_initial_environment)( WCHAR **wargv[], WCHAR *env, SIZE_T *size );
void (CDECL *get_initial_directory)( UNICODE_STRING *dir );
void (CDECL *get_paths)( const char **builddir, const char **datadir, const char **configdir );
......@@ -289,12 +288,10 @@ struct unix_funcs
void (CDECL *get_host_version)( const char **sysname, const char **release );
/* virtual memory functions */
NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module );
NTSTATUS (CDECL *virtual_map_section)( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
ULONG protect, pe_image_info_t *image_info );
void (CDECL *virtual_get_system_info)( SYSTEM_BASIC_INFORMATION *info );
NTSTATUS (CDECL *virtual_create_builtin_view)( void *module );
NTSTATUS (CDECL *virtual_alloc_thread_stack)( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size );
ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags );
void (CDECL *virtual_release_address_space)(void);
......@@ -323,6 +320,12 @@ struct unix_funcs
NTSTATUS (CDECL *unix_to_nt_file_name)( const ANSI_STRING *name, UNICODE_STRING *nt );
void (CDECL *set_show_dot_files)( BOOL enable );
/* loader functions */
NTSTATUS (CDECL *load_so_dll)( UNICODE_STRING *nt_name, void **module );
NTSTATUS (CDECL *load_builtin_dll)( const char *so_name, void **module );
NTSTATUS (CDECL *unload_builtin_dll)( void *module );
void (CDECL *init_builtin_dll)( void *module );
/* debugging functions */
unsigned char (CDECL *dbg_get_channel_flags)( struct __wine_debug_channel *channel );
const char * (CDECL *dbg_strdup)( const char *str );
......
......@@ -202,39 +202,6 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
/******************************************************************************
* virtual_fill_image_information
*
* Helper for NtQuerySection.
*/
void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info )
{
info->TransferAddress = wine_server_get_ptr( pe_info->entry_point );
info->ZeroBits = pe_info->zerobits;
info->MaximumStackSize = pe_info->stack_size;
info->CommittedStackSize = pe_info->stack_commit;
info->SubSystemType = pe_info->subsystem;
info->SubsystemVersionLow = pe_info->subsystem_low;
info->SubsystemVersionHigh = pe_info->subsystem_high;
info->GpValue = pe_info->gp;
info->ImageCharacteristics = pe_info->image_charact;
info->DllCharacteristics = pe_info->dll_charact;
info->Machine = pe_info->machine;
info->ImageContainsCode = pe_info->contains_code;
info->u.ImageFlags = pe_info->image_flags & ~(IMAGE_FLAGS_WineBuiltin|IMAGE_FLAGS_WineFakeDll);
info->LoaderFlags = pe_info->loader_flags;
info->ImageFileSize = pe_info->file_size;
info->CheckSum = pe_info->checksum;
#ifndef _WIN64 /* don't return 64-bit values to 32-bit processes */
if (pe_info->machine == IMAGE_FILE_MACHINE_AMD64 || pe_info->machine == IMAGE_FILE_MACHINE_ARM64)
{
info->TransferAddress = (void *)0x81231234; /* sic */
info->MaximumStackSize = 0x100000;
info->CommittedStackSize = 0x10000;
}
#endif
}
/******************************************************************************
* NtQuerySection (NTDLL.@)
* ZwQuerySection (NTDLL.@)
*/
......
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