ntdll: Get rid of the server_init_process_done() Unix library callback.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d9625e5a01
commit
1581fb619b
|
@ -58,6 +58,8 @@ WINE_DECLARE_DEBUG_CHANNEL(imports);
|
|||
typedef DWORD (CALLBACK *DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
|
||||
typedef void (CALLBACK *LDRENUMPROC)(LDR_DATA_TABLE_ENTRY *, void *, BOOLEAN *);
|
||||
|
||||
static void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void *);
|
||||
|
||||
const struct unix_funcs *unix_funcs = NULL;
|
||||
|
||||
/* windows directory */
|
||||
|
@ -3409,15 +3411,30 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
|
|||
* Attach to all the loaded dlls.
|
||||
* If this is the first time, perform the full process initialization.
|
||||
*/
|
||||
void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknown3, ULONG_PTR unknown4 )
|
||||
void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR unknown3, ULONG_PTR unknown4 )
|
||||
{
|
||||
static int attach_done;
|
||||
int i;
|
||||
NTSTATUS status;
|
||||
ULONG_PTR cookie;
|
||||
WINE_MODREF *wm;
|
||||
void **entry;
|
||||
LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
|
||||
|
||||
#ifdef __i386__
|
||||
entry = (void **)&context->Eax;
|
||||
if (!context->Eip) context->Eip = (DWORD_PTR)kernel32_start_process;
|
||||
#elif defined(__x86_64__)
|
||||
entry = (void **)&context->Rcx;
|
||||
if (!context->Rip) context->Rip = (DWORD_PTR)kernel32_start_process;
|
||||
#elif defined(__arm__)
|
||||
entry = (void **)&context->R0;
|
||||
if (!context->Pc) context->Pc = (DWORD_PTR)kernel32_start_process;
|
||||
#elif defined(__aarch64__)
|
||||
entry = (void **)&context->X0;
|
||||
if (!context->Pc) context->Pc = (DWORD_PTR)kernel32_start_process;
|
||||
#endif
|
||||
|
||||
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
|
||||
|
||||
RtlEnterCriticalSection( &loader_section );
|
||||
|
@ -3891,9 +3908,9 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_process_init
|
||||
* process_init
|
||||
*/
|
||||
void __wine_process_init(void)
|
||||
static void process_init(void)
|
||||
{
|
||||
static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
|
||||
's','y','s','t','e','m','3','2','\\',
|
||||
|
@ -3901,7 +3918,6 @@ void __wine_process_init(void)
|
|||
static const WCHAR kernel32W[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
|
||||
's','y','s','t','e','m','3','2','\\',
|
||||
'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
||||
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
|
||||
RTL_USER_PROCESS_PARAMETERS *params;
|
||||
WINE_MODREF *wm;
|
||||
NTSTATUS status;
|
||||
|
@ -3951,7 +3967,7 @@ void __wine_process_init(void)
|
|||
|
||||
/* setup the load callback and create ntdll modref */
|
||||
RtlInitUnicodeString( &nt_name, ntdllW );
|
||||
NtQueryVirtualMemory( GetCurrentProcess(), __wine_process_init, MemoryBasicInformation,
|
||||
NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
|
||||
&meminfo, sizeof(meminfo), NULL );
|
||||
status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
|
||||
assert( !status );
|
||||
|
@ -4034,8 +4050,6 @@ void __wine_process_init(void)
|
|||
teb->Tib.StackBase = stack.StackBase;
|
||||
teb->Tib.StackLimit = stack.StackLimit;
|
||||
teb->DeallocationStack = stack.DeallocationStack;
|
||||
|
||||
unix_funcs->server_init_process_done( kernel32_start_process );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -4045,5 +4059,5 @@ void CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs )
|
|||
{
|
||||
assert( version == NTDLL_UNIXLIB_VERSION );
|
||||
unix_funcs = funcs;
|
||||
__wine_process_init();
|
||||
process_init();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,6 @@ static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiB
|
|||
#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
|
||||
|
||||
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
|
||||
void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
|
||||
|
|
|
@ -1349,7 +1349,6 @@ static struct unix_funcs unix_funcs =
|
|||
virtual_map_section,
|
||||
virtual_release_address_space,
|
||||
exec_process,
|
||||
server_init_process_done,
|
||||
set_show_dot_files,
|
||||
load_so_dll,
|
||||
load_builtin_dll,
|
||||
|
@ -1382,6 +1381,7 @@ static void start_main_thread(void)
|
|||
init_files();
|
||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||
p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
|
||||
server_init_process_done();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1453,7 +1453,7 @@ void server_init_process(void)
|
|||
/***********************************************************************
|
||||
* server_init_process_done
|
||||
*/
|
||||
void CDECL server_init_process_done( void *relay )
|
||||
void server_init_process_done(void)
|
||||
{
|
||||
PEB *peb = NtCurrentTeb()->Peb;
|
||||
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
|
||||
|
@ -1486,7 +1486,7 @@ void CDECL server_init_process_done( void *relay )
|
|||
SERVER_END_REQ;
|
||||
|
||||
assert( !status );
|
||||
signal_start_thread( entry, peb, suspend, relay, pLdrInitializeThunk, NtCurrentTeb() );
|
||||
signal_start_thread( entry, peb, suspend, NULL, pLdrInitializeThunk, NtCurrentTeb() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1036,7 +1036,6 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
|
|||
"sub sp, r4, #0x1000\n\t"
|
||||
/* attach dlls */
|
||||
"bl " __ASM_NAME("get_initial_context") "\n\t"
|
||||
"add r1, r0, #4\n\t" /* &context->R0 */
|
||||
"mov lr, #0\n\t"
|
||||
"bx r5" )
|
||||
|
||||
|
|
|
@ -1136,7 +1136,6 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
|
|||
"sub sp, x5, #0x1000\n\t"
|
||||
/* attach dlls */
|
||||
"bl " __ASM_NAME("get_initial_context") "\n\t"
|
||||
"add x1, x0, #4\n\t" /* &context->X0 */
|
||||
"mov lr, #0\n\t"
|
||||
"br x19" )
|
||||
|
||||
|
|
|
@ -2452,8 +2452,6 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
|
|||
"pushl 8(%ebp)\n\t" /* entry */
|
||||
"call " __ASM_NAME("get_initial_context") "\n\t"
|
||||
"movl %eax,(%esp)\n\t" /* context */
|
||||
"leal 0xb0(%eax),%eax\n\t" /* &context->Eax */
|
||||
"movl %eax,4(%esp)\n\t"
|
||||
"movl 24(%ebp),%edx\n\t" /* thunk */
|
||||
"xorl %ebp,%ebp\n\t"
|
||||
"pushl $0\n\t"
|
||||
|
|
|
@ -2713,7 +2713,6 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
|
|||
/* attach dlls */
|
||||
"call " __ASM_NAME("get_initial_context") "\n\t"
|
||||
"movq %rax,%rcx\n\t" /* context */
|
||||
"leaq 0x80(%rcx),%rdx\n\t" /* &context->Rcx */
|
||||
"xorq %rax,%rax\n\t"
|
||||
"pushq %rax\n\t"
|
||||
"jmp *%rbx" )
|
||||
|
|
|
@ -120,7 +120,6 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig
|
|||
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
|
||||
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void CDECL server_init_process_done( void *relay ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
|
||||
CONTEXT *context ) DECLSPEC_HIDDEN;
|
||||
|
@ -170,6 +169,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
|
|||
extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
|
||||
int *needs_close, enum server_fd_type *type, unsigned int *options ) 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 int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
#define NTDLL_UNIXLIB_VERSION 98
|
||||
#define NTDLL_UNIXLIB_VERSION 99
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
|
@ -87,9 +87,6 @@ struct unix_funcs
|
|||
/* thread/process functions */
|
||||
NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
|
||||
|
||||
/* server functions */
|
||||
void (CDECL *server_init_process_done)( void *relay );
|
||||
|
||||
/* file functions */
|
||||
void (CDECL *set_show_dot_files)( BOOL enable );
|
||||
|
||||
|
|
Loading…
Reference in New Issue