[RTL] actctx.c: Use an alternative implicit activation context when an application is built for latest windows versions.

Instead of loading systemcompatible.manifest as the implicit activation context, load forwardcompatible.manifest
Add a new assembly containing all apisets called ReactOS.Apisets and make it a dependency to forwardcompatible.manifest
This commit is contained in:
Giannis Adamopoulos 2018-04-08 22:28:29 +03:00
parent 19912955f6
commit 8d3045622e
8 changed files with 268 additions and 4 deletions

View file

@ -4935,6 +4935,9 @@ void actctx_init(void)
HANDLE handle;
WCHAR buffer[1024];
NTSTATUS Status;
BOOLEAN bForwardCompatible = FALSE;
ULONG Buffer[(sizeof(COMPATIBILITY_CONTEXT_ELEMENT) * 10 + sizeof(ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION)) / sizeof(ULONG)];
SIZE_T SizeRequired;
ctx.cbSize = sizeof(ctx);
ctx.lpSource = NULL;
@ -4947,12 +4950,36 @@ void actctx_init(void)
process_actctx = check_actctx(handle);
}
/* FIXME: use RosGetProcessCompatVersion when PR419 gets merged */
Status = RtlQueryInformationActivationContext(RTL_QUERY_ACTIVATION_CONTEXT_FLAG_NO_ADDREF,
NULL,
NULL,
CompatibilityInformationInActivationContext,
Buffer,
sizeof(Buffer),
&SizeRequired);
if (NT_SUCCESS(Status))
{
DPRINT("RtlQueryInformationActivationContext for CompatibilityInformationInActivationContext suceeded\n");
ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION* ContextCompatInfo;
ContextCompatInfo = (ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION*)Buffer;
/* No Compatibility elements present, bail out */
if (ContextCompatInfo->ElementCount != 0)
{
DPRINT1("Found compatibility information in exe manifest (%d). Attempting to activate forward compatibility!\n", ContextCompatInfo->ElementCount);
bForwardCompatible = TRUE;
}
}
ctx.dwFlags = 0;
ctx.hModule = NULL;
ctx.lpResourceName = NULL;
ctx.lpSource = buffer;
RtlStringCchCopyW(buffer, 1024, SharedUserData->NtSystemRoot);
RtlStringCchCatW(buffer, 1024, L"\\winsxs\\manifests\\systemcompatible.manifest");
if (!bForwardCompatible)
RtlStringCchCatW(buffer, 1024, L"\\winsxs\\manifests\\systemcompatible.manifest");
else
RtlStringCchCatW(buffer, 1024, L"\\winsxs\\manifests\\forwardcompatible.manifest");
Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
if (NT_SUCCESS(Status))
{