[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

@ -76,6 +76,8 @@ Signature = "$ReactOS$"
56 = winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.2600.2982_none_deadbeef
57 = winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef
58 = winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23038_none_deadbeef
59 = winsxs\x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef
60 = winsxs\x86_reactos.newapi_6595b64144ccf1df_1.0.0.0_none_deadbeef
.InfEnd

View file

@ -32,9 +32,11 @@ function (add_apiset apiset_name baseaddress)
add_importlibs(${apiset_name} ${ARGN} kernel32 ntdll)
add_cd_file(TARGET ${apiset_name} DESTINATION reactos/system32 FOR all)
add_cd_file(TARGET ${apiset_name} DESTINATION reactos/winsxs/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef FOR all)
endfunction()
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef.manifest DESTINATION reactos/winsxs/manifests FOR all)
# Apisets will be appended
add_apiset(api-ms-win-appmodel-identity-l1-1-0 0x60000000 )

View file

@ -32,8 +32,10 @@ function (add_apiset apiset_name baseaddress)
add_importlibs(${apiset_name} ${ARGN} kernel32 ntdll)
add_cd_file(TARGET ${apiset_name} DESTINATION reactos/system32 FOR all)
add_cd_file(TARGET ${apiset_name} DESTINATION reactos/winsxs/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef FOR all)
endfunction()
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef.manifest DESTINATION reactos/winsxs/manifests FOR all)
# Apisets will be appended

