diff --git a/reactos/dll/ntdll/ldr/ldrpe.c b/reactos/dll/ntdll/ldr/ldrpe.c index da32ab2c810..d022363d815 100644 --- a/reactos/dll/ntdll/ldr/ldrpe.c +++ b/reactos/dll/ntdll/ldr/ldrpe.c @@ -690,7 +690,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL; PIMAGE_IMPORT_DESCRIPTOR ImportEntry; ULONG BoundSize, IatSize; - DPRINT("LdrpWalkImportDescriptor('%S' %p)\n", DllPath, LdrEntry); + + DPRINT("LdrpWalkImportDescriptor - BEGIN (%wZ %p '%S')\n", &LdrEntry->BaseDllName, LdrEntry, DllPath); /* Set up the Act Ctx */ RtlZeroMemory(&ActCtx, sizeof(ActCtx)); @@ -711,7 +712,7 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, Status2 != STATUS_RESOURCE_LANG_NOT_FOUND) { /* Some serious issue */ - Status = Status2; + //Status = Status2; // FIXME: Ignore that error for now DbgPrintEx(DPFLTR_SXS_ID, DPFLTR_WARNING_LEVEL, "LDR: LdrpWalkImportDescriptor() failed to probe %wZ for its " @@ -724,16 +725,20 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (!NT_SUCCESS(Status)) return Status; /* Get the Active ActCtx */ - Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext); - if (!NT_SUCCESS(Status)) + if (!LdrEntry->EntryPointActivationContext) { - /* Exit */ - DbgPrintEx(DPFLTR_SXS_ID, - DPFLTR_WARNING_LEVEL, - "LDR: RtlGetActiveActivationContext() failed; ntstatus = " - "0x%08lx\n", - Status); - return Status; + Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext); + + if (!NT_SUCCESS(Status)) + { + /* Exit */ + DbgPrintEx(DPFLTR_SXS_ID, + DPFLTR_WARNING_LEVEL, + "LDR: RtlGetActiveActivationContext() failed; ntstatus = " + "0x%08lx\n", + Status); + return Status; + } } /* Activate the ActCtx */ @@ -807,6 +812,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, /* Release the activation context */ RtlDeactivateActivationContextUnsafeFast(&ActCtx); + DPRINT("LdrpWalkImportDescriptor - END (%wZ %p)\n", &LdrEntry->BaseDllName, LdrEntry); + /* Return status */ return Status; } @@ -826,7 +833,7 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, PPEB Peb = RtlGetCurrentPeb(); PTEB Teb = NtCurrentTeb(); - DPRINT("LdrpLoadImportModule('%S' '%s' %p %p %p)\n", DllPath, ImportName, DllBase, DataTableEntry, Existing); + DPRINT("LdrpLoadImportModule('%s' %p %p %p '%S')\n", ImportName, DllBase, DataTableEntry, Existing, DllPath); /* Convert import descriptor name to unicode string */ ImpDescName = &Teb->StaticUnicodeString; @@ -849,6 +856,51 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, /* We're loading it for the first time */ *Existing = FALSE; +#if 0 + /* Load manifest */ + { + ACTCTX_SECTION_KEYED_DATA data; + NTSTATUS status; + + //DPRINT1("find_actctx_dll for %S\n", fullname); + //RtlInitUnicodeString(&nameW, libname); + data.cbSize = sizeof(data); + status = RtlFindActivationContextSectionString( + FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, + ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, + ImpDescName, + &data); + //if (status != STATUS_SUCCESS) return status; + DPRINT1("Status: 0x%08X\n", status); + + if (NT_SUCCESS(status)) + { + ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info; + SIZE_T needed, size = 1024; + + for (;;) + { + if (!(info = RtlAllocateHeap(RtlGetProcessHeap(), 0, size))) + { + status = STATUS_NO_MEMORY; + goto done; + } + status = RtlQueryInformationActivationContext(0, data.hActCtx, &data.ulAssemblyRosterIndex, + AssemblyDetailedInformationInActivationContext, + info, size, &needed); + if (status == STATUS_SUCCESS) break; + if (status != STATUS_BUFFER_TOO_SMALL) goto done; + RtlFreeHeap(RtlGetProcessHeap(), 0, info); + size = needed; + } + + DPRINT("manifestpath === %S\n", info->lpAssemblyManifestPath); + DPRINT("DirectoryName === %S\n", info->lpAssemblyDirectoryName); + } + } +done: +#endif + /* Map it */ Status = LdrpMapDll(DllPath, NULL, diff --git a/reactos/dll/ntdll/ldr/ldrutils.c b/reactos/dll/ntdll/ldr/ldrutils.c index 840932db2d3..16be082ab2e 100644 --- a/reactos/dll/ntdll/ldr/ldrutils.c +++ b/reactos/dll/ntdll/ldr/ldrutils.c @@ -2061,6 +2061,8 @@ lookinhash: } /* FIXME: Warning, activation context missing */ + DPRINT("Warning, activation context missing\n"); + /* NOTE: From here on down, everything looks good */ /* Loop the module list */ diff --git a/reactos/dll/win32/kernel32/client/actctx.c b/reactos/dll/win32/kernel32/client/actctx.c index 12ab09062de..419dbc6858c 100644 --- a/reactos/dll/win32/kernel32/client/actctx.c +++ b/reactos/dll/win32/kernel32/client/actctx.c @@ -157,7 +157,7 @@ BasepProbeForDllManifest(IN PVOID DllHandle, Info.Type = (ULONG)RT_MANIFEST; Info.Name = (ULONG)ISOLATIONAWARE_MANIFEST_RESOURCE_ID; Info.Language = 0; - if (!(Status = LdrFindResource_U(DllHandle, &Info, 2, &Entry))) + if (!(Status = LdrFindResource_U(DllHandle, &Info, 3, &Entry))) { /* Create the activation context */ Context.cbSize = sizeof(Context); diff --git a/reactos/lib/rtl/actctx.c b/reactos/lib/rtl/actctx.c index 88794aa3828..8d058e99775 100644 --- a/reactos/lib/rtl/actctx.c +++ b/reactos/lib/rtl/actctx.c @@ -4694,7 +4694,7 @@ RtlCreateActivationContext(IN ULONG Flags, HANDLE file = 0; struct actctx_loader acl; - DPRINT("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0); + DPRINT("RtlCreateActivationContext %p %08x, Image Base: %p\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0, ((ACTCTXW*)ActivationContextData)->hModule); if (!pActCtx || pActCtx->cbSize < sizeof(*pActCtx) || (pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL))