From 52e09e823e2a2b65f1f993145c0a65ab1d84713d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 2 Apr 2018 18:11:51 +0200 Subject: [PATCH] ntdll: Add support for loading IL-only dlls. Signed-off-by: Alexandre Julliard --- dlls/ntdll/loader.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index fe5ce9d1e47..1a3dd801a12 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -956,7 +956,10 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void * if ((exports = RtlImageDirectoryEntryToData( imp->ldr.BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ))) - proc = find_named_export( imp->ldr.BaseAddress, exports, exp_size, "_CorExeMain", -1, load_path ); + { + const char *name = (wm->ldr.Flags & LDR_IMAGE_IS_DLL) ? "_CorDllMain" : "_CorExeMain"; + proc = find_named_export( imp->ldr.BaseAddress, exports, exp_size, name, -1, load_path ); + } if (!proc) return STATUS_PROCEDURE_NOT_FOUND; *entry = proc; return STATUS_SUCCESS; @@ -1929,7 +1932,11 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) || nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE)) { - if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) + if (wm->ldr.Flags & LDR_COR_ILONLY) + status = fixup_imports_ilonly( wm, load_path, &wm->ldr.EntryPoint ); + else + status = fixup_imports( wm, load_path ); + if (status != STATUS_SUCCESS) { /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); -- 2.11.4.GIT