View file

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="ReactOS.Apisets" version="1.0.0.0" publicKeyToken="6595b64144ccf1df"/>
<file name="api-ms-win-appmodel-identity-l1-1-0.dll"/>
<file name="api-ms-win-appmodel-runtime-l1-1-1.dll"/>
<file name="api-ms-win-appmodel-runtime-l1-1-2.dll"/>
<file name="api-ms-win-core-apiquery-l1-1-0.dll"/>
<file name="api-ms-win-core-appcompat-l1-1-1.dll"/>
<file name="api-ms-win-core-appinit-l1-1-0.dll"/>
<file name="api-ms-win-core-atoms-l1-1-0.dll"/>
<file name="api-ms-win-core-bem-l1-1-0.dll"/>
<file name="api-ms-win-core-com-l1-1-0.dll"/>
<file name="api-ms-win-core-com-l1-1-1.dll"/>
<file name="api-ms-win-core-com-private-l1-1-0.dll"/>
<file name="api-ms-win-core-console-l1-1-0.dll"/>
<file name="api-ms-win-core-console-l2-1-0.dll"/>
<file name="api-ms-win-core-crt-l1-1-0.dll"/>
<file name="api-ms-win-core-crt-l2-1-0.dll"/>
<file name="api-ms-win-core-datetime-l1-1-0.dll"/>
<file name="api-ms-win-core-datetime-l1-1-1.dll"/>
<file name="api-ms-win-core-debug-l1-1-0.dll"/>
<file name="api-ms-win-core-debug-l1-1-1.dll"/>
<file name="api-ms-win-core-delayload-l1-1-0.dll"/>
<file name="api-ms-win-core-delayload-l1-1-1.dll"/>
<file name="api-ms-win-core-errorhandling-l1-1-0.dll"/>
<file name="api-ms-win-core-errorhandling-l1-1-1.dll"/>
<file name="api-ms-win-core-errorhandling-l1-1-2.dll"/>
<file name="api-ms-win-core-errorhandling-l1-1-3.dll"/>
<file name="api-ms-win-core-fibers-l1-1-0.dll"/>
<file name="api-ms-win-core-fibers-l1-1-1.dll"/>
<file name="api-ms-win-core-file-l1-1-0.dll"/>
<file name="api-ms-win-core-file-l1-2-0.dll"/>
<file name="api-ms-win-core-file-l1-2-1.dll"/>
<file name="api-ms-win-core-file-l1-2-2.dll"/>
<file name="api-ms-win-core-file-l2-1-0.dll"/>
<file name="api-ms-win-core-file-l2-1-1.dll"/>
<file name="api-ms-win-core-file-l2-1-2.dll"/>
<file name="api-ms-win-core-handle-l1-1-0.dll"/>
<file name="api-ms-win-core-heap-l1-1-0.dll"/>
<file name="api-ms-win-core-heap-l1-2-0.dll"/>
<file name="api-ms-win-core-heap-l2-1-0.dll"/>
<file name="api-ms-win-core-heap-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-interlocked-l1-1-0.dll"/>
<file name="api-ms-win-core-interlocked-l1-2-0.dll"/>
<file name="api-ms-win-core-io-l1-1-0.dll"/>
<file name="api-ms-win-core-io-l1-1-1.dll"/>
<file name="api-ms-win-core-job-l1-1-0.dll"/>
<file name="api-ms-win-core-job-l2-1-0.dll"/>
<file name="api-ms-win-core-kernel32-legacy-l1-1-0.dll"/>
<file name="api-ms-win-core-kernel32-legacy-l1-1-1.dll"/>
<file name="api-ms-win-core-kernel32-private-l1-1-1.dll"/>
<file name="api-ms-win-core-largeinteger-l1-1-0.dll"/>
<file name="api-ms-win-core-libraryloader-l1-1-0.dll"/>
<file name="api-ms-win-core-libraryloader-l1-1-1.dll"/>
<file name="api-ms-win-core-libraryloader-l1-2-0.dll"/>
<file name="api-ms-win-core-libraryloader-l1-2-1.dll"/>
<file name="api-ms-win-core-libraryloader-l1-2-2.dll"/>
<file name="api-ms-win-core-localization-l1-1-0.dll"/>
<file name="api-ms-win-core-localization-l1-2-0.dll"/>
<file name="api-ms-win-core-localization-l1-2-1.dll"/>
<file name="api-ms-win-core-localization-l2-1-0.dll"/>
<file name="api-ms-win-core-localization-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-localization-obsolete-l1-2-0.dll"/>
<file name="api-ms-win-core-localization-obsolete-l1-3-0.dll"/>
<file name="api-ms-win-core-localization-private-l1-1-0.dll"/>
<file name="api-ms-win-core-localregistry-l1-1-0.dll"/>
<file name="api-ms-win-core-memory-l1-1-0.dll"/>
<file name="api-ms-win-core-memory-l1-1-1.dll"/>
<file name="api-ms-win-core-memory-l1-1-2.dll"/>
<file name="api-ms-win-core-misc-l1-1-0.dll"/>
<file name="api-ms-win-core-namedpipe-l1-1-0.dll"/>
<file name="api-ms-win-core-namedpipe-l1-2-0.dll"/>
<file name="api-ms-win-core-namespace-l1-1-0.dll"/>
<file name="api-ms-win-core-normalization-l1-1-0.dll"/>
<file name="api-ms-win-core-path-l1-1-0.dll"/>
<file name="api-ms-win-core-privateprofile-l1-1-1.dll"/>
<file name="api-ms-win-core-processenvironment-l1-1-0.dll"/>
<file name="api-ms-win-core-processenvironment-l1-2-0.dll"/>
<file name="api-ms-win-core-processthreads-l1-1-0.dll"/>
<file name="api-ms-win-core-processthreads-l1-1-1.dll"/>
<file name="api-ms-win-core-processthreads-l1-1-2.dll"/>
<file name="api-ms-win-core-processtopology-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-profile-l1-1-0.dll"/>
<file name="api-ms-win-core-psapi-ansi-l1-1-0.dll"/>
<file name="api-ms-win-core-psapi-l1-1-0.dll"/>
<file name="api-ms-win-core-psapi-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-quirks-l1-1-0.dll"/>
<file name="api-ms-win-core-realtime-l1-1-0.dll"/>
<file name="api-ms-win-core-registry-l1-1-0.dll"/>
<file name="api-ms-win-core-registry-l2-1-0.dll"/>
<file name="api-ms-win-core-registryuserspecific-l1-1-0.dll"/>
<file name="api-ms-win-core-rtlsupport-l1-1-0.dll"/>
<file name="api-ms-win-core-rtlsupport-l1-2-0.dll"/>
<file name="api-ms-win-core-shlwapi-legacy-l1-1-0.dll"/>
<file name="api-ms-win-core-shlwapi-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-shlwapi-obsolete-l1-2-0.dll"/>
<file name="api-ms-win-core-shutdown-l1-1-0.dll"/>
<file name="api-ms-win-core-sidebyside-l1-1-0.dll"/>
<file name="api-ms-win-core-string-l1-1-0.dll"/>
<file name="api-ms-win-core-string-l2-1-0.dll"/>
<file name="api-ms-win-core-string-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-core-stringansi-l1-1-0.dll"/>
<file name="api-ms-win-core-synch-ansi-l1-1-0.dll"/>
<file name="api-ms-win-core-synch-l1-1-0.dll"/>
<file name="api-ms-win-core-synch-l1-2-0.dll"/>
<file name="api-ms-win-core-synch-l1-2-1.dll"/>
<file name="api-ms-win-core-sysinfo-l1-1-0.dll"/>
<file name="api-ms-win-core-sysinfo-l1-2-0.dll"/>
<file name="api-ms-win-core-sysinfo-l1-2-1.dll"/>
<file name="api-ms-win-core-threadpool-l1-1-0.dll"/>
<file name="api-ms-win-core-threadpool-l1-2-0.dll"/>
<file name="api-ms-win-core-threadpool-legacy-l1-1-0.dll"/>
<file name="api-ms-win-core-threadpool-private-l1-1-0.dll"/>
<file name="api-ms-win-core-timezone-l1-1-0.dll"/>
<file name="api-ms-win-core-toolhelp-l1-1-0.dll"/>
<file name="api-ms-win-core-url-l1-1-0.dll"/>
<file name="api-ms-win-core-util-l1-1-0.dll"/>
<file name="api-ms-win-core-version-l1-1-0.dll"/>
<file name="api-ms-win-core-version-l1-1-1.dll"/>
<file name="api-ms-win-core-version-private-l1-1-0.dll"/>
<file name="api-ms-win-core-versionansi-l1-1-0.dll"/>
<file name="api-ms-win-core-windowserrorreporting-l1-1-0.dll"/>
<file name="api-ms-win-core-winrt-error-l1-1-0.dll"/>
<file name="api-ms-win-core-winrt-error-l1-1-1.dll"/>
<file name="api-ms-win-core-winrt-errorprivate-l1-1-1.dll"/>
<file name="api-ms-win-core-winrt-l1-1-0.dll"/>
<file name="api-ms-win-core-winrt-registration-l1-1-0.dll"/>
<file name="api-ms-win-core-winrt-roparameterizediid-l1-1-0.dll"/>
<file name="api-ms-win-core-winrt-string-l1-1-0.dll"/>
<file name="api-ms-win-core-wow64-l1-1-0.dll"/>
<file name="api-ms-win-core-wow64-l1-1-1.dll"/>
<file name="api-ms-win-core-xstate-l1-1-0.dll"/>
<file name="api-ms-win-core-xstate-l2-1-0.dll"/>
<file name="api-ms-win-crt-conio-l1-1-0.dll"/>
<file name="api-ms-win-crt-convert-l1-1-0.dll"/>
<file name="api-ms-win-crt-environment-l1-1-0.dll"/>
<file name="api-ms-win-crt-filesystem-l1-1-0.dll"/>
<file name="api-ms-win-crt-heap-l1-1-0.dll"/>
<file name="api-ms-win-crt-locale-l1-1-0.dll"/>
<file name="api-ms-win-crt-math-l1-1-0.dll"/>
<file name="api-ms-win-crt-multibyte-l1-1-0.dll"/>
<file name="api-ms-win-crt-private-l1-1-0.dll"/>
<file name="api-ms-win-crt-process-l1-1-0.dll"/>
<file name="api-ms-win-crt-runtime-l1-1-0.dll"/>
<file name="api-ms-win-crt-stdio-l1-1-0.dll"/>
<file name="api-ms-win-crt-string-l1-1-0.dll"/>
<file name="api-ms-win-crt-time-l1-1-0.dll"/>
<file name="api-ms-win-crt-utility-l1-1-0.dll"/>
<file name="api-ms-win-devices-config-l1-1-1.dll"/>
<file name="api-ms-win-devices-query-l1-1-1.dll"/>
<file name="api-ms-win-downlevel-advapi32-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-advapi32-l2-1-0.dll"/>
<file name="api-ms-win-downlevel-normaliz-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-ole32-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-shell32-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-shlwapi-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-shlwapi-l2-1-0.dll"/>
<file name="api-ms-win-downlevel-user32-l1-1-0.dll"/>
<file name="api-ms-win-downlevel-version-l1-1-0.dll"/>
<file name="api-ms-win-dx-d3dkmt-l1-1-0.dll"/>
<file name="api-ms-win-eventing-classicprovider-l1-1-0.dll"/>
<file name="api-ms-win-eventing-consumer-l1-1-0.dll"/>
<file name="api-ms-win-eventing-controller-l1-1-0.dll"/>
<file name="api-ms-win-eventing-legacy-l1-1-0.dll"/>
<file name="api-ms-win-eventing-provider-l1-1-0.dll"/>
<file name="api-ms-win-eventlog-legacy-l1-1-0.dll"/>
<file name="api-ms-win-gdi-dpiinfo-l1-1-0.dll"/>
<file name="api-ms-win-mm-joystick-l1-1-0.dll"/>
<file name="api-ms-win-mm-misc-l1-1-1.dll"/>
<file name="api-ms-win-mm-mme-l1-1-0.dll"/>
<file name="api-ms-win-mm-time-l1-1-0.dll"/>
<file name="api-ms-win-ntuser-dc-access-l1-1-0.dll"/>
<file name="api-ms-win-ntuser-rectangle-l1-1-0.dll"/>
<file name="api-ms-win-perf-legacy-l1-1-0.dll"/>
<file name="api-ms-win-power-base-l1-1-0.dll"/>
<file name="api-ms-win-power-setting-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-draw-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-private-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-private-l1-1-4.dll"/>
<file name="api-ms-win-rtcore-ntuser-window-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-winevent-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.dll"/>
<file name="api-ms-win-rtcore-ntuser-wmpointer-l1-1-3.dll"/>
<file name="api-ms-win-security-activedirectoryclient-l1-1-0.dll"/>
<file name="api-ms-win-security-audit-l1-1-1.dll"/>
<file name="api-ms-win-security-base-l1-1-0.dll"/>
<file name="api-ms-win-security-base-l1-2-0.dll"/>
<file name="api-ms-win-security-base-private-l1-1-1.dll"/>
<file name="api-ms-win-security-credentials-l1-1-0.dll"/>
<file name="api-ms-win-security-grouppolicy-l1-1-0.dll"/>
<file name="api-ms-win-security-lsalookup-l1-1-0.dll"/>
<file name="api-ms-win-security-lsalookup-l1-1-1.dll"/>
<file name="api-ms-win-security-lsalookup-l2-1-0.dll"/>
<file name="api-ms-win-security-lsalookup-l2-1-1.dll"/>
<file name="api-ms-win-security-lsapolicy-l1-1-0.dll"/>
<file name="api-ms-win-security-provider-l1-1-0.dll"/>
<file name="api-ms-win-security-sddl-l1-1-0.dll"/>
<file name="api-ms-win-security-systemfunctions-l1-1-0.dll"/>
<file name="api-ms-win-service-core-l1-1-0.dll"/>
<file name="api-ms-win-service-core-l1-1-1.dll"/>
<file name="api-ms-win-service-management-l1-1-0.dll"/>
<file name="api-ms-win-service-management-l2-1-0.dll"/>
<file name="api-ms-win-service-private-l1-1-1.dll"/>
<file name="api-ms-win-service-winsvc-l1-1-0.dll"/>
<file name="api-ms-win-service-winsvc-l1-2-0.dll"/>
<file name="api-ms-win-shcore-obsolete-l1-1-0.dll"/>
<file name="api-ms-win-shcore-scaling-l1-1-1.dll"/>
<file name="api-ms-win-shcore-stream-l1-1-0.dll"/>
<file name="api-ms-win-shcore-thread-l1-1-0.dll"/>
<file name="api-ms-win-shell-shellcom-l1-1-0.dll"/>
<file name="api-ms-win-shell-shellfolders-l1-1-0.dll"/>
</assembly>

