2003-09-24 07:26:00 +02:00
|
|
|
/*
|
|
|
|
* Windows and DOS version functions
|
|
|
|
*
|
|
|
|
* Copyright 1997 Marcus Meissner
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
|
|
|
* Copyright 1998, 2003 Andreas Mohr
|
|
|
|
* Copyright 1997, 2003 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-09-24 07:26:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "ntstatus.h"
|
2005-11-28 17:32:54 +01:00
|
|
|
#define WIN32_NO_STATUS
|
2003-09-24 07:26:00 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "ntdll_misc.h"
|
2007-05-18 18:09:03 +02:00
|
|
|
#include "ddk/wdm.h"
|
2003-09-24 07:26:00 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ver);
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WIN20, /* Windows 2.0 */
|
|
|
|
WIN30, /* Windows 3.0 */
|
|
|
|
WIN31, /* Windows 3.1 */
|
|
|
|
WIN95, /* Windows 95 */
|
|
|
|
WIN98, /* Windows 98 */
|
|
|
|
WINME, /* Windows Me */
|
|
|
|
NT351, /* Windows NT 3.51 */
|
|
|
|
NT40, /* Windows NT 4.0 */
|
|
|
|
NT2K, /* Windows 2000 */
|
|
|
|
WINXP, /* Windows XP */
|
2013-10-01 16:34:20 +02:00
|
|
|
WINXP64, /* Windows XP 64-bit */
|
2003-09-24 07:26:00 +02:00
|
|
|
WIN2K3, /* Windows 2003 */
|
2007-04-12 16:10:50 +02:00
|
|
|
WINVISTA,/* Windows Vista */
|
2008-03-02 12:20:53 +01:00
|
|
|
WIN2K8, /* Windows 2008 */
|
2011-04-13 07:16:00 +02:00
|
|
|
WIN2K8R2,/* Windows 2008 R2 */
|
2009-10-30 02:21:40 +01:00
|
|
|
WIN7, /* Windows 7 */
|
2012-08-20 20:37:53 +02:00
|
|
|
WIN8, /* Windows 8 */
|
2014-10-07 21:27:45 +02:00
|
|
|
WIN81, /* Windows 8.1 */
|
2015-08-12 22:32:19 +02:00
|
|
|
WIN10, /* Windows 10 */
|
2003-09-24 07:26:00 +02:00
|
|
|
NB_WINDOWS_VERSIONS
|
|
|
|
} WINDOWS_VERSION;
|
|
|
|
|
|
|
|
/* FIXME: compare values below with original and fix.
|
|
|
|
* An *excellent* win9x version page (ALL versions !)
|
2005-11-22 13:00:23 +01:00
|
|
|
* can be found at www.mdgx.com/ver.htm */
|
2003-09-24 07:26:00 +02:00
|
|
|
static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
|
|
|
|
{
|
|
|
|
/* WIN20 FIXME: verify values */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 2, 0, 0, VER_PLATFORM_WIN32s,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Win32s 1.3", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WIN30 FIXME: verify values */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 3, 0, 0, VER_PLATFORM_WIN32s,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Win32s 1.3", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WIN31 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 3, 10, 0, VER_PLATFORM_WIN32s,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Win32s 1.3", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WIN95 */
|
|
|
|
{
|
|
|
|
/* Win95: 4, 0, 0x40003B6, ""
|
|
|
|
* Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
|
|
|
|
* Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
|
|
|
|
* Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
|
|
|
|
* Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
|
|
|
|
* Win95a/b can be discerned via regkey SubVersionNumber
|
|
|
|
*/
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WIN98 (second edition) */
|
|
|
|
{
|
|
|
|
/* Win98: 4, 10, 0x40A07CE, " " 4.10.1998
|
|
|
|
* Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
|
|
|
|
*/
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
|
2020-12-04 00:36:31 +01:00
|
|
|
L" A ", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WINME */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
|
2020-12-04 00:36:31 +01:00
|
|
|
L" ", 0, 0, 0, 0, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* NT351 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 3, 51, 0x421, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 5", 5, 0, 0, VER_NT_WORKSTATION, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* NT40 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x565, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 6a", 6, 0, 0, VER_NT_WORKSTATION, 0
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* NT2K */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 5, 0, 0x893, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 4", 4, 0, 0, VER_NT_WORKSTATION,
|
|
|
|
30 /* FIXME: Great, a reserved field with a value! */
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
|
|
|
/* WINXP */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 3", 3, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION,
|
|
|
|
30 /* FIXME: Great, a reserved field with a value! */
|
2003-09-24 07:26:00 +02:00
|
|
|
},
|
2013-10-01 16:34:20 +02:00
|
|
|
/* WINXP64 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2013-10-01 16:34:20 +02:00
|
|
|
},
|
2003-09-24 07:26:00 +02:00
|
|
|
/* WIN2K3 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
2007-04-12 16:10:50 +02:00
|
|
|
},
|
|
|
|
/* WINVISTA */
|
|
|
|
{
|
2010-04-19 20:57:15 +02:00
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2008-03-02 12:20:53 +01:00
|
|
|
},
|
|
|
|
/* WIN2K8 */
|
|
|
|
{
|
2011-10-15 04:59:52 +02:00
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
2009-10-30 02:21:40 +01:00
|
|
|
},
|
|
|
|
/* WIN7 */
|
|
|
|
{
|
2010-09-27 12:18:19 +02:00
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2011-04-13 07:16:00 +02:00
|
|
|
},
|
2011-10-15 04:59:52 +02:00
|
|
|
/* WIN2K8R2 */
|
2011-04-13 07:16:00 +02:00
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
2011-04-13 07:16:00 +02:00
|
|
|
},
|
2012-08-20 20:37:53 +02:00
|
|
|
/* WIN8 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 2, 0x23F0, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2012-08-20 20:37:53 +02:00
|
|
|
},
|
2014-10-07 21:27:45 +02:00
|
|
|
/* WIN81 */
|
|
|
|
{
|
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 6, 3, 0x2580, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2014-10-07 21:27:45 +02:00
|
|
|
},
|
2015-08-12 22:32:19 +02:00
|
|
|
/* WIN10 */
|
|
|
|
{
|
2020-09-23 08:05:13 +02:00
|
|
|
sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 0x4563, VER_PLATFORM_WIN32_NT,
|
2020-12-04 00:36:31 +01:00
|
|
|
L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
2015-08-12 22:32:19 +02:00
|
|
|
},
|
2011-04-13 07:16:00 +02:00
|
|
|
|
2003-09-24 07:26:00 +02:00
|
|
|
};
|
|
|
|
|
2019-11-21 17:31:43 +01:00
|
|
|
static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] =
|
|
|
|
{
|
2020-12-04 00:36:31 +01:00
|
|
|
{ L"win20", WIN20 },
|
|
|
|
{ L"win30", WIN30 },
|
|
|
|
{ L"win31", WIN31 },
|
|
|
|
{ L"win95", WIN95 },
|
|
|
|
{ L"win98", WIN98 },
|
|
|
|
{ L"winme", WINME },
|
|
|
|
{ L"nt351", NT351 },
|
|
|
|
{ L"nt40", NT40 },
|
|
|
|
{ L"win2000", NT2K },
|
|
|
|
{ L"win2k", NT2K },
|
|
|
|
{ L"nt2k", NT2K },
|
|
|
|
{ L"nt2000", NT2K },
|
|
|
|
{ L"winxp", WINXP },
|
|
|
|
{ L"winxp64", WINXP64 },
|
|
|
|
{ L"win2003", WIN2K3 },
|
|
|
|
{ L"win2k3", WIN2K3 },
|
|
|
|
{ L"vista", WINVISTA },
|
|
|
|
{ L"winvista", WINVISTA },
|
|
|
|
{ L"win2008", WIN2K8 },
|
|
|
|
{ L"win2k8", WIN2K8 },
|
|
|
|
{ L"win2008r2", WIN2K8R2 },
|
|
|
|
{ L"win2k8r2", WIN2K8R2 },
|
|
|
|
{ L"win7", WIN7 },
|
|
|
|
{ L"win8", WIN8 },
|
|
|
|
{ L"win81", WIN81 },
|
|
|
|
{ L"win10", WIN10 },
|
2003-09-24 07:26:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-08-10 15:12:27 +02:00
|
|
|
/* initialized to null so that we crash if we try to retrieve the version too early at startup */
|
|
|
|
static const RTL_OSVERSIONINFOEXW *current_version;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2005-08-16 13:16:10 +02:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* get_nt_registry_version
|
|
|
|
*
|
|
|
|
* Fetch the version information from the NT-style registry keys.
|
|
|
|
*/
|
|
|
|
static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
UNICODE_STRING nameW, valueW;
|
2005-08-16 18:13:42 +02:00
|
|
|
HANDLE hkey, hkey2;
|
2005-08-16 13:16:10 +02:00
|
|
|
char tmp[64];
|
|
|
|
DWORD count;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
|
|
|
|
|
|
|
|
attr.Length = sizeof(attr);
|
|
|
|
attr.RootDirectory = 0;
|
|
|
|
attr.ObjectName = &nameW;
|
|
|
|
attr.Attributes = 0;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );
|
2005-08-16 13:16:10 +02:00
|
|
|
|
|
|
|
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;
|
|
|
|
|
|
|
|
memset( version, 0, sizeof(*version) );
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"CurrentVersion" );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
|
|
|
{
|
|
|
|
WCHAR *p, *str = (WCHAR *)info->Data;
|
|
|
|
str[info->DataLength / sizeof(WCHAR)] = 0;
|
2020-03-31 11:43:50 +02:00
|
|
|
p = wcschr( str, '.' );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwMinorVersion = wcstoul( p, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwMajorVersion = wcstoul( str, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (version->dwMajorVersion) /* we got the main version, now fetch the other fields */
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
version->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
|
|
|
|
|
|
|
/* get build number */
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"CurrentBuildNumber" );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
|
|
|
{
|
|
|
|
WCHAR *str = (WCHAR *)info->Data;
|
|
|
|
str[info->DataLength / sizeof(WCHAR)] = 0;
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwBuildNumber = wcstoul( str, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get version description */
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"CSDVersion" );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
|
|
|
{
|
|
|
|
DWORD len = min( info->DataLength, sizeof(version->szCSDVersion) - sizeof(WCHAR) );
|
|
|
|
memcpy( version->szCSDVersion, info->Data, len );
|
|
|
|
version->szCSDVersion[len / sizeof(WCHAR)] = 0;
|
|
|
|
}
|
|
|
|
|
2005-08-16 18:13:42 +02:00
|
|
|
/* get service pack version */
|
2005-08-16 13:16:10 +02:00
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\Windows" );
|
2005-08-16 18:13:42 +02:00
|
|
|
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
|
|
|
|
{
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"CSDVersion" );
|
2005-08-16 18:13:42 +02:00
|
|
|
if (!NtQueryValueKey( hkey2, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
|
|
|
|
{
|
|
|
|
if (info->DataLength >= sizeof(DWORD))
|
|
|
|
{
|
|
|
|
DWORD dw = *(DWORD *)info->Data;
|
|
|
|
version->wServicePackMajor = LOWORD(dw) >> 8;
|
|
|
|
version->wServicePackMinor = LOWORD(dw) & 0xff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NtClose( hkey2 );
|
|
|
|
}
|
2005-08-16 13:16:10 +02:00
|
|
|
|
|
|
|
/* get product type */
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\ProductOptions" );
|
2005-08-16 18:13:42 +02:00
|
|
|
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
|
2005-08-16 13:16:10 +02:00
|
|
|
{
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"ProductType" );
|
2005-08-16 18:13:42 +02:00
|
|
|
if (!NtQueryValueKey( hkey2, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
2005-08-16 13:16:10 +02:00
|
|
|
{
|
|
|
|
WCHAR *str = (WCHAR *)info->Data;
|
|
|
|
str[info->DataLength / sizeof(WCHAR)] = 0;
|
2020-12-04 00:36:31 +01:00
|
|
|
if (!wcsicmp( str, L"WinNT" )) version->wProductType = VER_NT_WORKSTATION;
|
|
|
|
else if (!wcsicmp( str, L"LanmanNT" )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
|
|
|
|
else if (!wcsicmp( str, L"ServerNT" )) version->wProductType = VER_NT_SERVER;
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
2005-08-16 18:13:42 +02:00
|
|
|
NtClose( hkey2 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: get wSuiteMask */
|
|
|
|
}
|
|
|
|
|
|
|
|
NtClose( hkey );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* get_win9x_registry_version
|
|
|
|
*
|
|
|
|
* Fetch the version information from the Win9x-style registry keys.
|
|
|
|
*/
|
|
|
|
static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
UNICODE_STRING nameW, valueW;
|
|
|
|
HANDLE hkey;
|
|
|
|
char tmp[64];
|
|
|
|
DWORD count;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
|
|
|
|
|
|
|
|
attr.Length = sizeof(attr);
|
|
|
|
attr.RootDirectory = 0;
|
|
|
|
attr.ObjectName = &nameW;
|
|
|
|
attr.Attributes = 0;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
|
2005-08-16 13:16:10 +02:00
|
|
|
|
|
|
|
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;
|
|
|
|
|
|
|
|
memset( version, 0, sizeof(*version) );
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"VersionNumber" );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
|
|
|
{
|
|
|
|
WCHAR *p, *str = (WCHAR *)info->Data;
|
|
|
|
str[info->DataLength / sizeof(WCHAR)] = 0;
|
2020-03-31 11:43:50 +02:00
|
|
|
p = wcschr( str, '.' );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (p) *p++ = 0;
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwMajorVersion = wcstoul( str, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
str = p;
|
2020-03-31 11:43:50 +02:00
|
|
|
p = wcschr( str, '.' );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwBuildNumber = wcstoul( p, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
2020-03-30 12:09:49 +02:00
|
|
|
version->dwMinorVersion = wcstoul( str, NULL, 10 );
|
2005-08-16 13:16:10 +02:00
|
|
|
}
|
|
|
|
/* build number contains version too on Win9x */
|
|
|
|
version->dwBuildNumber |= MAKEWORD( version->dwMinorVersion, version->dwMajorVersion ) << 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (version->dwMajorVersion) /* we got the main version, now fetch the other fields */
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
version->dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
|
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"SubVersionNumber" );
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
|
|
|
|
{
|
|
|
|
DWORD len = min( info->DataLength, sizeof(version->szCSDVersion) - sizeof(WCHAR) );
|
|
|
|
memcpy( version->szCSDVersion, info->Data, len );
|
|
|
|
version->szCSDVersion[len / sizeof(WCHAR)] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NtClose( hkey );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-24 07:26:00 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* parse_win_version
|
|
|
|
*
|
|
|
|
* Parse the contents of the Version key.
|
|
|
|
*/
|
2005-06-17 15:58:33 +02:00
|
|
|
static BOOL parse_win_version( HANDLE hkey )
|
2003-09-24 07:26:00 +02:00
|
|
|
{
|
|
|
|
UNICODE_STRING valueW;
|
2019-11-21 17:31:43 +01:00
|
|
|
WCHAR *name, tmp[64];
|
2003-09-24 07:26:00 +02:00
|
|
|
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
|
2019-11-21 17:31:43 +01:00
|
|
|
DWORD i, count;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &valueW, L"Version" );
|
2019-11-21 17:31:43 +01:00
|
|
|
if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp) - sizeof(WCHAR), &count ))
|
2003-09-24 07:26:00 +02:00
|
|
|
return FALSE;
|
|
|
|
|
2019-11-21 17:31:43 +01:00
|
|
|
name = (WCHAR *)info->Data;
|
|
|
|
name[info->DataLength / sizeof(WCHAR)] = 0;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2019-11-21 17:31:43 +01:00
|
|
|
for (i = 0; i < ARRAY_SIZE(version_names); i++)
|
2003-09-24 07:26:00 +02:00
|
|
|
{
|
2020-03-31 11:54:39 +02:00
|
|
|
if (wcscmp( version_names[i].name, name )) continue;
|
2019-11-21 17:31:43 +01:00
|
|
|
current_version = &VersionData[version_names[i].ver];
|
|
|
|
TRACE( "got win version %s\n", debugstr_w(version_names[i].name) );
|
|
|
|
return TRUE;
|
2003-09-24 07:26:00 +02:00
|
|
|
}
|
|
|
|
|
2019-11-21 17:31:43 +01:00
|
|
|
ERR( "Invalid Windows version value %s specified in config file.\n", debugstr_w(name) );
|
2003-09-24 07:26:00 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-08-10 15:12:27 +02:00
|
|
|
* version_init
|
2003-09-24 07:26:00 +02:00
|
|
|
*/
|
2019-11-07 16:54:31 +01:00
|
|
|
void version_init(void)
|
2003-09-24 07:26:00 +02:00
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
UNICODE_STRING nameW;
|
2005-06-17 23:06:14 +02:00
|
|
|
HANDLE root, hkey, config_key;
|
2005-08-10 15:12:27 +02:00
|
|
|
BOOL got_win_ver = FALSE;
|
2019-11-07 16:54:31 +01:00
|
|
|
const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
|
|
|
|
WCHAR appversion[MAX_PATH+20];
|
2005-08-10 15:12:27 +02:00
|
|
|
|
2017-01-31 19:59:44 +01:00
|
|
|
current_version = &VersionData[WIN7];
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2005-06-17 23:06:14 +02:00
|
|
|
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
|
2003-09-24 07:26:00 +02:00
|
|
|
attr.Length = sizeof(attr);
|
2005-06-17 23:06:14 +02:00
|
|
|
attr.RootDirectory = root;
|
2003-09-24 07:26:00 +02:00
|
|
|
attr.ObjectName = &nameW;
|
|
|
|
attr.Attributes = 0;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
2020-12-04 00:36:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, L"Software\\Wine" );
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2005-06-17 23:06:14 +02:00
|
|
|
/* @@ Wine registry key: HKCU\Software\Wine */
|
|
|
|
if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) config_key = 0;
|
|
|
|
NtClose( root );
|
2005-08-10 15:12:27 +02:00
|
|
|
if (!config_key) goto done;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2005-06-17 23:06:14 +02:00
|
|
|
/* open AppDefaults\\appname key */
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2020-03-31 11:47:47 +02:00
|
|
|
if ((p = wcsrchr( appname, '/' ))) appname = p + 1;
|
|
|
|
if ((p = wcsrchr( appname, '\\' ))) appname = p + 1;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2020-12-04 00:36:31 +01:00
|
|
|
wcscpy( appversion, L"AppDefaults\\" );
|
2020-03-31 11:41:22 +02:00
|
|
|
wcscat( appversion, appname );
|
2019-11-07 16:54:31 +01:00
|
|
|
RtlInitUnicodeString( &nameW, appversion );
|
|
|
|
attr.RootDirectory = config_key;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2019-11-07 16:54:31 +01:00
|
|
|
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
|
|
|
|
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
|
|
|
{
|
|
|
|
TRACE( "getting version from %s\n", debugstr_w(appversion) );
|
|
|
|
got_win_ver = parse_win_version( hkey );
|
|
|
|
NtClose( hkey );
|
2003-09-24 07:26:00 +02:00
|
|
|
}
|
|
|
|
|
2005-08-10 15:12:27 +02:00
|
|
|
if (!got_win_ver)
|
|
|
|
{
|
|
|
|
TRACE( "getting default version\n" );
|
2005-08-16 13:16:10 +02:00
|
|
|
got_win_ver = parse_win_version( config_key );
|
2005-08-10 15:12:27 +02:00
|
|
|
}
|
2003-09-24 07:26:00 +02:00
|
|
|
NtClose( config_key );
|
|
|
|
|
2005-08-10 15:12:27 +02:00
|
|
|
done:
|
2005-08-16 13:16:10 +02:00
|
|
|
if (!got_win_ver)
|
|
|
|
{
|
|
|
|
static RTL_OSVERSIONINFOEXW registry_version;
|
|
|
|
|
|
|
|
TRACE( "getting registry version\n" );
|
|
|
|
if (get_nt_registry_version( ®istry_version ) ||
|
|
|
|
get_win9x_registry_version( ®istry_version ))
|
|
|
|
current_version = ®istry_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-10 15:12:27 +02:00
|
|
|
NtCurrentTeb()->Peb->OSMajorVersion = current_version->dwMajorVersion;
|
|
|
|
NtCurrentTeb()->Peb->OSMinorVersion = current_version->dwMinorVersion;
|
|
|
|
NtCurrentTeb()->Peb->OSBuildNumber = current_version->dwBuildNumber;
|
|
|
|
NtCurrentTeb()->Peb->OSPlatformId = current_version->dwPlatformId;
|
2003-09-24 07:26:00 +02:00
|
|
|
|
2009-05-18 17:05:10 +02:00
|
|
|
TRACE( "got %d.%d platform %d build %x name %s service pack %d.%d product %d\n",
|
2005-08-10 15:12:27 +02:00
|
|
|
current_version->dwMajorVersion, current_version->dwMinorVersion,
|
|
|
|
current_version->dwPlatformId, current_version->dwBuildNumber,
|
2005-08-16 13:16:10 +02:00
|
|
|
debugstr_w(current_version->szCSDVersion),
|
|
|
|
current_version->wServicePackMajor, current_version->wServicePackMinor,
|
|
|
|
current_version->wProductType );
|
2003-09-24 07:26:00 +02:00
|
|
|
}
|
|
|
|
|
2009-10-25 15:09:37 +01:00
|
|
|
/***********************************************************************
|
2012-05-30 18:40:33 +02:00
|
|
|
* RtlGetProductInfo (NTDLL.@)
|
2009-10-25 15:09:37 +01:00
|
|
|
*
|
|
|
|
* Gives info about the current Windows product type, in a format compatible
|
|
|
|
* with the given Windows version
|
|
|
|
*
|
|
|
|
* Returns TRUE if the input is valid, FALSE otherwise
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI RtlGetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion,
|
|
|
|
DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType)
|
|
|
|
{
|
2012-05-30 18:40:33 +02:00
|
|
|
TRACE("(%d, %d, %d, %d, %p)\n", dwOSMajorVersion, dwOSMinorVersion,
|
2009-10-25 15:09:37 +01:00
|
|
|
dwSpMajorVersion, dwSpMinorVersion, pdwReturnedProductType);
|
|
|
|
|
2012-05-30 18:40:33 +02:00
|
|
|
if (!pdwReturnedProductType)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (dwOSMajorVersion < 6)
|
|
|
|
{
|
|
|
|
*pdwReturnedProductType = PRODUCT_UNDEFINED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_version->wProductType == VER_NT_WORKSTATION)
|
|
|
|
*pdwReturnedProductType = PRODUCT_ULTIMATE_N;
|
|
|
|
else
|
|
|
|
*pdwReturnedProductType = PRODUCT_STANDARD_SERVER;
|
2009-10-25 15:09:37 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-09-24 07:26:00 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RtlGetVersion (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlGetVersion( RTL_OSVERSIONINFOEXW *info )
|
|
|
|
{
|
2005-08-10 15:12:27 +02:00
|
|
|
info->dwMajorVersion = current_version->dwMajorVersion;
|
|
|
|
info->dwMinorVersion = current_version->dwMinorVersion;
|
|
|
|
info->dwBuildNumber = current_version->dwBuildNumber;
|
|
|
|
info->dwPlatformId = current_version->dwPlatformId;
|
2020-03-31 11:37:58 +02:00
|
|
|
wcscpy( info->szCSDVersion, current_version->szCSDVersion );
|
2003-09-24 07:26:00 +02:00
|
|
|
if(info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
|
|
|
{
|
2005-08-10 15:12:27 +02:00
|
|
|
info->wServicePackMajor = current_version->wServicePackMajor;
|
|
|
|
info->wServicePackMinor = current_version->wServicePackMinor;
|
|
|
|
info->wSuiteMask = current_version->wSuiteMask;
|
|
|
|
info->wProductType = current_version->wProductType;
|
2003-09-24 07:26:00 +02:00
|
|
|
}
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlGetNtVersionNumbers (NTDLL.@)
|
|
|
|
*
|
|
|
|
* Get the version numbers of the run time library.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* major [O] Destination for the Major version
|
|
|
|
* minor [O] Destination for the Minor version
|
|
|
|
* build [O] Destination for the Build version
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Introduced in Windows XP (NT5.1)
|
|
|
|
*/
|
|
|
|
void WINAPI RtlGetNtVersionNumbers( LPDWORD major, LPDWORD minor, LPDWORD build )
|
|
|
|
{
|
2005-08-10 15:12:27 +02:00
|
|
|
if (major) *major = current_version->dwMajorVersion;
|
|
|
|
if (minor) *minor = current_version->dwMinorVersion;
|
2003-09-24 07:26:00 +02:00
|
|
|
/* FIXME: Does anybody know the real formula? */
|
2005-08-10 15:12:27 +02:00
|
|
|
if (build) *build = (0xF0000000 | current_version->dwBuildNumber);
|
2003-09-24 07:26:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-10 16:48:45 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* RtlGetNtProductType (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI RtlGetNtProductType( LPDWORD type )
|
|
|
|
{
|
|
|
|
if (type) *type = current_version->wProductType;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-02-27 12:18:38 +01:00
|
|
|
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;
|
|
|
|
}
|
2005-08-10 16:48:45 +02:00
|
|
|
|
2006-07-17 13:08:50 +02:00
|
|
|
static inline NTSTATUS version_compare_values(ULONG left, ULONG right, UCHAR condition)
|
|
|
|
{
|
|
|
|
switch (condition) {
|
|
|
|
case VER_EQUAL:
|
|
|
|
if (left != right) return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
case VER_GREATER:
|
|
|
|
if (left <= right) return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
case VER_GREATER_EQUAL:
|
|
|
|
if (left < right) return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
case VER_LESS:
|
|
|
|
if (left >= right) return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
case VER_LESS_EQUAL:
|
|
|
|
if (left > right) return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
default:
|
2006-07-17 13:12:36 +02:00
|
|
|
return STATUS_REVISION_MISMATCH;
|
2006-07-17 13:08:50 +02:00
|
|
|
}
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-09-24 07:26:00 +02:00
|
|
|
/******************************************************************************
|
2005-09-08 14:42:51 +02:00
|
|
|
* RtlVerifyVersionInfo (NTDLL.@)
|
2003-09-24 07:26:00 +02:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
|
|
|
|
DWORD dwTypeMask, DWORDLONG dwlConditionMask )
|
|
|
|
{
|
|
|
|
RTL_OSVERSIONINFOEXW ver;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("(%p,0x%x,0x%s)\n", info, dwTypeMask, wine_dbgstr_longlong(dwlConditionMask));
|
2003-09-24 07:26:00 +02:00
|
|
|
|
|
|
|
ver.dwOSVersionInfoSize = sizeof(ver);
|
|
|
|
if ((status = RtlGetVersion( &ver )) != STATUS_SUCCESS) return status;
|
|
|
|
|
|
|
|
if(!(dwTypeMask && dwlConditionMask)) return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if(dwTypeMask & VER_PRODUCT_TYPE)
|
2006-07-17 13:08:50 +02:00
|
|
|
{
|
|
|
|
status = version_compare_values(ver.wProductType, info->wProductType, dwlConditionMask >> 7*3 & 0x07);
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
2003-09-24 07:26:00 +02:00
|
|
|
if(dwTypeMask & VER_SUITENAME)
|
|
|
|
switch(dwlConditionMask >> 6*3 & 0x07)
|
|
|
|
{
|
|
|
|
case VER_AND:
|
|
|
|
if((info->wSuiteMask & ver.wSuiteMask) != info->wSuiteMask)
|
|
|
|
return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
case VER_OR:
|
|
|
|
if(!(info->wSuiteMask & ver.wSuiteMask) && info->wSuiteMask)
|
|
|
|
return STATUS_REVISION_MISMATCH;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
if(dwTypeMask & VER_PLATFORMID)
|
2006-07-17 13:08:50 +02:00
|
|
|
{
|
|
|
|
status = version_compare_values(ver.dwPlatformId, info->dwPlatformId, dwlConditionMask >> 3*3 & 0x07);
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
2003-09-24 07:26:00 +02:00
|
|
|
if(dwTypeMask & VER_BUILDNUMBER)
|
2006-07-17 13:08:50 +02:00
|
|
|
{
|
|
|
|
status = version_compare_values(ver.dwBuildNumber, info->dwBuildNumber, dwlConditionMask >> 2*3 & 0x07);
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
2006-07-17 13:09:27 +02:00
|
|
|
|
|
|
|
if(dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
|
2006-07-17 13:08:50 +02:00
|
|
|
{
|
2018-02-27 12:18:38 +01:00
|
|
|
unsigned char condition, last_condition = 0;
|
2006-07-17 13:11:04 +02:00
|
|
|
BOOLEAN do_next_check = TRUE;
|
2006-07-17 13:09:27 +02:00
|
|
|
|
|
|
|
if(dwTypeMask & VER_MAJORVERSION)
|
|
|
|
{
|
2018-02-27 12:18:38 +01:00
|
|
|
condition = version_update_condition(&last_condition, dwlConditionMask >> 1*3 & 0x07);
|
2006-07-17 13:09:27 +02:00
|
|
|
status = version_compare_values(ver.dwMajorVersion, info->dwMajorVersion, condition);
|
2006-07-17 13:11:04 +02:00
|
|
|
do_next_check = (ver.dwMajorVersion == info->dwMajorVersion) &&
|
2018-02-27 12:18:38 +01:00
|
|
|
((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
|
2006-07-17 13:09:27 +02:00
|
|
|
}
|
2006-07-17 13:11:04 +02:00
|
|
|
if((dwTypeMask & VER_MINORVERSION) && do_next_check)
|
2006-07-17 13:09:27 +02:00
|
|
|
{
|
2018-02-27 12:18:38 +01:00
|
|
|
condition = version_update_condition(&last_condition, dwlConditionMask >> 0*3 & 0x07);
|
2006-07-17 13:09:27 +02:00
|
|
|
status = version_compare_values(ver.dwMinorVersion, info->dwMinorVersion, condition);
|
2006-07-17 13:11:04 +02:00
|
|
|
do_next_check = (ver.dwMinorVersion == info->dwMinorVersion) &&
|
2018-02-27 12:18:38 +01:00
|
|
|
((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
|
2006-07-17 13:09:27 +02:00
|
|
|
}
|
2006-07-17 13:11:04 +02:00
|
|
|
if((dwTypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
2006-07-17 13:09:27 +02:00
|
|
|
{
|
2018-02-27 12:18:38 +01:00
|
|
|
condition = version_update_condition(&last_condition, dwlConditionMask >> 5*3 & 0x07);
|
2006-07-17 13:09:27 +02:00
|
|
|
status = version_compare_values(ver.wServicePackMajor, info->wServicePackMajor, condition);
|
2006-07-17 13:11:04 +02:00
|
|
|
do_next_check = (ver.wServicePackMajor == info->wServicePackMajor) &&
|
2018-02-27 12:18:38 +01:00
|
|
|
((condition >= VER_EQUAL) && (condition <= VER_LESS_EQUAL));
|
2006-07-17 13:09:27 +02:00
|
|
|
}
|
2006-07-17 13:11:04 +02:00
|
|
|
if((dwTypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
2006-07-17 13:09:27 +02:00
|
|
|
{
|
2018-02-27 12:18:38 +01:00
|
|
|
condition = version_update_condition(&last_condition, dwlConditionMask >> 4*3 & 0x07);
|
2006-07-17 13:09:27 +02:00
|
|
|
status = version_compare_values(ver.wServicePackMinor, info->wServicePackMinor, condition);
|
|
|
|
}
|
2006-07-17 13:11:04 +02:00
|
|
|
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
return status;
|
2006-07-17 13:08:50 +02:00
|
|
|
}
|
2003-09-24 07:26:00 +02:00
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|