https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cb99761bc168f9239c6e1…
commit cb99761bc168f9239c6e126546cf9db02f5ca6ff
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Mar 1 23:40:57 2020 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun May 31 13:14:01 2020 +0200
[NTDLL] Use lowest OS version GUID in the application manifest, instead of highest
---
dll/ntdll/ldr/ldrinit.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c
index cdf51c64b38..f2b2116e782 100644
--- a/dll/ntdll/ldr/ldrinit.c
+++ b/dll/ntdll/ldr/ldrinit.c
@@ -1636,8 +1636,13 @@ LdrpInitializeProcessCompat(PVOID pProcessActctx, PVOID*
pOldShimData)
if (ContextCompatInfo->ElementCount == 0)
return;
- /* Search for known GUID's, starting from newest to oldest. */
- for (cur = 0; cur < RTL_NUMBER_OF(KnownCompatGuids); ++cur)
+ /* Search for known GUIDs, starting from oldest to newest.
+ Note that on Windows it is somewhat reversed, starting from the latest known
+ version, going down. But we are not Windows, trying to allow a lower version,
+ we are ReactOS trying to fake a higher version. So we interpret what Windows
+ does as "try the closest version to the actual version", so we start
with the
+ lowest version, which is closest to Windows 2003, which we mostly are. */
+ for (cur = RTL_NUMBER_OF(KnownCompatGuids) - 1; cur != -1; --cur)
{
for (n = 0; n < ContextCompatInfo->ElementCount; ++n)
{
@@ -1671,9 +1676,11 @@ LdrpInitializeProcessCompat(PVOID pProcessActctx, PVOID*
pOldShimData)
*pOldShimData = pShimData;
}
- /* Store the highest found version, and bail out. */
+ /* Store the lowest found version, and bail out. */
pShimData->dwRosProcessCompatVersion = KnownCompatGuids[cur].Version;
- DPRINT1("LdrpInitializeProcessCompat: Found guid for winver
0x%x\n", KnownCompatGuids[cur].Version);
+ DPRINT1("LdrpInitializeProcessCompat: Found guid for winver 0x%x in
manifest from %wZ\n",
+ KnownCompatGuids[cur].Version,
+ &(NtCurrentPeb()->ProcessParameters->ImagePathName));
return;
}
}