ntdll: Set ldr.EntryPoint for main executable.

This commit is contained in:
Sebastian Lackner 2014-08-02 18:27:20 +02:00 committed by Alexandre Julliard
parent 9d30002f7d
commit 5272ca241b
2 changed files with 4 additions and 4 deletions

View File

@ -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");

View File

@ -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))
{