当前位置: 首页>>代码示例>>C++>>正文


C++ GetVersionExA函数代码示例

本文整理汇总了C++中GetVersionExA函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVersionExA函数的具体用法?C++ GetVersionExA怎么用?C++ GetVersionExA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetVersionExA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Getplatform

eWinPlatform Getplatform(void)
{
	OSVERSIONINFOA Osv;

	memset(&Osv, 0, sizeof(Osv));
	Osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	if (!GetVersionExA(&Osv))
	{
		memset(&Osv, 0, sizeof(Osv));
		Osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if (!GetVersionExA(&Osv))
			return WIN_UNKNOWN;
	}

	switch(Osv.dwPlatformId)
	{
	case VER_PLATFORM_WIN32s:
		return WIN_3X;

	case VER_PLATFORM_WIN32_WINDOWS:
		return WIN_9X;

	case VER_PLATFORM_WIN32_NT:
		return WIN_NT;

	default:
		return WIN_UNKNOWN;
	}
}
开发者ID:zhonghao1986cd,项目名称:projects,代码行数:29,代码来源:GetLocalDNSImp_Win.cpp

示例2: CheckFor98Mill

bool CheckFor98Mill()
{
	static bool needOsCheck = true;
	static bool is98Mill = false;

	if (needOsCheck)
	{
		bool invalid = false;
		OSVERSIONINFOEXA osvi;
		ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));

		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
		{
			osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA);
			if ( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
				return false;
		}

		needOsCheck = false;
		is98Mill = osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS; // let's check Win95, 98, *AND* ME.
	}

	return is98Mill;
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:25,代码来源:Misc.cpp

示例3: CheckForVista

bool CheckForVista()
{
	static bool needOsCheck = true;
	static bool isVista = false;

	if (needOsCheck)
	{
		bool invalid = false;
		OSVERSIONINFOEXA osvi;
		ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));

		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
		{
			osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA);
			if ( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
				return false;
		}

		needOsCheck = false;
		isVista = osvi.dwMajorVersion >= 6;
	}

	return isVista;
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:25,代码来源:Misc.cpp

示例4: iResolveAPI2

static BOOL iResolveAPI2(tVerifyTrustData* d)
{
	d->m_hWintrustDll = LoadLibraryA("WINTRUST");
	if (!d->m_hWintrustDll)
		return FALSE;
	d->m_hCrypt32Dll = LoadLibraryA("CRYPT32");
	if (!d->m_hCrypt32Dll)
		return FALSE;
	
	memset(&d->vi, 0, sizeof(OSVERSIONINFOA));
	d->vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	if ( !GetVersionExA(&d->vi) )
		return FALSE;

	_RESOLVE_API(d->m_hWintrustDll, WinVerifyTrust);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminAcquireContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminCalcHashFromFileHandle);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminEnumCatalogFromHash);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATCatalogInfoFromContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminReleaseCatalogContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminReleaseContext);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertOpenStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertEnumCertificatesInStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertGetCertificateChain);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFindChainInStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertVerifyCertificateChainPolicy);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateChainEngine);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateChain);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateContext);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertCloseStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertGetNameStringA);
	return TRUE;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:33,代码来源:verifytrust.c

示例5: DXUTGetMonitorInfo

BOOL DXUTGetMonitorInfo(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
{
    static bool s_bInited = false;
    static LPGETMONITORINFO s_pFnGetMonitorInfo = NULL;
    if(!s_bInited)        
    {
        s_bInited = true;
        HMODULE hUser32 = GetModuleHandle(L"USER32");
        if (hUser32) 
        {
            OSVERSIONINFOA osvi = {0}; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionExA((OSVERSIONINFOA*)&osvi);
            bool bNT = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId);    
            s_pFnGetMonitorInfo = (LPGETMONITORINFO) (bNT ? GetProcAddress(hUser32,"GetMonitorInfoW") : GetProcAddress(hUser32,"GetMonitorInfoA"));
        }
    }

    if(s_pFnGetMonitorInfo) 
        return s_pFnGetMonitorInfo(hMonitor, lpMonitorInfo);

    RECT rcWork;
    if ((hMonitor == DXUT_PRIMARY_MONITOR) && lpMonitorInfo && (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
    {
        lpMonitorInfo->rcMonitor.left = 0;
        lpMonitorInfo->rcMonitor.top  = 0;
        lpMonitorInfo->rcMonitor.right  = GetSystemMetrics(SM_CXSCREEN);
        lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
        lpMonitorInfo->rcWork = rcWork;
        lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
        return TRUE;
    }
    return FALSE;
}
开发者ID:50059021,项目名称:wodegongjubao,代码行数:32,代码来源:DXUTmisc.cpp

示例6: do_date

void do_date(void)
{
    OSVERSIONINFOA verinfo;
    CHAR buf[128];
    time_t t = time(NULL);
    DWORD dwSize;
    CHAR szComp[MAX_PATH], szUser[MAX_PATH];

    // OS info
    verinfo.dwOSVersionInfoSize = sizeof(verinfo);
    GetVersionExA(&verinfo);
    sprintf(buf, "Microsoft Windows [Version %u.%u.%u]",
        verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber);
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);

    // computer_name - user_name
    dwSize = MAX_PATH;
    GetComputerNameA(szComp, &dwSize);
    dwSize = MAX_PATH;
    GetUserNameA(szUser, &dwSize);
    sprintf(buf, "%s - %s", szComp, szUser);
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);

    // Thu Nov 28 14:52:58     2013
    strftime(buf, 64, "%a %b %d %H:%M:%S     %Y", localtime(&t));
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);
}
开发者ID:davehorner,项目名称:XScreenSaverWin,代码行数:33,代码来源:xscreensaver-text.c

