Merge pull request #8 from omega13a/patch-7

Update 0001-ntdll-Load-CLI-.NET-images-in-the-same-way-as-Window.patch
This commit is contained in:
Alistair Leslie-Hughes 2018-02-18 13:57:27 +11:00 committed by GitHub
commit d08debc99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index cdf8d586c36..fa66c4c40d2 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -100,11 +100,16 @@ struct builtin_load_info
@@ -104,11 +104,16 @@ struct builtin_load_info
static struct builtin_load_info default_load_info;
static struct builtin_load_info *builtin_load_info = &default_load_info;
@ -28,11 +28,10 @@ index cdf8d586c36..fa66c4c40d2 100644
static RTL_CRITICAL_SECTION loader_section;
static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
{
@@ -363,6 +368,78 @@ static inline ULONG_PTR allocate_stub( const char *dll, const char *name ) { ret
#endif /* __i386__ */
@@ -341,6 +346,78 @@ static inline ULONG_PTR allocate_stub( c
+/*************************************************************************
/*************************************************************************
+ * is_cli_only_image
+ *
+ * Checks if an image is a CLI/.NET image which does not contain any
@ -104,10 +103,11 @@ index cdf8d586c36..fa66c4c40d2 100644
+}
+
+
/*************************************************************************
+/*************************************************************************
* get_modref
*
@@ -913,6 +990,10 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
* Looks for the referenced HMODULE in the current process
@@ -917,6 +994,10 @@ static NTSTATUS fixup_imports( WINE_MODR
if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS; /* already done */
wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
@ -118,7 +118,7 @@ index cdf8d586c36..fa66c4c40d2 100644
wm->ldr.TlsIndex = alloc_tls_slot( &wm->ldr );
if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE,
@@ -1117,8 +1198,47 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
@@ -1107,8 +1188,47 @@ static NTSTATUS MODULE_InitDLL( WINE_MOD
BOOL retv = FALSE;
/* Skip calls for modules loaded with special load flags */
@ -167,32 +167,24 @@ index cdf8d586c36..fa66c4c40d2 100644
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.BaseAddress, reason );
if (!entry || !(wm->ldr.Flags & LDR_IMAGE_IS_DLL)) return STATUS_SUCCESS;
@@ -3116,7 +3236,6 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
WINE_MODREF *wm;
LPCWSTR load_path;
PEB *peb = NtCurrentTeb()->Peb;
- CONTEXT context = { 0 };
@@ -3329,11 +3449,17 @@ void WINAPI LdrInitializeThunk( void *ke
debugstr_w(peb->ProcessParameters->ImagePathName.Buffer), status );
NtTerminateProcess( GetCurrentProcess(), status );
}
+ if ((status = server_init_process_done( &start_context )) != STATUS_SUCCESS)
+ {
+ ERR( "Main exe initialization for %s failed, status %x\n",
+ debugstr_w(peb->ProcessParameters->ImagePathName.Buffer), status );
+ NtTerminateProcess( GetCurrentProcess(), status );
+ }
kernel32_start_process = kernel_start;
if (main_exe_file) NtClose( main_exe_file ); /* at this point the main module is created */
@@ -3147,7 +3266,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0 )) != STATUS_SUCCESS) goto error;
- if ((status = server_init_process_done( &context )) != STATUS_SUCCESS) goto error;
+ if ((status = server_init_process_done( &start_context )) != STATUS_SUCCESS) goto error;
actctx_init();
load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
@@ -3163,7 +3282,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
timeout.QuadPart = 0;
NtDelayExecution( TRUE, &timeout );
- if (context.ContextFlags) NtSetContextThread( GetCurrentThread(), &context );
+ if (start_context.ContextFlags) NtSetContextThread( GetCurrentThread(), &start_context );
wine_switch_to_stack( start_process, wm->ldr.EntryPoint, NtCurrentTeb()->Tib.StackBase );
error:
- server_init_process_done();
+ server_init_process_done();
}
--
2.14.1