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

