Commit 8a63b688 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move server initialization functions to the Unix library.

parent e6e2f232
......@@ -52,6 +52,7 @@ C_SRCS = \
time.c \
unix/debug.c \
unix/loader.c \
unix/server.c \
unix/virtual.c \
version.c \
virtual.c \
......
......@@ -4381,7 +4381,8 @@ void __wine_process_init(void)
/* setup the server connection */
server_init_process();
info_size = server_init_thread( peb, &suspend );
info_size = unix_funcs->server_init_thread( peb, &suspend, &server_cpus,
&is_wow64, &server_start_time );
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
peb->LoaderLock = &loader_section;
......
......@@ -116,7 +116,6 @@ extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
extern void server_init_process(void) DECLSPEC_HIDDEN;
extern void server_init_process_done(void) DECLSPEC_HIDDEN;
extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
extern sigset_t server_block_set DECLSPEC_HIDDEN;
......@@ -131,7 +130,6 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
extern int server_remove_fd_from_cache( HANDLE handle ) DECLSPEC_HIDDEN;
extern int server_get_unix_fd( HANDLE handle, unsigned int access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
......
......@@ -373,7 +373,7 @@ static void start_thread( struct startup_info *info )
thread_data->pthread_id = pthread_self();
signal_init_thread( teb );
server_init_thread( info->entry_point, &suspend );
unix_funcs->server_init_thread( info->entry_point, &suspend, NULL, NULL, NULL );
signal_start_thread( (LPTHREAD_START_ROUTINE)info->entry_point, info->entry_arg, suspend );
}
......@@ -451,7 +451,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
if ((status = alloc_object_attributes( &thread_attr, &objattr, &len ))) return status;
}
if (server_pipe( request_pipe ) == -1)
if (unix_funcs->server_pipe( request_pipe ) == -1)
{
RtlFreeHeap( GetProcessHeap(), 0, objattr );
return STATUS_TOO_MANY_OPENED_FILES;
......
......@@ -106,12 +106,13 @@ static char **main_envp;
static char *argv0;
static const char *bin_dir;
static const char *dll_dir;
static const char *data_dir;
static const char *build_dir;
static const char *config_dir;
static const char **dll_paths;
static SIZE_T dll_path_maxlen;
const char *data_dir = NULL;
const char *build_dir = NULL;
const char *config_dir = NULL;
static CPTABLEINFO unix_table;
static inline void *get_rva( const IMAGE_NT_HEADERS *nt, ULONG_PTR addr )
......@@ -686,7 +687,7 @@ static void exec_wineserver( char **argv )
*
* Start a new wine server.
*/
static void CDECL start_server( BOOL debug )
void start_server( BOOL debug )
{
static BOOL started; /* we only try once */
char *argv[3];
......@@ -990,12 +991,17 @@ static struct unix_funcs unix_funcs =
get_build_id,
get_host_version,
exec_wineloader,
start_server,
map_so_dll,
mmap_add_reserved_area,
mmap_remove_reserved_area,
mmap_is_in_reserved_area,
mmap_enum_reserved_areas,
server_send_fd,
receive_fd,
server_pipe,
server_init_process,
server_init_process_done,
server_init_thread,
dbg_init,
__wine_dbg_get_channel_flags,
__wine_dbg_strdup,
......
......@@ -60,4 +60,18 @@ extern void virtual_init(void) DECLSPEC_HIDDEN;
extern void CDECL dbg_init(void) DECLSPEC_HIDDEN;
extern void CDECL server_send_fd( int fd ) DECLSPEC_HIDDEN;
extern int CDECL receive_fd( obj_handle_t *handle ) DECLSPEC_HIDDEN;
extern int CDECL server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern void CDECL server_init_process(void) DECLSPEC_HIDDEN;
extern void CDECL server_init_process_done(void) DECLSPEC_HIDDEN;
extern size_t CDECL server_init_thread( void *entry_point, BOOL *suspend, unsigned int *cpus,
BOOL *wow64, timeout_t *start_time ) DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
extern const char *build_dir DECLSPEC_HIDDEN;
extern const char *config_dir DECLSPEC_HIDDEN;
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
#endif /* __NTDLL_UNIX_PRIVATE_H */
......@@ -21,10 +21,11 @@
#ifndef __NTDLL_UNIXLIB_H
#define __NTDLL_UNIXLIB_H
#include "wine/server.h"
#include "wine/debug.h"
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 7
#define NTDLL_UNIXLIB_VERSION 8
struct unix_funcs
{
......@@ -40,7 +41,6 @@ struct unix_funcs
/* loader functions */
NTSTATUS (CDECL *exec_wineloader)( char **argv, int socketfd, int is_child_64bit,
ULONGLONG res_start, ULONGLONG res_end );
void (CDECL *start_server)( BOOL debug );
/* virtual memory functions */
NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module );
......@@ -50,6 +50,15 @@ struct unix_funcs
int (CDECL *mmap_enum_reserved_areas)( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg),
void *arg, int top_down );
/* server functions */
void (CDECL *server_send_fd)( int fd );
int (CDECL *receive_fd)( obj_handle_t *handle );
int (CDECL *server_pipe)( int fd[2] );
void (CDECL *server_init_process)(void);
void (CDECL *server_init_process_done)(void);
size_t (CDECL *server_init_thread)( void *entry_point, BOOL *suspend, unsigned int *cpus,
BOOL *wow64, timeout_t *start_time );
/* debugging functions */
void (CDECL *dbg_init)(void);
unsigned char (CDECL *dbg_get_channel_flags)( struct __wine_debug_channel *channel );
......
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