Robert Shearman : ntdll: Use a common condition value for the major, minor and service pack version numbers.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 17 08:14:53 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 31d9341e8ecbbef9be54d1ceffeba9cc21793183
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=31d9341e8ecbbef9be54d1ceffeba9cc21793183

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Jul 17 12:09:27 2006 +0100

ntdll: Use a common condition value for the major, minor and service pack version numbers.

---

 dlls/kernel/tests/version.c |   16 +++++-------
 dlls/ntdll/version.c        |   59 +++++++++++++++++++++++++++----------------
 2 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/dlls/kernel/tests/version.c b/dlls/kernel/tests/version.c
index 46f61da..73ba665 100644
--- a/dlls/kernel/tests/version.c
+++ b/dlls/kernel/tests/version.c
@@ -53,7 +53,7 @@ START_TEST(version)
 
     ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION,
         pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
+    ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
 
     ret = pVerifyVersionInfoA(&info, VER_BUILDNUMBER | VER_MAJORVERSION |
         VER_MINORVERSION/* | VER_PLATFORMID | VER_SERVICEPACKMAJOR |
@@ -101,7 +101,7 @@ START_TEST(version)
     info.wServicePackMinor++;
     ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
         pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
+    ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
         "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
 
     /* test the failure hierarchy for the four version fields */
@@ -110,7 +110,7 @@ START_TEST(version)
     info.wServicePackMajor++;
     ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
         pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
+    ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
         "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
 
     GetVersionEx((OSVERSIONINFO *)&info);
@@ -129,10 +129,9 @@ START_TEST(version)
 
     ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
         pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
+    ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
 
 
-    /* shows that build number fits into the hierarchy after major version, but before minor version */
     GetVersionEx((OSVERSIONINFO *)&info);
     info.dwBuildNumber++;
     ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
@@ -142,13 +141,12 @@ START_TEST(version)
 
     ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
         pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
+    ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
 
     /* test bad dwOSVersionInfoSize */
     GetVersionEx((OSVERSIONINFO *)&info);
     info.dwOSVersionInfoSize = 0;
     ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
-        pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
-    todo_wine ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
-        "VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
+        pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
+    ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
 }
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index ee828b6..a5b9d45 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -642,29 +642,44 @@ NTSTATUS WINAPI RtlVerifyVersionInfo( co
         if (status != STATUS_SUCCESS)
             return status;
     }
-    if(dwTypeMask & VER_MAJORVERSION)
-    {
-        status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, dwlConditionMask >> 1*3 & 0x07);
-        if (status != STATUS_SUCCESS)
-            return status;
-    }
-    if(dwTypeMask & VER_MINORVERSION)
-    {
-        status = version_compare_values(ver.dwMinorVersion, info->dwMinorVersion, dwlConditionMask >> 0*3 & 0x07);
-        if (status != STATUS_SUCCESS)
-            return status;
-    }
-    if(dwTypeMask & VER_SERVICEPACKMAJOR)
-    {
-        status = version_compare_values(ver.wServicePackMajor, info->wServicePackMajor, dwlConditionMask >> 5*3 & 0x07);
-        if (status != STATUS_SUCCESS)
-            return status;
-    }
-    if(dwTypeMask & VER_SERVICEPACKMINOR)
+
+    if(dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
     {
-        status = version_compare_values(ver.wServicePackMinor, info->wServicePackMinor, dwlConditionMask >> 4*3 & 0x07);
-        if (status != STATUS_SUCCESS)
-            return status;
+        unsigned char condition = 0;
+
+        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)
+        {
+            status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, condition);
+            if (status != STATUS_SUCCESS)
+                return status;
+        }
+        if(dwTypeMask & VER_MINORVERSION)
+        {
+            status = version_compare_values(ver.dwMinorVersion, info->dwMinorVersion, condition);
+            if (status != STATUS_SUCCESS)
+                return status;
+        }
+        if(dwTypeMask & VER_SERVICEPACKMAJOR)
+        {
+            status = version_compare_values(ver.wServicePackMajor, info->wServicePackMajor, condition);
+            if (status != STATUS_SUCCESS)
+                return status;
+        }
+        if(dwTypeMask & VER_SERVICEPACKMINOR)
+        {
+            status = version_compare_values(ver.wServicePackMinor, info->wServicePackMinor, condition);
+            if (status != STATUS_SUCCESS)
+                return status;
+        }
     }
 
     return STATUS_SUCCESS;




More information about the wine-cvs mailing list