ntdll: Fix condition mask handling in RtlVerifyVersionInfo.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f6b6c94add
commit
004d32dae6
|
@ -195,9 +195,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
|
|
||||||
VER_MAJORVERSION, VER_EQUAL,
|
VER_MAJORVERSION, VER_EQUAL,
|
||||||
VER_MINORVERSION, VER_LESS,
|
VER_MINORVERSION, VER_LESS,
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
TRUE,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
@ -278,9 +275,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
|
|
||||||
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
||||||
VER_SERVICEPACKMINOR, VER_LESS,
|
VER_SERVICEPACKMINOR, VER_LESS,
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
TRUE,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
@ -298,8 +292,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
VER_MINORVERSION, VER_EQUAL,
|
VER_MINORVERSION, VER_EQUAL,
|
||||||
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
||||||
VER_SERVICEPACKMINOR, VER_LESS,
|
VER_SERVICEPACKMINOR, VER_LESS,
|
||||||
0, 0,
|
|
||||||
TRUE,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
@ -319,7 +311,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
VER_MINORVERSION, VER_EQUAL,
|
VER_MINORVERSION, VER_EQUAL,
|
||||||
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
VER_SERVICEPACKMAJOR, VER_EQUAL,
|
||||||
VER_SERVICEPACKMINOR, VER_LESS,
|
VER_SERVICEPACKMINOR, VER_LESS,
|
||||||
TRUE,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
@ -362,9 +353,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
|
|
||||||
VER_MAJORVERSION, VER_EQUAL,
|
VER_MAJORVERSION, VER_EQUAL,
|
||||||
VER_SERVICEPACKMAJOR, VER_LESS,
|
VER_SERVICEPACKMAJOR, VER_LESS,
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
TRUE,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
@ -382,8 +370,6 @@ static void test_VerifyVersionInfo(void)
|
||||||
VER_MAJORVERSION, VER_EQUAL,
|
VER_MAJORVERSION, VER_EQUAL,
|
||||||
VER_MINORVERSION, VER_EQUAL,
|
VER_MINORVERSION, VER_EQUAL,
|
||||||
VER_SERVICEPACKMAJOR, VER_LESS,
|
VER_SERVICEPACKMAJOR, VER_LESS,
|
||||||
0, 0,
|
|
||||||
TRUE
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
||||||
|
|
|
@ -657,6 +657,34 @@ BOOLEAN WINAPI RtlGetNtProductType( LPDWORD type )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline UCHAR version_update_condition(UCHAR *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)
|
static inline NTSTATUS version_compare_values(ULONG left, ULONG right, UCHAR condition)
|
||||||
{
|
{
|
||||||
|
@ -733,38 +761,33 @@ NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
|
||||||
|
|
||||||
if(dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
|
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;
|
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)
|
if(dwTypeMask & VER_MAJORVERSION)
|
||||||
{
|
{
|
||||||
|
condition = version_update_condition(&last_condition, dwlConditionMask >> 1*3 & 0x07);
|
||||||
status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, condition);
|
status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, condition);
|
||||||
do_next_check = (ver.dwMajorVersion == info->dwMajorVersion) &&
|
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)
|
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);
|
status = version_compare_values(ver.dwMinorVersion, info->dwMinorVersion, condition);
|
||||||
do_next_check = (ver.dwMinorVersion == info->dwMinorVersion) &&
|
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)
|
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);
|
status = version_compare_values(ver.wServicePackMajor, info->wServicePackMajor, condition);
|
||||||
do_next_check = (ver.wServicePackMajor == info->wServicePackMajor) &&
|
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)
|
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);
|
status = version_compare_values(ver.wServicePackMinor, info->wServicePackMinor, condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue