mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 08:17:09 +08:00
[LDR]
- Fix a typo in kernel32's manifest prober routine - Don't RtlGetActiveActivationContext if it's already existing - Improve actctx and ldr debug prints - This fixes numerous LDR bugs, such as the famous bug with MSVCR90 CORE-7313, .NET installation issues CORE-7489 and, hopefully, many other. Thank you very much for putting your trust in me! svn path=/trunk/; revision=70646
This commit is contained in:
@@ -690,7 +690,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
|
|||||||
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL;
|
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL;
|
||||||
PIMAGE_IMPORT_DESCRIPTOR ImportEntry;
|
PIMAGE_IMPORT_DESCRIPTOR ImportEntry;
|
||||||
ULONG BoundSize, IatSize;
|
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 */
|
/* Set up the Act Ctx */
|
||||||
RtlZeroMemory(&ActCtx, sizeof(ActCtx));
|
RtlZeroMemory(&ActCtx, sizeof(ActCtx));
|
||||||
@@ -711,7 +712,7 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
|
|||||||
Status2 != STATUS_RESOURCE_LANG_NOT_FOUND)
|
Status2 != STATUS_RESOURCE_LANG_NOT_FOUND)
|
||||||
{
|
{
|
||||||
/* Some serious issue */
|
/* Some serious issue */
|
||||||
Status = Status2;
|
//Status = Status2; // FIXME: Ignore that error for now
|
||||||
DbgPrintEx(DPFLTR_SXS_ID,
|
DbgPrintEx(DPFLTR_SXS_ID,
|
||||||
DPFLTR_WARNING_LEVEL,
|
DPFLTR_WARNING_LEVEL,
|
||||||
"LDR: LdrpWalkImportDescriptor() failed to probe %wZ for its "
|
"LDR: LdrpWalkImportDescriptor() failed to probe %wZ for its "
|
||||||
@@ -724,16 +725,20 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
|
|||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Get the Active ActCtx */
|
/* Get the Active ActCtx */
|
||||||
Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext);
|
if (!LdrEntry->EntryPointActivationContext)
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
/* Exit */
|
Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext);
|
||||||
DbgPrintEx(DPFLTR_SXS_ID,
|
|
||||||
DPFLTR_WARNING_LEVEL,
|
if (!NT_SUCCESS(Status))
|
||||||
"LDR: RtlGetActiveActivationContext() failed; ntstatus = "
|
{
|
||||||
"0x%08lx\n",
|
/* Exit */
|
||||||
Status);
|
DbgPrintEx(DPFLTR_SXS_ID,
|
||||||
return Status;
|
DPFLTR_WARNING_LEVEL,
|
||||||
|
"LDR: RtlGetActiveActivationContext() failed; ntstatus = "
|
||||||
|
"0x%08lx\n",
|
||||||
|
Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Activate the ActCtx */
|
/* Activate the ActCtx */
|
||||||
@@ -807,6 +812,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
|
|||||||
/* Release the activation context */
|
/* Release the activation context */
|
||||||
RtlDeactivateActivationContextUnsafeFast(&ActCtx);
|
RtlDeactivateActivationContextUnsafeFast(&ActCtx);
|
||||||
|
|
||||||
|
DPRINT("LdrpWalkImportDescriptor - END (%wZ %p)\n", &LdrEntry->BaseDllName, LdrEntry);
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -826,7 +833,7 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
|
|||||||
PPEB Peb = RtlGetCurrentPeb();
|
PPEB Peb = RtlGetCurrentPeb();
|
||||||
PTEB Teb = NtCurrentTeb();
|
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 */
|
/* Convert import descriptor name to unicode string */
|
||||||
ImpDescName = &Teb->StaticUnicodeString;
|
ImpDescName = &Teb->StaticUnicodeString;
|
||||||
@@ -849,6 +856,51 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
|
|||||||
/* We're loading it for the first time */
|
/* We're loading it for the first time */
|
||||||
*Existing = FALSE;
|
*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 */
|
/* Map it */
|
||||||
Status = LdrpMapDll(DllPath,
|
Status = LdrpMapDll(DllPath,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@@ -2061,6 +2061,8 @@ lookinhash:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Warning, activation context missing */
|
/* FIXME: Warning, activation context missing */
|
||||||
|
DPRINT("Warning, activation context missing\n");
|
||||||
|
|
||||||
/* NOTE: From here on down, everything looks good */
|
/* NOTE: From here on down, everything looks good */
|
||||||
|
|
||||||
/* Loop the module list */
|
/* Loop the module list */
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ BasepProbeForDllManifest(IN PVOID DllHandle,
|
|||||||
Info.Type = (ULONG)RT_MANIFEST;
|
Info.Type = (ULONG)RT_MANIFEST;
|
||||||
Info.Name = (ULONG)ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
|
Info.Name = (ULONG)ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
|
||||||
Info.Language = 0;
|
Info.Language = 0;
|
||||||
if (!(Status = LdrFindResource_U(DllHandle, &Info, 2, &Entry)))
|
if (!(Status = LdrFindResource_U(DllHandle, &Info, 3, &Entry)))
|
||||||
{
|
{
|
||||||
/* Create the activation context */
|
/* Create the activation context */
|
||||||
Context.cbSize = sizeof(Context);
|
Context.cbSize = sizeof(Context);
|
||||||
|
|||||||
@@ -4694,7 +4694,7 @@ RtlCreateActivationContext(IN ULONG Flags,
|
|||||||
HANDLE file = 0;
|
HANDLE file = 0;
|
||||||
struct actctx_loader acl;
|
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) ||
|
if (!pActCtx || pActCtx->cbSize < sizeof(*pActCtx) ||
|
||||||
(pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL))
|
(pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL))
|
||||||
|
|||||||
Reference in New Issue
Block a user