Added new version of patch to fix condition mask handling in RtlVerifyVersionInfo.

This commit is contained in:
Sebastian Lackner 2014-12-01 11:39:29 +01:00
parent 5420552434
commit c67647eb73
7 changed files with 537 additions and 82 deletions

View File

@ -37,6 +37,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [1]:**
* Fix condition mask handling in RtlVerifyVersionInfo ([Wine Bug #36143](https://bugs.winehq.org/show_bug.cgi?id=36143))
**Bugs fixed in Wine Staging 1.7.32 [108]:**
* ATL IOCS data should not be stored in GWLP_USERDATA ([Wine Bug #21767](https://bugs.winehq.org/show_bug.cgi?id=21767))

1
debian/changelog vendored
View File

@ -1,5 +1,6 @@
wine-compholio (1.7.33) UNRELEASED; urgency=low
* Added additional tests for VerifyVersionInfoA.
* Added patch to fix condition handling in RtlVerifyVersionInfo.
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 30 Nov 2014 18:19:00 +0100
wine-compholio (1.7.32) unstable; urgency=low

View File

@ -742,14 +742,19 @@ kernel32-UTF7_Support.ok:
# Patchset kernel32-VerifyVersionInfo
# |
# | This patchset fixes the following Wine bugs:
# | * [#36143] Fix condition mask handling in RtlVerifyVersionInfo
# |
# | Modified files:
# | * dlls/kernel32/tests/version.c
# | * dlls/kernel32/tests/version.c, dlls/ntdll/version.c
# |
.INTERMEDIATE: kernel32-VerifyVersionInfo.ok
kernel32-VerifyVersionInfo.ok:
$(call APPLY_FILE,kernel32-VerifyVersionInfo/0001-kernel32-tests-Add-additional-tests-for-VerifyVersio.patch)
$(call APPLY_FILE,kernel32-VerifyVersionInfo/0001-kernel32-tests-Add-additional-tests-for-condition-ma.patch)
$(call APPLY_FILE,kernel32-VerifyVersionInfo/0002-ntdll-Fix-condition-mask-handling-in-RtlVerifyVersio.patch)
@( \
echo '+ { "Sebastian Lackner", "kernel32/tests: Add additional tests for VerifyVersionInfoA.", 1 },'; \
echo '+ { "Sebastian Lackner", "kernel32/tests: Add additional tests for condition mask of VerifyVersionInfoA.", 1 },'; \
echo '+ { "Sebastian Lackner", "ntdll: Fix condition mask handling in RtlVerifyVersionInfo.", 1 },'; \
) > kernel32-VerifyVersionInfo.ok
# Patchset libs-Unicode_Collation

View File

@ -1,79 +0,0 @@
From 6b6c6c74980d2e3b5b3a27544492a6ed46756ddc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 30 Nov 2014 22:27:01 +0100
Subject: kernel32/tests: Add additional tests for VerifyVersionInfoA.
---
dlls/kernel32/tests/version.c | 56 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c
index a47e52c..7fe33c4 100644
--- a/dlls/kernel32/tests/version.c
+++ b/dlls/kernel32/tests/version.c
@@ -353,6 +353,62 @@ static void test_VerifyVersionInfo(void)
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+ /* tests for condition mask */
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMajorVersion--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ if (servicepack)
+ {
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER));
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMajorVersion++;
+ info.wServicePackMajor--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_LESS), VER_SERVICEPACKMAJOR, VER_EQUAL));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+ }
+
/* test bad dwOSVersionInfoSize */
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
GetVersionExA((OSVERSIONINFOA *)&info);
--
2.1.3

View File

@ -0,0 +1,362 @@
From 8ad1946fb6af9ee34ea4a85adde57c9b6f9cc523 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 1 Dec 2014 11:28:26 +0100
Subject: kernel32/tests: Add additional tests for condition mask of
VerifyVersionInfoA.
---
dlls/kernel32/tests/version.c | 338 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 338 insertions(+)
diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c
index a47e52c..248f01c 100644
--- a/dlls/kernel32/tests/version.c
+++ b/dlls/kernel32/tests/version.c
@@ -353,6 +353,344 @@ static void test_VerifyVersionInfo(void)
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+ /* systematically test behaviour of condition mask (tests sorted by condition mask value) */
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMinorVersion++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_MINORVERSION, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMinorVersion++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_AND));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMinorVersion++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_LESS_EQUAL), VER_MINORVERSION, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMinorVersion++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_AND), VER_MINORVERSION, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMinorVersion++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_OR), VER_MINORVERSION, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_EQUAL));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ if (servicepack)
+ {
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMajorVersion++;
+ info.wServicePackMajor--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_LESS), VER_SERVICEPACKMAJOR, VER_EQUAL));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+ }
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ ret = pVerifyVersionInfoA(&info, VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL),
+ VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL),
+ VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL),
+ VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMinor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL),
+ VER_MINORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ if (servicepack)
+ {
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_MINORVERSION, VER_LESS_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_MINORVERSION, VER_AND), VER_SERVICEPACKMAJOR, VER_GREATER));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+ }
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_LESS_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ if (servicepack)
+ {
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor--;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_SERVICEPACKMAJOR, VER_GREATER), VER_SERVICEPACKMINOR, VER_EQUAL));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+ }
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL),
+ VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ todo_wine
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.dwMajorVersion--;
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ info.wServicePackMajor++;
+ SetLastError(0xdeadbeef);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
+ VER_MINORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS_EQUAL));
+ error = GetLastError();
+ ok(!ret, "VerifyVersionInfoA succeeded\n");
+ ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some win2k */,
+ "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
+
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ GetVersionExA((OSVERSIONINFOA *)&info);
+ ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
+ pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_AND));
+ ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
+
/* test bad dwOSVersionInfoSize */
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
GetVersionExA((OSVERSIONINFOA *)&info);
--
2.1.3

