Module: wine Branch: master Commit: 5272ca241b78cec4884d3dd7edca496b302b4508 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5272ca241b78cec4884d3dd7ed...
Author: Sebastian Lackner sebastian@fds-team.de Date: Sat Aug 2 18:27:20 2014 +0200
ntdll: Set ldr.EntryPoint for main executable.
---
dlls/kernel32/tests/module.c | 1 - dlls/ntdll/loader.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index b54b4e3..bb22c24 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -729,7 +729,6 @@ static void testK32GetModuleInformation(void) ret = pK32GetModuleInformation(GetCurrentProcess(), mod, &info, sizeof(info)); ok(ret, "K32GetModuleInformation failed for main module\n"); ok(info.lpBaseOfDll == mod, "Wrong info.lpBaseOfDll = %p, expected %p\n", info.lpBaseOfDll, mod); - todo_wine ok(info.EntryPoint != NULL, "Expected nonzero entrypoint\n");
mod = GetModuleHandleA("kernel32.dll"); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 18ae29c..3c2fc56 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -934,9 +934,10 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) else p = wm->ldr.FullDllName.Buffer; RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
- if ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) && !is_dll_native_subsystem( hModule, nt, p )) + if (!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL) || !is_dll_native_subsystem( hModule, nt, p )) { - wm->ldr.Flags |= LDR_IMAGE_IS_DLL; + if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL) + wm->ldr.Flags |= LDR_IMAGE_IS_DLL; if (nt->OptionalHeader.AddressOfEntryPoint) wm->ldr.EntryPoint = (char *)hModule + nt->OptionalHeader.AddressOfEntryPoint; } @@ -1062,7 +1063,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
if (wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) return STATUS_SUCCESS; if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.BaseAddress, reason ); - if (!entry) return STATUS_SUCCESS; + if (!entry || !(wm->ldr.Flags & LDR_IMAGE_IS_DLL)) return STATUS_SUCCESS;
if (TRACE_ON(relay)) {