示例7: osplatform_getter

 osplatform_getter() : m_osplatform( 0 )
 {
     OSVERSIONINFOA osvi;
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
     if( GetVersionExA( & osvi ) )
         m_osplatform = osvi.dwPlatformId;
 }
开发者ID:luosin,项目名称:Temp,代码行数:7,代码来源:syntax2.cpp

示例8: sizeof

bool CNtDriverControl::IsWindowsNt()
{
	OSVERSIONINFOEX  OSVer;

	OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	OSVer.dwOSVersionInfoSize = sizeof(OSVer);

	if (!GetVersionExA((OSVERSIONINFOA *)&OSVer))
		return false;

	switch(OSVer.dwPlatformId << 16 | OSVer.dwMajorVersion << 8 | OSVer.dwMinorVersion)
	{

	  case VER_PLATFORM_WIN32_NT     <<16|0x0500| 1:
		  if(!GetSystemMetrics(87))
			return TRUE;
		  
	  default:
		  MessageBox (0
			  , _T("DeepMonitor designed only for Windows XP !")
			  , _T("Information")
			  , MB_OK);
		  return false;
	
	}
	
	return false;
	
}
开发者ID:WildeSE,项目名称:Source-Code,代码行数:29,代码来源:CNtDriverControl.cpp

示例9: iupStrGetMemory

char *iupdrvGetSystemVersion(void)
{
  char *str = iupStrGetMemory(256);
  OSVERSIONINFOEXA osvi;
  SYSTEM_INFO si;

  ZeroMemory(&si, sizeof(SYSTEM_INFO));
  GetSystemInfo(&si);

  ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));
  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
  GetVersionExA((OSVERSIONINFOA*)&osvi);

  sprintf(str, "%d.%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion, (int)osvi.dwBuildNumber);

  /* Display service pack (if any). */
  if (osvi.szCSDVersion && osvi.szCSDVersion[0]!=0)
  {
    strcat(str, " ");
    strcat(str, osvi.szCSDVersion);
  }

  if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
    strcat(str, " (IA64)");
  else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
    strcat(str, " (x64)");
  else
    strcat(str, " (x86)");

  return str;
}
开发者ID:ivanceras,项目名称:iup-mirror,代码行数:31,代码来源:iupwindows_info.c

示例10: my_CreateRemoteThread

HANDLE my_CreateRemoteThread(HANDLE hRemoteProc, LPTHREAD_START_ROUTINE pThreadFun, LPVOID pThreadData) {

	/*
	win vista/7 NtCreateThreadEx
	win xp/8 CreateRemoteThread
	*/

	BOOL bCrossSession = FALSE;

	OSVERSIONINFOA sysVersion;
	sysVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);

	if (GetVersionExA(&sysVersion)) {
		if ((sysVersion.dwMajorVersion >= 6) && (sysVersion.dwMinorVersion != 2)) {
			bCrossSession = TRUE;
		}
	}

	HANDLE hThread = NULL;

	if (bCrossSession) {
		hThread = NtCreateThreadEx_1(hRemoteProc, pThreadFun, pThreadData);
	} else {
		DWORD dwThreadId = 0;
		hThread = CreateRemoteThread(hRemoteProc, NULL, 0, pThreadFun, pThreadData, 0, &dwThreadId);
	}

	return hThread;
}
开发者ID:khuangia,项目名称:wce,代码行数:29,代码来源:getpwd.cpp

示例11: DllMain

