2006-06-14 14:19:50 +02:00
|
|
|
/*
|
|
|
|
* Unit test suite for version functions
|
|
|
|
*
|
|
|
|
* Copyright 2006 Robert Shearman
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-05-30 18:40:34 +02:00
|
|
|
/* Needed for PRODUCT_* defines and GetProductInfo() */
|
|
|
|
#define _WIN32_WINNT 0x0600
|
|
|
|
|
2006-06-14 14:19:50 +02:00
|
|
|
#include "wine/test.h"
|
|
|
|
#include "winbase.h"
|
2014-10-06 22:31:43 +02:00
|
|
|
#include "winternl.h"
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2012-05-30 18:40:34 +02:00
|
|
|
static BOOL (WINAPI * pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *);
|
2006-06-28 18:57:37 +02:00
|
|
|
static BOOL (WINAPI * pVerifyVersionInfoA)(LPOSVERSIONINFOEXA, DWORD, DWORDLONG);
|
|
|
|
static ULONGLONG (WINAPI * pVerSetConditionMask)(ULONGLONG, DWORD, BYTE);
|
2014-10-06 22:31:43 +02:00
|
|
|
static NTSTATUS (WINAPI * pRtlGetVersion)(RTL_OSVERSIONINFOEXW *);
|
2006-06-28 18:57:37 +02:00
|
|
|
|
2014-10-06 22:31:43 +02:00
|
|
|
#define GET_PROC(func) \
|
|
|
|
p##func = (void *)GetProcAddress(hmod, #func);
|
2006-06-28 18:57:37 +02:00
|
|
|
|
|
|
|
static void init_function_pointers(void)
|
|
|
|
{
|
2014-10-06 22:31:43 +02:00
|
|
|
HMODULE hmod;
|
2006-06-28 18:57:37 +02:00
|
|
|
|
2014-10-06 22:31:43 +02:00
|
|
|
hmod = GetModuleHandleA("kernel32.dll");
|
2012-05-30 18:40:34 +02:00
|
|
|
|
2014-10-06 22:31:43 +02:00
|
|
|
GET_PROC(GetProductInfo);
|
|
|
|
GET_PROC(VerifyVersionInfoA);
|
|
|
|
GET_PROC(VerSetConditionMask);
|
|
|
|
|
|
|
|
hmod = GetModuleHandleA("ntdll.dll");
|
|
|
|
|
|
|
|
GET_PROC(RtlGetVersion);
|
2006-06-28 18:57:37 +02:00
|
|
|
}
|
|
|
|
|
2012-05-30 18:40:34 +02:00
|
|
|
static void test_GetProductInfo(void)
|
|
|
|
{
|
|
|
|
DWORD product;
|
|
|
|
DWORD res;
|
|
|
|
DWORD table[] = {9,8,7,6,
|
|
|
|
7,0,0,0,
|
|
|
|
6,2,0,0,
|
|
|
|
6,1,2,0,
|
|
|
|
6,1,1,0,
|
|
|
|
6,1,0,2,
|
|
|
|
6,1,0,0,
|
|
|
|
6,0,3,0,
|
|
|
|
6,0,2,0,
|
|
|
|
6,0,1,5,
|
|
|
|
6,0,1,0,
|
|
|
|
6,0,0,0,
|
|
|
|
5,3,0,0,
|
|
|
|
5,2,0,0,
|
|
|
|
5,1,0,0,
|
|
|
|
5,0,0,0,
|
|
|
|
0};
|
|
|
|
|
|
|
|
DWORD *entry = table;
|
|
|
|
|
|
|
|
if (!pGetProductInfo)
|
|
|
|
{
|
|
|
|
/* Not present before Vista */
|
|
|
|
win_skip("GetProductInfo() not available\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (*entry)
|
|
|
|
{
|
|
|
|
/* SetLastError() / GetLastError(): value is untouched */
|
|
|
|
product = 0xdeadbeef;
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
res = pGetProductInfo(entry[0], entry[1], entry[2], entry[3], &product);
|
|
|
|
|
|
|
|
if (entry[0] >= 6)
|
2012-06-13 17:44:09 +02:00
|
|
|
ok(res && (product > PRODUCT_UNDEFINED) && (product <= PRODUCT_PROFESSIONAL_WMC),
|
|
|
|
"got %d and 0x%x (expected TRUE and a valid PRODUCT_* value)\n", res, product);
|
2012-05-30 18:40:34 +02:00
|
|
|
else
|
|
|
|
ok(!res && !product && (GetLastError() == 0xdeadbeef),
|
|
|
|
"got %d and 0x%x with 0x%x (expected FALSE and PRODUCT_UNDEFINED with LastError untouched)\n",
|
|
|
|
res, product, GetLastError());
|
|
|
|
|
|
|
|
entry+= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NULL pointer is not a problem */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
res = pGetProductInfo(6, 1, 0, 0, NULL);
|
|
|
|
ok( (!res) && (GetLastError() == 0xdeadbeef),
|
|
|
|
"got %d with 0x%x (expected FALSE with LastError untouched\n", res, GetLastError());
|
|
|
|
}
|
|
|
|
|
2007-11-30 17:52:44 +01:00
|
|
|
static void test_GetVersionEx(void)
|
|
|
|
{
|
|
|
|
OSVERSIONINFOA infoA;
|
|
|
|
OSVERSIONINFOEXA infoExA;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
/* Silently crashes on XP */
|
2011-02-10 22:28:07 +01:00
|
|
|
GetVersionExA(NULL);
|
2007-11-30 17:52:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
memset(&infoA,0,sizeof infoA);
|
|
|
|
ret = GetVersionExA(&infoA);
|
|
|
|
ok(!ret, "Expected GetVersionExA to fail\n");
|
2008-02-26 10:32:24 +01:00
|
|
|
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
|
|
|
|
GetLastError() == 0xdeadbeef /* Win9x */,
|
|
|
|
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
|
|
|
|
GetLastError());
|
2007-11-30 17:52:44 +01:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) / 2;
|
|
|
|
ret = GetVersionExA(&infoA);
|
|
|
|
ok(!ret, "Expected GetVersionExA to fail\n");
|
2008-02-26 10:32:24 +01:00
|
|
|
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
|
|
|
|
GetLastError() == 0xdeadbeef /* Win9x */,
|
|
|
|
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
|
|
|
|
GetLastError());
|
2007-11-30 17:52:44 +01:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) * 2;
|
|
|
|
ret = GetVersionExA(&infoA);
|
|
|
|
ok(!ret, "Expected GetVersionExA to fail\n");
|
2008-02-26 10:32:24 +01:00
|
|
|
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
|
|
|
|
GetLastError() == 0xdeadbeef /* Win9x */,
|
|
|
|
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
|
|
|
|
GetLastError());
|
2007-11-30 17:52:44 +01:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
|
|
|
ret = GetVersionExA(&infoA);
|
|
|
|
ok(ret, "Expected GetVersionExA to succeed\n");
|
|
|
|
ok(GetLastError() == 0xdeadbeef,
|
|
|
|
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
infoExA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
ret = GetVersionExA((OSVERSIONINFOA *)&infoExA);
|
2008-09-03 05:53:53 +02:00
|
|
|
ok(ret ||
|
|
|
|
broken(ret == 0), /* win95 */
|
|
|
|
"Expected GetVersionExA to succeed\n");
|
2007-11-30 17:52:44 +01:00
|
|
|
}
|
|
|
|
|
2008-02-04 18:18:52 +01:00
|
|
|
static void test_VerifyVersionInfo(void)
|
2006-06-14 14:19:50 +02:00
|
|
|
{
|
2013-10-21 10:02:57 +02:00
|
|
|
OSVERSIONINFOEXA info;
|
2006-06-14 14:19:50 +02:00
|
|
|
BOOL ret;
|
2010-04-27 13:30:52 +02:00
|
|
|
DWORD servicepack, error;
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2007-03-12 11:41:23 +01:00
|
|
|
if(!pVerifyVersionInfoA || !pVerSetConditionMask)
|
|
|
|
{
|
2009-02-24 00:03:07 +01:00
|
|
|
win_skip("Needed functions not available\n");
|
2007-03-12 11:41:23 +01:00
|
|
|
return;
|
|
|
|
}
|
2006-06-28 18:57:37 +02:00
|
|
|
|
2008-03-11 11:09:38 +01:00
|
|
|
/* Before we start doing some tests we should check what the version of
|
|
|
|
* the ServicePack is. Tests on a box with no ServicePack will fail otherwise.
|
|
|
|
*/
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2008-03-11 11:09:38 +01:00
|
|
|
servicepack = info.wServicePackMajor;
|
2014-10-06 22:31:43 +02:00
|
|
|
|
|
|
|
/* Win8.1+ returns Win8 version in GetVersionEx when there's no app manifest targeting 8.1 */
|
|
|
|
if (info.dwMajorVersion == 6 && info.dwMinorVersion == 2)
|
|
|
|
{
|
|
|
|
RTL_OSVERSIONINFOEXW rtlinfo;
|
|
|
|
rtlinfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
|
|
|
|
ok(SUCCEEDED(pRtlGetVersion(&rtlinfo)), "RtlGetVersion failed\n");
|
|
|
|
|
|
|
|
if (rtlinfo.dwMajorVersion != 6 || rtlinfo.dwMinorVersion != 2)
|
|
|
|
{
|
|
|
|
win_skip("GetVersionEx and VerifyVersionInfo are faking values\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-11 11:09:38 +01:00
|
|
|
memset(&info, 0, sizeof(info));
|
|
|
|
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION,
|
|
|
|
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2006-10-10 01:06:48 +02:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_BUILDNUMBER | VER_MAJORVERSION |
|
2006-06-14 14:19:50 +02:00
|
|
|
VER_MINORVERSION/* | VER_PLATFORMID | VER_SERVICEPACKMAJOR |
|
|
|
|
VER_SERVICEPACKMINOR | VER_SUITENAME | VER_PRODUCT_TYPE */,
|
2006-06-28 18:57:37 +02:00
|
|
|
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
error = GetLastError();
|
|
|
|
ok(!ret, "VerifyVersionInfoA succeeded\n");
|
|
|
|
ok(error == ERROR_OLD_WIN_VERSION,
|
|
|
|
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
|
|
|
/* tests special handling of VER_SUITENAME */
|
|
|
|
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_SUITENAME,
|
|
|
|
pVerSetConditionMask(0, VER_SUITENAME, VER_AND));
|
2006-10-10 01:06:48 +02:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_SUITENAME,
|
|
|
|
pVerSetConditionMask(0, VER_SUITENAME, VER_OR));
|
2006-10-10 01:06:48 +02:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
|
|
|
/* test handling of version numbers */
|
|
|
|
|
|
|
|
/* v3.10 is always less than v4.x even
|
|
|
|
* if the minor version is tested */
|
|
|
|
info.dwMajorVersion = 3;
|
|
|
|
info.dwMinorVersion = 10;
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
|
2006-06-14 14:19:50 +02:00
|
|
|
VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2006-10-10 01:06:48 +02:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
|
|
|
info.dwMinorVersion = 0;
|
|
|
|
info.wServicePackMajor = 10;
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
|
2006-06-14 14:19:50 +02:00
|
|
|
VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2006-10-10 01:06:48 +02:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
|
|
|
info.wServicePackMajor = 0;
|
|
|
|
info.wServicePackMinor = 10;
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
|
2006-06-14 14:19:50 +02:00
|
|
|
VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2011-02-10 22:28:07 +01:00
|
|
|
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.wServicePackMinor++;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
error = GetLastError();
|
|
|
|
ok(!ret, "VerifyVersionInfoA succeeded\n");
|
|
|
|
ok(error == ERROR_OLD_WIN_VERSION || broken(error == ERROR_BAD_ARGUMENTS) /* some wink2 */,
|
|
|
|
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", error);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2008-03-11 11:09:38 +01:00
|
|
|
if (servicepack == 0)
|
|
|
|
{
|
|
|
|
skip("There is no ServicePack on this system\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2008-03-11 11:09:38 +01:00
|
|
|
info.wServicePackMajor--;
|
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2008-03-11 11:09:38 +01:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2008-03-11 11:09:38 +01:00
|
|
|
info.wServicePackMajor--;
|
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2008-03-11 11:09:38 +01:00
|
|
|
}
|
2006-07-17 13:11:04 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-07-17 13:11:04 +02:00
|
|
|
info.wServicePackMajor++;
|
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_LESS));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-07-17 13:11:04 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-07-17 13:11:04 +02:00
|
|
|
info.wServicePackMajor++;
|
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_LESS_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-07-17 13:11:04 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-07-17 13:11:04 +02:00
|
|
|
info.wServicePackMajor--;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-07-17 13:11:04 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
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);
|
2006-07-17 13:11:04 +02:00
|
|
|
|
2006-06-14 14:19:50 +02:00
|
|
|
/* test the failure hierarchy for the four version fields */
|
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.wServicePackMajor++;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
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);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.dwMinorVersion++;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
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);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.dwMajorVersion++;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
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);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.dwBuildNumber++;
|
2010-04-27 13:30:52 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
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);
|
2006-06-14 14:19:50 +02:00
|
|
|
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
|
|
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
|
|
|
|
/* test bad dwOSVersionInfoSize */
|
2013-10-21 10:02:57 +02:00
|
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
|
|
|
GetVersionExA((OSVERSIONINFOA *)&info);
|
2006-06-14 14:19:50 +02:00
|
|
|
info.dwOSVersionInfoSize = 0;
|
2006-06-28 18:57:37 +02:00
|
|
|
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
2006-07-17 13:11:44 +02:00
|
|
|
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
|
2010-04-27 13:30:52 +02:00
|
|
|
ok(ret || broken(!ret) /* some win2k */, "VerifyVersionInfoA failed with error %d\n", GetLastError());
|
2006-06-14 14:19:50 +02:00
|
|
|
}
|
2008-02-04 18:18:52 +01:00
|
|
|
|
|
|
|
START_TEST(version)
|
|
|
|
{
|
|
|
|
init_function_pointers();
|
|
|
|
|
2012-05-30 18:40:34 +02:00
|
|
|
test_GetProductInfo();
|
2008-02-04 18:18:52 +01:00
|
|
|
test_GetVersionEx();
|
|
|
|
test_VerifyVersionInfo();
|
|
|
|
}
|