View File

@ -0,0 +1,160 @@
From ca7be85de4f395713f3b388d6eb1ce7399b5e2d8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 1 Dec 2014 11:30:58 +0100
Subject: ntdll: Fix condition mask handling in RtlVerifyVersionInfo.
---
dlls/kernel32/tests/version.c | 7 ------
dlls/ntdll/version.c | 50 ++++++++++++++++++++++++++++++++-----------
2 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c
index 248f01c..4d07176 100644
--- a/dlls/kernel32/tests/version.c
+++ b/dlls/kernel32/tests/version.c
@@ -360,7 +360,6 @@ static void test_VerifyVersionInfo(void)
info.dwMinorVersion++;
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_MINORVERSION, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -464,7 +463,6 @@ static void test_VerifyVersionInfo(void)
info.wServicePackMinor++;
ret = pVerifyVersionInfoA(&info, VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -484,7 +482,6 @@ static void test_VerifyVersionInfo(void)
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL),
VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -505,7 +502,6 @@ static void test_VerifyVersionInfo(void)
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL),
VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_EQUAL), VER_SERVICEPACKMINOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -584,7 +580,6 @@ static void test_VerifyVersionInfo(void)
info.wServicePackMajor++;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -603,7 +598,6 @@ static void test_VerifyVersionInfo(void)
info.wServicePackMajor++;
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@@ -623,7 +617,6 @@ static void test_VerifyVersionInfo(void)
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(pVerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL),
VER_MINORVERSION, VER_EQUAL), VER_SERVICEPACKMAJOR, VER_LESS));
- todo_wine
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index a6340eb..5d1b445 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -657,6 +657,35 @@ BOOLEAN WINAPI RtlGetNtProductType( LPDWORD type )
}
+static inline UCHAR version_update_condition(PUCHAR last_condition, UCHAR condition)
+{
+ switch (*last_condition)
+ {
+ case 0:
+ *last_condition = condition;
+ break;
+ case VER_EQUAL:
+ if (condition >= VER_EQUAL && condition <= VER_LESS_EQUAL)
+ {
+ *last_condition = condition;
+ return condition;
+ }
+ break;
+ case VER_GREATER:
+ case VER_GREATER_EQUAL:
+ if (condition >= VER_EQUAL && condition <= VER_GREATER_EQUAL)
+ return condition;
+ break;
+ case VER_LESS:
+ case VER_LESS_EQUAL:
+ if (condition == VER_EQUAL || (condition >= VER_LESS && condition <= VER_LESS_EQUAL))
+ return condition;
+ break;
+ }
+ if (!condition) *last_condition |= 0x10;
+ return *last_condition & 0xf;
+}
+
static inline NTSTATUS version_compare_values(ULONG left, ULONG right, UCHAR condition)
{
switch (condition) {
@@ -732,38 +761,33 @@ NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
if(dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
{
- unsigned char condition = 0;
+ unsigned char condition, last_condition = 0;
BOOLEAN do_next_check = TRUE;
if(dwTypeMask & VER_MAJORVERSION)
- condition = dwlConditionMask >> 1*3 & 0x07;
- else if(dwTypeMask & VER_MINORVERSION)
- condition = dwlConditionMask >> 0*3 & 0x07;
- else if(dwTypeMask & VER_SERVICEPACKMAJOR)
- condition = dwlConditionMask >> 5*3 & 0x07;
- else if(dwTypeMask & VER_SERVICEPACKMINOR)
- condition = dwlConditionMask >> 4*3 & 0x07;
-
- if(dwTypeMask & VER_MAJORVERSION)
{
+ condition = version_update_condition(&last_condition, dwlConditionMask >> 1*3 & 0x07);
status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, condition);
do_next_check = (ver.dwMajorVersion == info->dwMajorVersion) &&
- ((condition != VER_EQUAL) || (status == STATUS_SUCCESS));
+ ((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
}
if((dwTypeMask & VER_MINORVERSION) && do_next_check)
{
+ condition = version_update_condition(&last_condition, dwlConditionMask >> 0*3 & 0x07);
status = version_compare_values(ver.dwMinorVersion, info->dwMinorVersion, condition);
do_next_check = (ver.dwMinorVersion == info->dwMinorVersion) &&
- ((condition != VER_EQUAL) || (status == STATUS_SUCCESS));
+ ((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
}
if((dwTypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
{
+ condition = version_update_condition(&last_condition, dwlConditionMask >> 5*3 & 0x07);
status = version_compare_values(ver.wServicePackMajor, info->wServicePackMajor, condition);
do_next_check = (ver.wServicePackMajor == info->wServicePackMajor) &&
- ((condition != VER_EQUAL) || (status == STATUS_SUCCESS));
+ ((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
}
if((dwTypeMask & VER_SERVICEPACKMINOR) && do_next_check)
{
+ condition = version_update_condition(&last_condition, dwlConditionMask >> 4*3 & 0x07);
status = version_compare_values(ver.wServicePackMinor, info->wServicePackMinor, condition);
}
--
2.1.3

View File

@ -0,0 +1 @@
Fixes: [36143] Fix condition mask handling in RtlVerifyVersionInfo