本文整理汇总了C++中VER_SET_CONDITION函数的典型用法代码示例。如果您正苦于以下问题:C++ VER_SET_CONDITION函数的具体用法?C++ VER_SET_CONDITION怎么用?C++ VER_SET_CONDITION使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VER_SET_CONDITION函数的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: 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
);
}
示例3: 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);
}
}
示例4: sizeof
bool ImageHandler::CheckWin8()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
BYTE op = VER_GREATER_EQUAL;
// Initialize the OSVERSIONINFOEX structure.
::ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6;
osvi.dwMinorVersion = 2;
// Initialize the condition mask.
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op );
VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, op );
// Perform the test.
if( ::VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
dwlConditionMask) )
{
return true;
}
else
{
return false;
}
}
示例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: 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);
}
示例7: 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;
}
示例8: 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);
}
示例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: 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;
}
示例11: 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;
}
示例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: DetectOSVersion
VOID
DetectOSVersion()
/*++
Routine Description:
This routine determines the OS version and initializes some globals used
in the sample.
Arguments:
None
Return value:
None. On failure, global variables stay at default value
--*/
{
RTL_OSVERSIONINFOEXW VersionInfo = {0};
NTSTATUS Status;
ULONGLONG ConditionMask = 0;
//
// Set VersionInfo to Win7's version number and then use
// RtlVerifVersionInfo to see if this is win8 or greater.
//
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
VersionInfo.dwMajorVersion = 6;
VersionInfo.dwMinorVersion = 1;
VER_SET_CONDITION(ConditionMask, VER_MAJORVERSION, VER_LESS_EQUAL);
VER_SET_CONDITION(ConditionMask, VER_MINORVERSION, VER_LESS_EQUAL);
Status = RtlVerifyVersionInfo(&VersionInfo,
VER_MAJORVERSION | VER_MINORVERSION,
ConditionMask);
if (NT_SUCCESS(Status)) {
g_IsWin8OrGreater = FALSE;
InfoPrint("DetectOSVersion: This machine is running Windows 7 or an older OS.");
} else if (Status == STATUS_REVISION_MISMATCH) {
g_IsWin8OrGreater = TRUE;
InfoPrint("DetectOSVersion: This machine is running Windows 8 or a newer OS.");
} else {
ErrorPrint("RtlVerifyVersionInfo returned unexpected error status 0x%x.",
Status);
//
// default action is to assume this is not win8
//
g_IsWin8OrGreater = FALSE;
}
}
示例14: switch
INT CALLBACK FolderBrowserDialog::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM pData)
{
static BOOL bProcessEnsureVisible = FALSE;
switch(uMsg)
{
case BFFM_INITIALIZED:
{
//In case of Windows 7 and later
//INFO: Correction for the Microsoft bug that doesn't
// scroll the tree-view to the selected item...
OSVERSIONINFOEX osi;
DWORDLONG dwlConditionMask = 0;
::SecureZeroMemory(&osi, sizeof(OSVERSIONINFOEX));
osi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osi.dwMajorVersion = 6;
osi.dwMinorVersion = 1;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
//if (GetVersionEx(&osi) && osi.dwMajorVersion >= 6 && osi.dwMinorVersion >= 1)
if (VerifyVersionInfo(&osi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask))
bProcessEnsureVisible = TRUE;
FolderBrowserDialog* bfd = FolderBrowserDialog::GetInstance();
if (!bfd)
break;
if (bfd->Title[0])
SetWindowTextW(hwnd,bfd->Title);
if(bfd->curdir[0])
::SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, (LPARAM)bfd->curdir);
else if (bfd->root)
::SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE, (LPARAM)bfd->root);
return 1;
}
case BFFM_SELCHANGED:
if (bProcessEnsureVisible)
{
bProcessEnsureVisible = FALSE;
HWND hTreeView = 0;
::EnumChildWindows(hwnd, FolderBrowserDialog::FindTreeViewCallback, (LPARAM)&hTreeView);
if (hTreeView)
{
HTREEITEM hItm = TreeView_GetSelection(hTreeView);
if (hItm)
{
TreeView_EnsureVisible(hTreeView, hItm);
TreeView_Expand(hTreeView, hItm, TVE_EXPAND);
}
}
}
break;
}
return 0;
}
示例15: IsWindows10OrNewer
BOOL IsWindows10OrNewer()
{
OSVERSIONINFOEX osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 10;
osvi.dwMinorVersion = 0;
DWORDLONG dwlConditionMask = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
return ::VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask);
}