tBOOL __stdcall DllMain( tPTR hInstance, tDWORD dwReason, tERROR* pError ) {
	// tDWORD count;
	static OSVERSIONINFOA osvi;

	switch( dwReason ) {
		case DLL_PROCESS_ATTACH:
			{
				memset(&osvi, 0, sizeof(OSVERSIONINFOA));
				osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
				if( !GetVersionExA(&osvi) || osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
				{
					// iCheckerSA doesn't support Windows 9x
					return FALSE;
				}
			}
			break;			
		case DLL_PROCESS_DETACH:
		case DLL_THREAD_ATTACH :
		case DLL_THREAD_DETACH :
			break;

		case PRAGUE_PLUGIN_LOAD :
			g_root = (hROOT)hInstance;
			*pError = errOK;

			//resolve  my imports
			//if ( PR_FAIL(*pError=CALL_Root_ResolveImportTable(g_root,&count,import_table_variable...,PID_ICHECKERSA)) ) {
			//   PR_TRACE(( g_root, prtERROR, "cannot resolve import table for ..." ));
			//   return cFALSE;
			//}

			//register my exports
			//CALL_Root_RegisterExportTable( g_root, &count, export_table_..., PID_ICHECKERSA );

			//register my custom property ids
			//if ( PR_FAIL(*pError=CALL_Root_RegisterCustomPropId(g_root,&some_propid_variable,"some_property_name",pTYPE_DWORD)) ) {
			//  PR_TRACE(( g_root, prtERROR, "cannot register custom property ..." ));
			//  return cFALSE;
			//}

			// register my interfaces
			if ( PR_FAIL(*pError=IChecker_Register(g_root)) ) {
				PR_TRACE(( g_root, prtERROR, "cannot register \"IChecker\" interface"));
				return cFALSE;
			}
			break;

		case PRAGUE_PLUGIN_UNLOAD :
			// free system resources
			// unregister my custom property ids -- you can drop it, kernel do it by itself
			// release    my imports		         -- you can drop it, kernel do it by itself
			// unregister my exports		         -- you can drop it, kernel do it by itself
			// unregister my interfaces          -- you can drop it, kernel do it by itself
			g_root = NULL;
			break;
	}
	return cTRUE;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:58,代码来源:plugin_icheckersa.cpp

示例12: ntlm_get_version_info

void ntlm_get_version_info(NTLM_VERSION_INFO* versionInfo)
{
	OSVERSIONINFOA osVersionInfo;
	osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	GetVersionExA(&osVersionInfo);
	versionInfo->ProductMajorVersion = (UINT8) osVersionInfo.dwMajorVersion;
	versionInfo->ProductMinorVersion = (UINT8) osVersionInfo.dwMinorVersion;
	versionInfo->ProductBuild = (UINT16) osVersionInfo.dwBuildNumber;
	ZeroMemory(versionInfo->Reserved, sizeof(versionInfo->Reserved));
	versionInfo->NTLMRevisionCurrent = NTLMSSP_REVISION_W2K3;
}
开发者ID:DavBfr,项目名称:FreeRDP,代码行数:11,代码来源:ntlm_compute.c

示例13: W_IsUnicodeSystem

//--------------------------------------------------------------
BOOL WINAPI W_IsUnicodeSystem()
{
    static BOOL g_fWAPI = -2;
    if (-2 == g_fWAPI)
    {
        OSVERSIONINFOA osvi;
        osvi.dwOSVersionInfoSize = sizeof(osvi);
        GetVersionExA(&osvi);
        g_fWAPI = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId);
    }
    return g_fWAPI;
}
开发者ID:JianwenSun,项目名称:cc,代码行数:13,代码来源:uniapi.cpp

示例14: getOSInfo

void getOSInfo( char *os_info )
{
	OSVERSIONINFOEXA os;
	memset( &os, 0, sizeof(os) );
	os.dwOSVersionInfoSize = sizeof(os);
	if( GetVersionExA( (OSVERSIONINFOA *)&os ) )
	{
		sprintf( os_info, "%d.%d.%d sp %d.%d",
			os.dwMajorVersion, os.dwMinorVersion, os.dwBuildNumber,
			(int)os.wServicePackMajor, (int)os.wServicePackMinor );
	}
	else log_error( LOG_ERROR, "GetVersionExA(): error!\n" );
}
开发者ID:minlexx,项目名称:l2-unlegits,代码行数:13,代码来源:HWID.cpp

示例15: mork_fileflush

void mork_fileflush(FILE * file)
{
  fflush(file);
#ifndef WINCE
  OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) };
  if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS))
  {
    // Win9x/ME
    int fd = fileno(file);
    HANDLE fh = (HANDLE)_get_osfhandle(fd);
    FlushFileBuffers(fh);
  }
#endif
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:14,代码来源:morkFile.cpp


注:本文中的GetVersionExA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。