本文整理汇总了C++中VerifyVersionInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ VerifyVersionInfo函数的具体用法?C++ VerifyVersionInfo怎么用?C++ VerifyVersionInfo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VerifyVersionInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_windows_version_or_greater
static int is_windows_version_or_greater(DWORD os_major,
DWORD os_minor,
WORD service_pack_major,
WORD service_pack_minor) {
OSVERSIONINFOEX osvi;
DWORDLONG condition_mask = 0;
int op = VER_GREATER_EQUAL;
/* Initialize the OSVERSIONINFOEX structure. */
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = os_major;
osvi.dwMinorVersion = os_minor;
osvi.wServicePackMajor = service_pack_major;
osvi.wServicePackMinor = service_pack_minor;
/* Initialize the condition mask. */
VER_SET_CONDITION(condition_mask, VER_MAJORVERSION, op);
VER_SET_CONDITION(condition_mask, VER_MINORVERSION, op);
VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMAJOR, op);
VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMINOR, op);
/* Perform the test. */
return (int) VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
condition_mask);
}
示例2: isc_win32os_versioncheck
int
isc_win32os_versioncheck(unsigned int major, unsigned int minor,
unsigned int spmajor, unsigned int spminor)
{
OSVERSIONINFOEX osVer;
DWORD typeMask;
ULONGLONG conditionMask;
memset(&osVer, 0, sizeof(OSVERSIONINFOEX));
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
typeMask = 0;
conditionMask = 0;
/* Optimistic: likely greater */
osVer.dwMajorVersion = major;
typeMask |= VER_MAJORVERSION;
conditionMask = VerSetConditionMask(conditionMask,
VER_MAJORVERSION,
VER_GREATER);
osVer.dwMinorVersion = minor;
typeMask |= VER_MINORVERSION;
conditionMask = VerSetConditionMask(conditionMask,
VER_MINORVERSION,
VER_GREATER);
osVer.wServicePackMajor = spmajor;
typeMask |= VER_SERVICEPACKMAJOR;
conditionMask = VerSetConditionMask(conditionMask,
VER_SERVICEPACKMAJOR,
VER_GREATER);
osVer.wServicePackMinor = spminor;
typeMask |= VER_SERVICEPACKMINOR;
conditionMask = VerSetConditionMask(conditionMask,
VER_SERVICEPACKMINOR,
VER_GREATER);
if (VerifyVersionInfo(&osVer, typeMask, conditionMask))
return (1);
/* Failed: retry with equal */
conditionMask = 0;
conditionMask = VerSetConditionMask(conditionMask,
VER_MAJORVERSION,
VER_EQUAL);
conditionMask = VerSetConditionMask(conditionMask,
VER_MINORVERSION,
VER_EQUAL);
conditionMask = VerSetConditionMask(conditionMask,
VER_SERVICEPACKMAJOR,
VER_EQUAL);
conditionMask = VerSetConditionMask(conditionMask,
VER_SERVICEPACKMINOR,
VER_EQUAL);
if (VerifyVersionInfo(&osVer, typeMask, conditionMask))
return (0);
else
return (-1);
}
示例3: IsWin2kSP4OrLater
BOOL IsWin2kSP4OrLater()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
BYTE op=VER_GREATER_EQUAL;
// Initialize the OSVERSIONINFOEX structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 5;
osvi.dwMinorVersion = 0;
osvi.wServicePackMajor = 4;
osvi.wServicePackMinor = 0;
// Initialize the condition mask.
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMAJOR, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMINOR, op );
// Perform the test.
return VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
dwlConditionMask);
}
示例4: winOsVersion
QT_BEGIN_INCLUDE_NAMESPACE
#include "qt_windows.h"
QT_END_INCLUDE_NAMESPACE
#ifndef Q_OS_WINRT
static inline OSVERSIONINFO winOsVersion()
{
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
// GetVersionEx() has been deprecated in Windows 8.1 and will return
// only Windows 8 from that version on.
# if defined(_MSC_VER) && _MSC_VER >= 1800
# pragma warning( push )
# pragma warning( disable : 4996 )
# endif
GetVersionEx(&result);
# if defined(_MSC_VER) && _MSC_VER >= 1800
# pragma warning( pop )
# endif
# ifndef Q_OS_WINCE
if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
// This could be Windows 8.1 or higher. Note that as of Windows 9,
// the major version needs to be checked as well.
DWORDLONG conditionMask = 0;
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion,
result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
result.dwMinorVersion = checkVersion.dwMinorVersion;
}
# endif // !Q_OS_WINCE
return result;
}
示例5: is_windows_7
int is_windows_7()
{
#ifdef __MINGW32__
printf("Warning: this test was built with MinGW.\n"
"MinGW does not contain necessary version checking infrastructure. Claiming to be Windows 7, even if we're not.\n");
return 1;
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && ( !defined(__MINGW32__))
OSVERSIONINFOEX osvi;
DWORDLONG condition_mask = 0;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
// NT 6.1 is Windows 7
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 1;
VER_SET_CONDITION(condition_mask, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION(condition_mask, VER_MINORVERSION, VER_GREATER_EQUAL);
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, condition_mask);
#else
return 0;
#endif
}
示例6: calculate_minimum_latency
static unsigned int
calculate_minimum_latency(void)
{
OSVERSIONINFOEX osvi;
DWORDLONG mask;
/* Running under Terminal Services results in underruns with low latency. */
if (GetSystemMetrics(SM_REMOTESESSION) == TRUE) {
return 500;
}
/* Vista's WinMM implementation underruns when less than 200ms of audio is buffered. */
memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 0;
mask = 0;
VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION(mask, VER_MINORVERSION, VER_EQUAL);
if (VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, mask) != 0) {
return 200;
}
return 100;
}
示例7: IsWin7OrLater
/*
* Check Windows version
* The problem happens only in Windows 7
*
*/
static BOOL IsWin7OrLater()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
/* Initialize the OSVERSIONINFOEX structure */
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 1;
osvi.wServicePackMajor = 0;
osvi.wServicePackMinor = 0;
/* Initialize the condition mask */
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMAJOR, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMINOR, op );
/* Perform the test */
return VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
dwlConditionMask);
}
示例8: ZeroMemory
BOOL FileReader::IsVistaOrLater()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op=VER_GREATER_EQUAL;
// Initialize the OSVERSIONINFOEX structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 0;
osvi.wServicePackMajor = 0;
osvi.wServicePackMinor = 0;
// Initialize the condition mask.
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMAJOR, op );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMINOR, op );
// Perform the test.
m_bIsVistaOrLater = VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
dwlConditionMask);
return m_bIsVistaOrLater;
}
示例9: IsOSWin7
BOOL IsOSWin7()
{
BOOL bIsWinSeven = FALSE;
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
// Initialize the OSVERSIONINFOEX structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 1;
osvi.wServicePackMajor = 0;
// Initialize the condition mask.
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL );
VER_SET_CONDITION( dwlConditionMask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL );
// Perform the test.
if(VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask))
{
bIsWinSeven = TRUE;
}
return bIsWinSeven;
}
示例10: IsWindowsXPSP2OrLater
BOOL IsWindowsXPSP2OrLater ( void )
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
// Initialize the OSVERSIONINFOEX structure.
memset ( &osvi, 0, sizeof ( OSVERSIONINFOEX ) );
osvi.dwOSVersionInfoSize = sizeof ( OSVERSIONINFOEX );
osvi.dwMajorVersion = 5;
osvi.dwMinorVersion = 1;
osvi.wServicePackMajor = 2;
osvi.wServicePackMinor = 0;
// Initialize the condition mask.
VER_SET_CONDITION ( dwlConditionMask, VER_MAJORVERSION, op );
VER_SET_CONDITION ( dwlConditionMask, VER_MINORVERSION, op );
VER_SET_CONDITION ( dwlConditionMask, VER_SERVICEPACKMAJOR, op );
VER_SET_CONDITION ( dwlConditionMask, VER_SERVICEPACKMINOR, op );
// Perform the test.
return VerifyVersionInfo (
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
dwlConditionMask
);
}
示例11: IsWindowsVista
BOOL IsWindowsVista() {
// Code from Chapter 4
// Prepare the OSVERSIONINFOEX structure to indicate Windows Vista.
OSVERSIONINFOEX osver = { 0 };
osver.dwOSVersionInfoSize = sizeof(osver);
osver.dwMajorVersion = 6;
osver.dwMinorVersion = 0;
osver.dwPlatformId = VER_PLATFORM_WIN32_NT;
// Prepare the condition mask.
DWORDLONG dwlConditionMask = 0; // You MUST initialize this to 0.
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, VER_EQUAL);
// Perform the version test.
if (VerifyVersionInfo(&osver, VER_MAJORVERSION | VER_MINORVERSION |
VER_PLATFORMID, dwlConditionMask)) {
// The host system is Windows Vista exactly.
return(TRUE);
} else {
// The host system is NOT Windows Vista.
return(FALSE);
}
}
示例12: VerifyWindowsVersion
BOOL WINAPI VerifyWindowsVersion(
BYTE dwCondMask,
DWORD dwMajorVersion,
DWORD dwMinorVersion,
WORD wServicePackMajor)
{
OSVERSIONINFOEX osvi = {0};
DWORDLONG dwlCondMask = 0;
DWORD dwTypeMask = 0;
osvi.dwOSVersionInfoSize = sizeof(osvi);
osvi.dwMajorVersion = dwMajorVersion;
osvi.dwMinorVersion = dwMinorVersion;
if (wServicePackMajor < 0xFFFF) {
osvi.wServicePackMajor = wServicePackMajor;
}
VER_SET_CONDITION(dwlCondMask, VER_MAJORVERSION, dwCondMask);
dwTypeMask |= VER_MAJORVERSION;
VER_SET_CONDITION(dwlCondMask, VER_MINORVERSION, dwCondMask);
dwTypeMask |= VER_MINORVERSION;
if (wServicePackMajor < 0xFFFF) {
VER_SET_CONDITION(dwlCondMask, VER_SERVICEPACKMAJOR, dwCondMask);
dwTypeMask |= VER_SERVICEPACKMAJOR;
}
return VerifyVersionInfo(
&osvi,
dwTypeMask,
dwlCondMask);
}
示例13: emem_init
/* Initialize all the allocators here.
* This function should be called only once when Wireshark or TShark starts
* up.
*/
void
emem_init(void)
{
ep_init_chunk();
se_init_chunk();
if (getenv("WIRESHARK_DEBUG_SCRUB_MEMORY"))
debug_use_memory_scrubber = TRUE;
#if defined (_WIN32)
/* Set up our guard page info for Win32 */
GetSystemInfo(&sysinfo);
pagesize = sysinfo.dwPageSize;
#if (_MSC_VER >= 1800)
/*
* On VS2103, GetVersionEx is deprecated. Microsoft recommend to
* use VerifyVersionInfo instead
*/
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op = VER_EQUAL;
SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, op);
iswindowsplatform = VerifyVersionInfo(&osvi, VER_PLATFORMID, dwlConditionMask);
}
#else
/* calling GetVersionEx using the OSVERSIONINFO structure.
* OSVERSIONINFOEX requires Win NT4 with SP6 or newer NT Versions.
* OSVERSIONINFOEX will fail on Win9x and older NT Versions.
* See also:
* http://msdn.microsoft.com/library/en-us/sysinfo/base/getversionex.asp
* http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp
* http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfoex_str.asp
*/
{
OSVERSIONINFO versinfo;
SecureZeroMemory(&versinfo, sizeof(OSVERSIONINFO));
versinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&versinfo);
iswindowsplatform = (versinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
}
#endif
#elif defined(USE_GUARD_PAGES)
pagesize = sysconf(_SC_PAGESIZE);
if (pagesize == -1)
fprintf(stderr, "Warning: call to sysconf() for _SC_PAGESIZE has failed...\n");
#ifdef NEED_DEV_ZERO
dev_zero_fd = ws_open("/dev/zero", O_RDWR);
g_assert(dev_zero_fd != -1);
#endif
#endif /* _WIN32 / USE_GUARD_PAGES */
}
示例14: IsVistaOrGreater
/* Vista is major: 6, minor: 0 */
bool IsVistaOrGreater()
{
OSVERSIONINFOEX osver = { 0 };
ULONGLONG condMask = 0;
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osver.dwMajorVersion = 6;
VER_SET_CONDITION(condMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
return VerifyVersionInfo(&osver, VER_MAJORVERSION, condMask);
}
示例15: Curl_sndbufset
void Curl_sndbufset(curl_socket_t sockfd)
{
int val = CURL_MAX_WRITE_SIZE + 32;
int curval = 0;
int curlen = sizeof(curval);
DWORD majorVersion = 6;
static int detectOsState = DETECT_OS_NONE;
if(detectOsState == DETECT_OS_NONE) {
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
OSVERSIONINFO osver;
memset(&osver, 0, sizeof(osver));
osver.dwOSVersionInfoSize = sizeof(osver);
detectOsState = DETECT_OS_PREVISTA;
if(GetVersionEx(&osver)) {
if(osver.dwMajorVersion >= majorVersion)
detectOsState = DETECT_OS_VISTA_OR_LATER;
}
#elif defined(CURL_WINDOWS_APP)
(void)majorVersion;
detectOsState = DETECT_OS_VISTA_OR_LATER;
#else
ULONGLONG cm;
OSVERSIONINFOEX osver;
memset(&osver, 0, sizeof(osver));
osver.dwOSVersionInfoSize = sizeof(osver);
osver.dwMajorVersion = majorVersion;
cm = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL);
cm = VerSetConditionMask(cm, VER_MINORVERSION, VER_GREATER_EQUAL);
cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
cm))
detectOsState = DETECT_OS_VISTA_OR_LATER;
else
detectOsState = DETECT_OS_PREVISTA;
#endif
}
if(detectOsState == DETECT_OS_VISTA_OR_LATER)
return;
if(getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0)
if(curval > val)
return;
setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
}