View file

@ -13,4 +13,5 @@ add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/drivers/etc/protocol DESTINATION re
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/drivers/etc/services DESTINATION reactos/system32/drivers/etc FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/sounds/ReactOS_LogOn.wav DESTINATION reactos/media FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/systemcompatible.manifest DESTINATION reactos/winsxs/manifests FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/systemcompatible.manifest DESTINATION reactos/winsxs/manifests FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/forwardcompatible.manifest DESTINATION reactos/winsxs/manifests FOR all)

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="5.82.0.0" publicKeyToken="6595b64144ccf1df" processorArchitecture="x86" language="*" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.GdiPlus" version="1.1.0.0" publicKeyToken="6595b64144ccf1df" processorArchitecture="x86" language="*" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity type="win32" name="ReactOS.Apisets" version="1.0.0.0" publicKeyToken="6595b64144ccf1df" processorArchitecture="x86" language="*" />
</dependentAssembly>
</dependency>
</assembly>

View file

@ -281,6 +281,10 @@ macro(dir_to_num dir var)
set(${var} 57)
elseif(${dir} STREQUAL reactos/winsxs/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23038_none_deadbeef)
set(${var} 58)
elseif(${dir} STREQUAL reactos/winsxs/x86_reactos.apisets_6595b64144ccf1df_1.0.0.0_none_deadbeef)
set(${var} 59)
elseif(${dir} STREQUAL reactos/winsxs/x86_reactos.newapi_6595b64144ccf1df_1.0.0.0_none_deadbeef)
set(${var} 60)
else()
message(FATAL_ERROR "Wrong destination: ${dir}")
endif()

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