这篇教程C++ GetVersionEx函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetVersionEx函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVersionEx函数的具体用法?C++ GetVersionEx怎么用?C++ GetVersionEx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetVersionEx函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ShowOpenDirectoryDialogString ShowOpenDirectoryDialog(){ String ret; bool pathSelected = false; // check current OS version OSVERSIONINFO osvi; memset(&osvi, 0, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx(&osvi) && (osvi.dwMajorVersion >= 6)) { // for Vista or later, use the MSDN-preferred implementation of the Open File dialog in pick folders mode IFileDialog *pfd; if (SUCCEEDED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd)))) { // configure the dialog to Select Folders only DWORD dwOptions; if (SUCCEEDED(pfd->GetOptions(&dwOptions))) { pfd->SetOptions(dwOptions | FOS_PICKFOLDERS | FOS_DONTADDTORECENT); if (SUCCEEDED(pfd->Show(GetActiveWindow()))) { IShellItem *psi; if (SUCCEEDED(pfd->GetResult(&psi))) { LPWSTR lpwszName = NULL; if (SUCCEEDED(psi->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, (LPWSTR*) &lpwszName))) { // Add directory path to the result //ConvertToUnixPath(pathName); ret = lpwszName; pathSelected = true; ::CoTaskMemFree(lpwszName); } psi->Release(); } } } pfd->Release(); } } else { // for XP, use the old-styled SHBrowseForFolder() implementation BROWSEINFO bi = {0}; bi.hwndOwner = GetActiveWindow(); bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); if (pidl != 0) { TCHAR szFile[MAX_PATH]; szFile[0] = 0; if (SHGetPathFromIDList(pidl, szFile)) { // Add directory path to the result //ConvertToUnixPath(pathName); ret = szFile; pathSelected = true; } IMalloc* pMalloc = NULL; SHGetMalloc(&pMalloc); if (pMalloc) { pMalloc->Free(pidl); pMalloc->Release(); } } } return ret;}
开发者ID:AlienX,项目名称:zephyros,代码行数:79,
示例2: defined// Big messy function to figure out the default config file/path,// depending on the OS.// TODO: For easier portability, stuff like that should probably// be put somewhere collectively...UString ConfigManager::getDefaultConfigFile() { UString file;#if defined(WIN32) #warning getDefaultConfigFile WIN32 needs testing // Windows: Huge fucking mess char configFile[MAXPATHLEN]; OSVERSIONINFO win32OsVersion; ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO)); win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&win32OsVersion); // Check for non-9X version of Windows. if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) { // Use the Application Data directory of the user profile. if (win32OsVersion.dwMajorVersion >= 5) { if (!GetEnvironmentVariable("APPDATA", configFile, sizeof(configFile))) error("Unable to access application data directory"); } else { if (!GetEnvironmentVariable("USERPROFILE", configFile, sizeof(configFile))) error("Unable to access user profile directory"); strcat(configFile, "//Application Data"); CreateDirectory(configFile, 0); } strcat(configFile, "//xoreos"); CreateDirectory(configFile, 0); strcat(configFile, "//" DEFAULT_CONFIG_FILE); FILE *tmp = 0; if ((tmp = fopen(configFile, "r")) == 0) { // Check windows directory char oldConfigFile[MAXPATHLEN]; GetWindowsDirectory(oldConfigFile, MAXPATHLEN); strcat(oldConfigFile, "//" DEFAULT_CONFIG_FILE); if ((tmp = fopen(oldConfigFile, "r"))) { strcpy(configFile, oldConfigFile); fclose(tmp); } } else { fclose(tmp); } } else { // Check windows directory GetWindowsDirectory(configFile, MAXPATHLEN); strcat(configFile, "//" DEFAULT_CONFIG_FILE); } file = configFile;#elif defined(MACOSX) // Mac OS X: Home directory const char *dir = getenv("HOME"); if (dir) { file = dir; file += "/"; } file += DEFAULT_CONFIG_FILE;#elif defined(UNIX) // Default Unixoid: XDG_CONFIG_HOME const char *dir = getenv("XDG_CONFIG_HOME"); if (dir) { file = dir; file += "/"; } else if ((dir = getenv("HOME"))) { file = dir; file += "/.config/"; } file += DEFAULT_CONFIG_FILE;#else // Fallback: Current directory file = DEFAULT_CONFIG_FILE;#endif return file;}
开发者ID:Hellzed,项目名称:xoreos,代码行数:84,
示例3: void/** get uname for windows **/char *getuname(){ int ret_size = OS_SIZE_1024 -2; char *ret = NULL; char os_v[128 +1]; typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); /* Extracted from ms web site * http://msdn.microsoft.com/library/en-us/sysinfo/base/getting_the_system_version.asp */ OSVERSIONINFOEX osvi; SYSTEM_INFO si; PGNSI pGNSI; PGPI pGPI; BOOL bOsVersionInfoEx; DWORD dwType; ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if(!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO *)&osvi)) return(NULL); } /* Allocating the memory */ os_calloc(OS_SIZE_1024 +1, sizeof(char), ret); ret[OS_SIZE_1024] = '/0'; switch(osvi.dwPlatformId) { /* Test for the Windows NT product family. */ case VER_PLATFORM_WIN32_NT: if(osvi.dwMajorVersion == 6) { if(osvi.dwMinorVersion == 0) { if(osvi.wProductType == VER_NT_WORKSTATION ) strncat(ret, "Microsoft Windows Vista ", ret_size -1); else { strncat(ret, "Microsoft Windows Server 2008 ", ret_size -1); } } else if(osvi.dwMinorVersion == 1) { if(osvi.wProductType == VER_NT_WORKSTATION ) strncat(ret, "Microsoft Windows 7 ", ret_size -1); else { strncat(ret, "Microsoft Windows Server 2008 R2 ", ret_size -1); } } else if(osvi.dwMinorVersion == 2) { if(osvi.wProductType == VER_NT_WORKSTATION ) strncat(ret, "Microsoft Windows 8 ", ret_size -1); else { strncat(ret, "Microsoft Windows Server 2012 ", ret_size -1); } } else if(osvi.dwMinorVersion == 3) { if(osvi.wProductType == VER_NT_WORKSTATION ) strncat(ret, "Microsoft Windows 8.1 ", ret_size -1); else { strncat(ret, "Microsoft Windows Server 2012 R2 ", ret_size -1); } } ret_size-=strlen(ret) +1; /* Getting product version. */ pGPI = (PGPI) GetProcAddress( GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); pGPI( 6, 0, 0, 0, &dwType); switch(dwType) { case PRODUCT_UNLICENSED: strncat(ret, PRODUCT_UNLICENSED_C, ret_size -1); break; case PRODUCT_BUSINESS: strncat(ret, PRODUCT_BUSINESS_C, ret_size -1); break; case PRODUCT_BUSINESS_N: strncat(ret, PRODUCT_BUSINESS_N_C, ret_size -1); break; case PRODUCT_CLUSTER_SERVER://.........这里部分代码省略.........
开发者ID:Ar0xA,项目名称:ossec-hids,代码行数:101,
示例4: SemOpintSemOp(int semid, struct sembuf *semopbuf, DWORD procid, int piid, IPCT *ipct){ int i; BOOL ret; DWORD dwret; HANDLE hsem;#ifndef TERMINAL_SERVICE char semstr[16];#else char semstr[30];#endif /* TERMINAL_SERVICE */#ifndef TERMINAL_SERVICE MakeSemstr(semstr, semopbuf->sem_num, semid, ipct->semt[semid].key);#else OSVERSIONINFOEX osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if( !GetVersionEx ((OSVERSIONINFO *) &osvi) ) { // If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); GetVersionEx( (OSVERSIONINFO *) &osvi ); } if( osvi.dwMajorVersion >= 5 ) /* Windows 2000 */ MakeGlobalSemstr(semstr, semopbuf->sem_num, semid, ipct->semt[semid].key); else MakeSemstr(semstr, semopbuf->sem_num, semid, ipct->semt[semid].key);#endif /* TERMINAL_SERVICE */ hsem=OpenSemaphore(SEMAPHORE_ALL_ACCESS, TRUE, semstr); if (hsem==NULL) { errno=GetLastError(); return -1; } if (semopbuf->sem_op<0) { if (ipct->semb[semid][semopbuf->sem_num].semval >= abs((int)semopbuf->sem_op)) ipct->semb[semid][semopbuf->sem_num].semncnt++; if (ipct->semb[semid][semopbuf->sem_num].semval < abs((int)semopbuf->sem_op)) { if (semopbuf->sem_flg & IPC_NOWAIT) { ipct->semb[semid][semopbuf->sem_num].sempid=procid; CloseHandle(hsem); return 0; } } for (i=0; i<abs((int)semopbuf->sem_op); i++) {/************** do { dwret=MsgWaitForMultipleObjects(1, &hsem, FALSE, INFINITE, QS_SENDMESSAGE|QS_POSTMESSAGE|QS_TIMER);***************/ dwret=WaitForSingleObject(hsem, INFINITE); switch (dwret) {/***************** case WAIT_OBJECT_0 + 1 : if (l_peekmessage()<0) { CloseHandle(hsem); return -1; } break;*****************/ case WAIT_OBJECT_0 :/* by KJC 98.09.24 ************************************** ipct->semb[semid][semopbuf->sem_num].semval--;***********************************************************/ InterlockedDecrement(&ipct->semb[semid][semopbuf->sem_num].semval);/***********************************************************/ break; case WAIT_TIMEOUT : case WAIT_FAILED : errno=GetLastError(); default : CloseHandle(hsem); return -1; }/*************** } while (dwret==(WAIT_OBJECT_0 + 1));***************/ if (semopbuf->sem_flg & SEM_UNDO) {//.........这里部分代码省略.........
开发者ID:nawhizz,项目名称:KAIT,代码行数:101,
示例5: findDriver //--------------------------------------------------------------------- D3D9Device* D3D9DeviceManager::selectDevice(D3D9RenderWindow* renderWindow, D3D9RenderWindowList& renderWindowsGroup) { D3D9RenderSystem* renderSystem = static_cast<D3D9RenderSystem*>(Root::getSingleton().getRenderSystem()); D3D9Device* renderDevice = NULL; IDirect3D9* direct3D9 = D3D9RenderSystem::getDirect3D9(); UINT nAdapterOrdinal = D3DADAPTER_DEFAULT; D3DDEVTYPE devType = D3DDEVTYPE_HAL; DWORD extraFlags = 0; D3D9DriverList* driverList = renderSystem->getDirect3DDrivers(); bool nvAdapterFound = false; // Default group includes at least the given render window. renderWindowsGroup.push_back(renderWindow); // Case we use nvidia performance HUD, override the device settings. if (renderWindow->isNvPerfHUDEnable()) { // Look for 'NVIDIA NVPerfHUD' adapter (<= v4) // or 'NVIDIA PerfHUD' (v5) // If it is present, override default settings for (UINT adapter=0; adapter < direct3D9->GetAdapterCount(); ++adapter) { D3D9Driver* currDriver = driverList->item(adapter); const D3DADAPTER_IDENTIFIER9& currAdapterIdentifier = currDriver->getAdapterIdentifier(); if(strstr(currAdapterIdentifier.Description, "PerfHUD") != NULL) { renderDevice = NULL; nAdapterOrdinal = adapter; renderSystem->mActiveD3DDriver = currDriver; devType = D3DDEVTYPE_REF; nvAdapterFound = true; break; } } } // No special adapter should be used. if (nvAdapterFound == false) { renderSystem->mActiveD3DDriver = findDriver(renderWindow); nAdapterOrdinal = renderSystem->mActiveD3DDriver->getAdapterNumber(); bool bTryUsingMultiheadDevice = false; if (renderWindow->isFullScreen()) { bTryUsingMultiheadDevice = true; if (renderSystem->getMultiheadUse() == D3D9RenderSystem::mutAuto) { OSVERSIONINFO osVersionInfo; osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); // Case version info failed -> assume we run on XP. if (FALSE == GetVersionEx(&osVersionInfo)) { osVersionInfo.dwMajorVersion = 5; } // XP and below - multi-head will cause artifacts when vsync is on. if (osVersionInfo.dwMajorVersion <= 5 && renderWindow->isVSync()) { bTryUsingMultiheadDevice = false; LogManager::getSingleton().logMessage("D3D9 : Multi head disabled. It causes horizontal line when used in XP + VSync combination"); } // Vista and SP1 or SP2 - multi-head device can not be reset - it causes memory corruption. if (osVersionInfo.dwMajorVersion == 6 && (_stricmp(osVersionInfo.szCSDVersion, "Service Pack 1") == 0 || _stricmp(osVersionInfo.szCSDVersion, "Service Pack 2") == 0)) { bTryUsingMultiheadDevice = false; LogManager::getSingleton().logMessage("D3D9 : Multi head disabled. It causes application run time crashes when used in Vista + SP 1 or 2 combination"); } } else { bTryUsingMultiheadDevice = renderSystem->getMultiheadUse() == D3D9RenderSystem::mutYes ? true : false; } } // Check if we can create a group of render windows // on the same device using the multi-head feature. if (bTryUsingMultiheadDevice) { const D3DCAPS9& targetAdapterCaps = renderSystem->mActiveD3DDriver->getD3D9DeviceCaps(); D3DCAPS9 masterAdapterCaps; // Find the master device caps. if (targetAdapterCaps.MasterAdapterOrdinal == targetAdapterCaps.AdapterOrdinal) { masterAdapterCaps = targetAdapterCaps; } else {//.........这里部分代码省略.........
开发者ID:JoeyZh,项目名称:ogre-android,代码行数:101,
示例6: LoadSecurityDllHMODULE LoadSecurityDll(loginfo_t* logger) { HMODULE hModule; BOOL fAllFunctionsLoaded = FALSE; TCHAR lpszDLL[MAX_PATH]; OSVERSIONINFO VerInfo; // // Find out which security DLL to use, depending on // whether we are on NT or Win95 or 2000 or XP or Windows Server 2003 // We have to use security.dll on Windows NT 4.0. // All other operating systems, we have to use Secur32.dll // VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (!GetVersionEx (&VerInfo)) // If this fails, something has gone wrong { shaj_log_error(logger, "problem determining windows version"); return FALSE; } if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && VerInfo.dwMajorVersion == 4 && VerInfo.dwMinorVersion == 0) { lstrcpy (lpszDLL, _T("security.dll")); } else { lstrcpy (lpszDLL, _T("secur32.dll")); } hModule = LoadLibrary(lpszDLL); if (!hModule) { shaj_log_error(logger, "problem loading %s", (char*)lpszDLL); return NULL; } __try { _AcceptSecurityContext = (ACCEPT_SECURITY_CONTEXT_FN) GetProcAddress(hModule, "AcceptSecurityContext"); if (!_AcceptSecurityContext) { shaj_log_error(logger, "problem with function AcceptSecurityContext"); __leave; }#ifdef UNICODE _AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(hModule, "AcquireCredentialsHandleW");#else _AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(hModule, "AcquireCredentialsHandleA");#endif if (!_AcquireCredentialsHandle) { shaj_log_error(logger, "problem with function AcquireCredentialsHandle"); __leave; } // CompleteAuthToken is not present on Windows 9x Secur32.dll // Do not check for the availablity of the function if it is NULL; _CompleteAuthToken = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(hModule, "CompleteAuthToken"); _DeleteSecurityContext = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(hModule, "DeleteSecurityContext"); if (!_DeleteSecurityContext) { shaj_log_error(logger, "problem with function DeleteSecurityContext"); __leave; } _FreeContextBuffer = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(hModule, "FreeContextBuffer"); if (!_FreeContextBuffer) { shaj_log_error(logger, "problem with function FreeContextBuffer"); __leave; } _FreeCredentialsHandle = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(hModule, "FreeCredentialsHandle"); if (!_FreeCredentialsHandle) { shaj_log_error(logger, "problem with function FreeCredentialsHandle"); __leave; }#ifdef UNICODE _InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(hModule, "InitializeSecurityContextW");#else _InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(hModule, "InitializeSecurityContextA");#endif if (!_InitializeSecurityContext) { shaj_log_error(logger, "problem with function InitializeSecurityContext"); __leave; }#ifdef UNICODE _QuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN) GetProcAddress(hModule, "QuerySecurityPackageInfoW");//.........这里部分代码省略.........
开发者ID:jirutka,项目名称:shaj,代码行数:101,
示例7: GetWinVer///////////////////////////////////////////////////////////////////////////////// GetWinVerBOOL GetWinVer(LPTSTR pszVersion, int *nVersion, LPTSTR pszMajorMinorBuild){ if (!pszVersion || !nVersion || !pszMajorMinorBuild) return FALSE; lstrcpy(pszVersion, WUNKNOWNSTR); *nVersion = WUNKNOWN; OSVERSIONINFO osinfo; osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO*)&osinfo)) return FALSE; DWORD dwPlatformId = osinfo.dwPlatformId; DWORD dwMinorVersion = osinfo.dwMinorVersion; DWORD dwMajorVersion = osinfo.dwMajorVersion; DWORD dwBuildNumber = osinfo.dwBuildNumber & 0xFFFF; // Win 95 needs this wsprintf(pszMajorMinorBuild, _T("%u.%u.%u"), dwMajorVersion, dwMinorVersion, dwBuildNumber); if ((dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && (dwMajorVersion == 4)) { if ((dwMinorVersion < 10) && (dwBuildNumber == 950)) { lstrcpy(pszVersion, W95STR); *nVersion = W95; } else if ((dwMinorVersion < 10) && ((dwBuildNumber > 950) && (dwBuildNumber <= 1080))) { lstrcpy(pszVersion, W95SP1STR); *nVersion = W95SP1; } else if ((dwMinorVersion < 10) && (dwBuildNumber > 1080)) { lstrcpy(pszVersion, W95OSR2STR); *nVersion = W95OSR2; } else if ((dwMinorVersion == 10) && (dwBuildNumber == 1998)) { lstrcpy(pszVersion, W98STR); *nVersion = W98; } else if ((dwMinorVersion == 10) && ((dwBuildNumber > 1998) && (dwBuildNumber < 2183))) { lstrcpy(pszVersion, W98SP1STR); *nVersion = W98SP1; } else if ((dwMinorVersion == 10) && (dwBuildNumber >= 2183)) { lstrcpy(pszVersion, W98SESTR); *nVersion = W98SE; } else if (dwMinorVersion == 90) { lstrcpy(pszVersion, WMESTR); *nVersion = WME; } } else if (dwPlatformId == VER_PLATFORM_WIN32_NT) { if ((dwMajorVersion == 3) && (dwMinorVersion == 51)) { lstrcpy(pszVersion, WNT351STR); *nVersion = WNT351; } else if ((dwMajorVersion == 4) && (dwMinorVersion == 0)) { lstrcpy(pszVersion, WNT4STR); *nVersion = WNT4; } else if ((dwMajorVersion == 5) && (dwMinorVersion == 0)) { lstrcpy(pszVersion, W2KSTR); *nVersion = W2K; } else if ((dwMajorVersion == 5) && (dwMinorVersion == 1)) { lstrcpy(pszVersion, WXPSTR); *nVersion = WXP; } else if ((dwMajorVersion == 5) && (dwMinorVersion == 2)) { lstrcpy(pszVersion, W2003SERVERSTR); *nVersion = W2003SERVER; } else if ((dwMajorVersion == 6) && (dwMinorVersion == 0)) { lstrcpy(pszVersion, WVISTASTR); *nVersion = WVISTA; } else if ((dwMajorVersion == 6) && (dwMinorVersion == 1)) { lstrcpy(pszVersion, WWIN7STR); *nVersion = WWIN7; } }//.........这里部分代码省略.........
开发者ID:zhangf911,项目名称:GCEDemo,代码行数:101,
示例8: OS/*! Fills /c buff with a string describing the current OS (including version) /return 0 on success, 1 if buffer too small, -1 if failed to determine OS version /author jfpatry /date Created: 2000-10-30 /date Modified: 2000-10-30*/int get_os_version( char *buff, int size ){#ifdef WIN32 /* Win32 Version */ /* See http://www.mvps.org/vb/index2.html?tips/getversionex.htm for a table mapping OSVERSIONINFOEX entries to Windows version */ char tmp_buff[BUFF_LEN]; int tmp_buff_size = BUFF_LEN; char *ptr = tmp_buff; int len; OSVERSIONINFO osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if ( !GetVersionEx( (OSVERSIONINFO *) &osvi) ) { return -1; } switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: /* Check for NT versus 2000 */ if ( osvi.dwMajorVersion <= 4 ) { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows NT" ) ) { return -1; } } if ( osvi.dwMajorVersion == 5 ) { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows 2000" ) ) { return -1; } } /* Display version, service pack (if any), and build number. */ len = snprintf(ptr, tmp_buff_size, " version %d.%d %s (Build %d)", osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); check_assertion( len >= 0, "tmp_buff too small" ); if ( len < 0 ) { return -1; } ptr += len; tmp_buff_size -= len; break; case VER_PLATFORM_WIN32_WINDOWS: if ((osvi.dwMajorVersion > 4) || ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0))) { if ( osvi.dwMinorVersion <= 10 ) { if ( strcmp( osvi.szCSDVersion, "A" ) == 0 ) { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows 98 SE") ) { return -1; } } else { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows 98") ) { return -1; } } } else { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows ME") ) { return -1; } } } else { if ( strcmp( osvi.szCSDVersion, "B" ) == 0 ) { if ( !append_to_buff( &ptr, &tmp_buff_size, "Microsoft Windows 95 OSR2") )//.........这里部分代码省略.........
开发者ID:FeeJai,项目名称:Tux-Racer-4-iOS,代码行数:101,
示例9: ZeroMemorybool PerfCounterMuninNodePlugin::OpenCounter(){ PDH_STATUS status; m_Name = m_SectionName.substr(strlen(PerfCounterMuninNodePlugin::SectionPrefix)); OSVERSIONINFO osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx(&osvi) || (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)) { _Module.LogError("PerfCounter plugin: %s: unknown OS or not NT based", m_Name.c_str()); return false; //unknown OS or not NT based } // Create a PDH query status = PdhOpenQuery(NULL, 0, &m_PerfQuery); if (status != ERROR_SUCCESS) { _Module.LogError("PerfCounter plugin: %s: PdhOpenQuery error=%x", m_Name.c_str(), status); return false; } TString objectName = A2TConvert(g_Config.GetValue(m_SectionName, "Object", "LogicalDisk")); TString counterName = A2TConvert(g_Config.GetValue(m_SectionName, "Counter", "% Disk Time")); DWORD counterListLength = 0; DWORD instanceListLength = 0; if (g_Config.GetValueB(m_SectionName, "UseEnglishObjectNames", true)) { counterName = GetPdhCounterLocalizedName(counterName.c_str()); objectName = GetPdhCounterLocalizedName(objectName.c_str()); } status = PdhEnumObjectItems(NULL, NULL, objectName.c_str(), NULL, &counterListLength, NULL, &instanceListLength, PERF_DETAIL_EXPERT, 0); if (status != PDH_MORE_DATA) { _Module.LogError("PerfCounter plugin: %s: PdhEnumObjectItems error=%x", m_Name.c_str(), status); return false; } TCHAR *counterList = new TCHAR[counterListLength+2]; TCHAR *instanceList = new TCHAR[instanceListLength+2]; counterList[0] = NULL; instanceList[0] = NULL; counterList[1] = NULL; instanceList[1] = NULL; status = PdhEnumObjectItems(NULL, NULL, objectName.c_str(), counterList, &counterListLength, instanceList, &instanceListLength, PERF_DETAIL_EXPERT, 0); if (status != ERROR_SUCCESS) { delete [] counterList; delete [] instanceList; _Module.LogError("PerfCounter plugin: %s: PdhEnumObjectItems error=%x", m_Name.c_str(), status); return false; } int pos = 0; TCHAR *instanceName = instanceList; while (instanceName[0] != NULL) { std::string counterInstanceName = T2AConvert(instanceName); m_CounterNames.push_back(counterInstanceName); while (instanceName[0] != NULL) instanceName++; instanceName++; } delete [] counterList; delete [] instanceList; TCHAR counterPath[MAX_PATH] = {0}; HCOUNTER counterHandle; if (!m_CounterNames.empty()) { if (g_Config.GetValueB(m_SectionName, "DropTotal", true)) { assert(m_CounterNames.back().compare("_Total") == 0); // We drop the last instance name as it is _Total m_CounterNames.pop_back(); } for (size_t i = 0; i < m_CounterNames.size(); i++) { TString instanceNameStr = A2TConvert(m_CounterNames[i]); _sntprintf(counterPath, MAX_PATH, _T("//%s(%s)//%s"), objectName.c_str(), instanceNameStr.c_str(), counterName.c_str()); // Associate the uptime counter with the query status = PdhAddCounter(m_PerfQuery, counterPath, 0, &counterHandle); if (status != ERROR_SUCCESS) { _Module.LogError("PerfCounter plugin: %s: PDH add counter error=%x", m_Name.c_str(), status); return false; } m_Counters.push_back(counterHandle); } } else { // A counter with a single instance (Uptime for example) m_CounterNames.push_back("0"); _sntprintf(counterPath, MAX_PATH, _T("//%s//%s"), objectName.c_str(), counterName.c_str()); // Associate the uptime counter with the query status = PdhAddCounter(m_PerfQuery, counterPath, 0, &counterHandle); if (status != ERROR_SUCCESS) { _Module.LogError("PerfCounter plugin: %s: PDH add counter error=%x", m_Name.c_str(), status); return false; } m_Counters.push_back(counterHandle); } // Collect init data status = PdhCollectQueryData(m_PerfQuery);//.........这里部分代码省略.........
开发者ID:NoICE,项目名称:munin-node-win32,代码行数:101,
示例10: definedQString OSInfo::getOSDisplayableVersion() {#if defined(Q_OS_WIN) QString osdispver; OSVERSIONINFOEXW ovi; memset(&ovi, 0, sizeof(ovi)); ovi.dwOSVersionInfoSize = sizeof(ovi); if (!GetVersionEx(reinterpret_cast<OSVERSIONINFOW *>(&ovi))) { return QString(); } _SYSTEM_INFO si; GetNativeSystemInfo(&si); if (ovi.dwMajorVersion >= 6) { if (ovi.dwMajorVersion == 10) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows 10"); } else { osdispver = QLatin1String("Windows 10 Server"); } } else if (ovi.dwMajorVersion == 6) { if (ovi.dwMinorVersion == 0) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows Vista"); } else { osdispver = QLatin1String("Windows Server 2008"); } } else if (ovi.dwMinorVersion == 1) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows 7"); } else { osdispver = QLatin1String("Windows Server 2008 R2"); } } else if (ovi.dwMinorVersion == 2) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows 8"); } else { osdispver = QLatin1String("Windows Server 2012"); } } else if (ovi.dwMinorVersion == 3) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows 8.1"); } else { osdispver = QLatin1String("Windows Server 2012 R2"); } } else if (ovi.dwMinorVersion == 4) { if (ovi.wProductType == VER_NT_WORKSTATION) { osdispver = QLatin1String("Windows 10"); } else { osdispver = QLatin1String("Windows 10 Server"); } } } typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); PGPI pGetProductInfo = (PGPI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); if (pGetProductInfo == NULL) { return QString(); } DWORD dwType = 0; if (!pGetProductInfo(ovi.dwMajorVersion, ovi.dwMinorVersion, 0, 0, &dwType)) { return QString(); } switch(dwType) { case PRODUCT_ULTIMATE: osdispver.append(QLatin1String(" Ultimate Edition")); break; case PRODUCT_PROFESSIONAL: osdispver.append(QLatin1String(" Professional")); break; case PRODUCT_HOME_PREMIUM: osdispver.append(QLatin1String(" Home Premium Edition")); break; case PRODUCT_HOME_BASIC: osdispver.append(QLatin1String(" Home Basic Edition")); break; case PRODUCT_ENTERPRISE: osdispver.append(QLatin1String(" Enterprise Edition")); break; case PRODUCT_BUSINESS: osdispver.append(QLatin1String(" Business Edition")); break; case PRODUCT_STARTER: osdispver.append(QLatin1String(" Starter Edition")); break; case PRODUCT_CLUSTER_SERVER: osdispver.append(QLatin1String(" Cluster Server Edition")); break; case PRODUCT_DATACENTER_SERVER: osdispver.append(QLatin1String(" Datacenter Edition")); break; case PRODUCT_DATACENTER_SERVER_CORE: osdispver.append(QLatin1String(" Datacenter Edition (core installation)")); break; case PRODUCT_ENTERPRISE_SERVER: osdispver.append(QLatin1String(" Enterprise Edition")); break;//.........这里部分代码省略.........
开发者ID:Githlar,项目名称:mumble,代码行数:101,
示例11: QStringQString OSInfo::getOSVersion() { static QString qsCached; if (! qsCached.isNull()) return qsCached.isEmpty() ? QString() : qsCached; QString os;#if defined(Q_OS_WIN) OSVERSIONINFOEXW ovi; memset(&ovi, 0, sizeof(ovi)); ovi.dwOSVersionInfoSize=sizeof(ovi); if (!GetVersionEx(reinterpret_cast<OSVERSIONINFOW *>(&ovi))) { return QString(); } os.sprintf("%d.%d.%d.%d", ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber, (ovi.wProductType == VER_NT_WORKSTATION) ? 1 : 0);#elif defined(Q_OS_MAC) SInt32 major, minor, bugfix; OSErr err = Gestalt(gestaltSystemVersionMajor, &major); if (err == noErr) err = Gestalt(gestaltSystemVersionMinor, &minor); if (err == noErr) err = Gestalt(gestaltSystemVersionBugFix, &bugfix); if (err != noErr) return QString::number(QSysInfo::MacintoshVersion, 16); const NXArchInfo *local = NXGetLocalArchInfo(); const NXArchInfo *ai = local ? NXGetArchInfoFromCpuType(local->cputype, CPU_SUBTYPE_MULTIPLE) : NULL; const char *arch = ai ? ai->name : "unknown"; os.sprintf("%i.%i.%i (%s)", major, minor, bugfix, arch);#else#ifdef Q_OS_LINUX QProcess qp; QStringList args; args << QLatin1String("-s"); args << QLatin1String("-d"); qp.start(QLatin1String("lsb_release"), args); if (qp.waitForFinished(5000)) { os = QString::fromUtf8(qp.readAll()).simplified(); if (os.startsWith(QLatin1Char('"')) && os.endsWith(QLatin1Char('"'))) os = os.mid(1, os.length() - 2).trimmed(); } if (os.isEmpty()) qWarning("OSInfo: Failed to execute lsb_release"); qp.terminate(); if (! qp.waitForFinished(1000)) qp.kill();#endif if (os.isEmpty()) { struct utsname un; if (uname(&un) == 0) { os.sprintf("%s %s", un.sysname, un.release); } }#endif if (! os.isNull()) qsCached = os; else qsCached = QLatin1String(""); return qsCached;}
开发者ID:Githlar,项目名称:mumble,代码行数:67,
示例12: memsetLONG CMirageManager::SetupDriver(CRegKey& regKeyDevice, DISPLAY_DEVICE& deviceInfo, Esc_dmf_Qvi_OUT& qvi_out){ DFEXT_DEVMODE deviceMode; memset(&deviceMode, 0, sizeof(deviceMode)); deviceMode.dmSize = sizeof(DEVMODE); WORD drvExtraSaved = deviceMode.dmDriverExtra; memset(&deviceMode, 0, sizeof(DEVMODE)); deviceMode.dmSize = sizeof(DEVMODE); deviceMode.dmDriverExtra = drvExtraSaved; POINTL pos; pos.x = pos.y = 0; deviceMode.dmPelsWidth = 100; deviceMode.dmPelsHeight = 100; deviceMode.dmBitsPerPel = 32; deviceMode.dmPosition = pos; deviceMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_POSITION; deviceMode.dmDeviceName[0] = '/0'; CMirageManager::WriteDiagnostics(_T("Attaching to desktop")); LONG retval = regKeyDevice.SetDWORDValue(_T("Attach.ToDesktop"), true); if (ERROR_SUCCESS != retval) { CMirageManager::WriteDiagnostics(_T("Failed to attach to desktop")); return retval; } CMirageManager::WriteDiagnostics(_T("Committing display changes")); retval = CMirageManager::CommitDisplayChanges(&deviceMode, deviceInfo); if (ERROR_SUCCESS != retval) { CMirageManager::WriteDiagnostics(_T("Failed to commit display changes")); return retval; } CMirageManager::WriteDiagnostics(_T("Creating device context")); HDC driverDC; driverDC = CreateDC(deviceInfo.DeviceName, NULL, NULL, NULL); if (!driverDC) { CMirageManager::WriteDiagnostics(_T("Failed to create device context")); return ERROR_DC_NOT_FOUND; } CMirageManager::WriteDiagnostics(_T("Querying Driver Version")); Esc_dmf_Qvi_IN qvi_in; qvi_in.cbSize = sizeof(qvi_in); qvi_in.app_actual_version = DMF_PROTO_VER_CURRENT; qvi_in.display_minreq_version = DMF_PROTO_VER_MINCOMPAT; qvi_in.connect_options = 0; qvi_out.cbSize = sizeof(qvi_out); ExtEscape(driverDC, ESC_QVI, sizeof(qvi_in), (LPSTR) &qvi_in, sizeof(qvi_out), (LPSTR) &qvi_out); std::wstringstream driverVersion(_T("")); driverVersion << _T("Driver Version : ") << BYTE3(qvi_out.display_actual_version) << _T(".") << BYTE2(qvi_out.display_actual_version) << _T(".") << BYTE1(qvi_out.display_actual_version) << _T(".") << BYTE0(qvi_out.display_actual_version) << _T(" build(") << qvi_out.display_buildno << _T(")"); CMirageManager::WriteDiagnostics(driverVersion.str()); if (driverDC) { CMirageManager::WriteDiagnostics(_T("Deleting device context")); ::DeleteDC(driverDC); driverDC = NULL; } CMirageManager::WriteDiagnostics(_T("Detaching from desktop")); retval = regKeyDevice.SetDWORDValue(_T("Attach.ToDesktop"), false); if (ERROR_SUCCESS != retval) return retval; deviceMode.dmPelsWidth = 0; deviceMode.dmPelsHeight = 0; OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); DEVMODE* pdm = NULL; if (osvi.dwMajorVersion > 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 0)) pdm = &deviceMode; CMirageManager::WriteDiagnostics(_T("Committing display changes")); retval = CommitDisplayChanges(pdm, deviceInfo); if (ERROR_SUCCESS != retval) return retval; return ERROR_SUCCESS;}
开发者ID:AsherBond,项目名称:DimSim,代码行数:91,
示例13: CadthreadDWORD WINAPI Cadthread(LPVOID lpParam){ OSVERSIONINFO OSversion; OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&OSversion); HDESK desktop=NULL; desktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | GENERIC_WRITE ); if (desktop == NULL) vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error /n")); else vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK/n")); HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId()); DWORD dummy; char new_name[256]; if (desktop) { if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy)) { vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation /n")); } vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x/n"), new_name, desktop, old_desktop); if (!SetThreadDesktop(desktop)) { vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop /n")); } } ////// if(OSversion.dwMajorVersion>=6 && vncService::RunningAsService()) { /*if (OSversion.dwMinorVersion==0) //Vista { if (ISUACENabled() && !IsSoftwareCadEnabled())//ok { } if (!ISUACENabled() && IsSoftwareCadEnabled()) { } if (!ISUACENabled() && !IsSoftwareCadEnabled()) { DWORD result=MessageBoxSecure(NULL,"UAC is Disable, make registry changes to allow cad","Warning",MB_YESNO); if (result==IDYES) { HANDLE hProcess,hPToken; DWORD id=GetExplorerLogonPid(); if (id!=0) { hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id); if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY |TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID |TOKEN_READ|TOKEN_WRITE,&hPToken)) return 0; char dir[MAX_PATH]; char exe_file_name[MAX_PATH]; GetModuleFileName(0, exe_file_name, MAX_PATH); strcpy(dir, exe_file_name); strcat(dir, " -softwarecadhelper"); STARTUPINFO StartUPInfo; PROCESS_INFORMATION ProcessInfo; HANDLE Token=NULL; HANDLE process=NULL; ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO)); ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION)); StartUPInfo.wShowWindow = SW_SHOW; StartUPInfo.lpDesktop = "Winsta0//Default"; StartUPInfo.cb = sizeof(STARTUPINFO); CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo); DWORD errorcode=GetLastError(); if (process) CloseHandle(process); if (Token) CloseHandle(Token); if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess); if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread); if (errorcode==1314) { Enable_softwareCAD_elevated(); } } } } if (ISUACENabled() && IsSoftwareCadEnabled()) {//.........这里部分代码省略.........
开发者ID:polyu,项目名称:Cloud_Game,代码行数:101,
示例14: mainint __cdecl main(int argc, char *argv[]) { OSVERSIONINFO TheVersionInfo; OSVERSIONINFO* pVersionInfo = &TheVersionInfo; /* * Initialize the PAL and return FAILURE if this fails */ if(0 != (PAL_Initialize(argc, argv))) { return FAIL; } /* This needs to be done before using GetVersionEx */ pVersionInfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO); /* If GetVersionEx fails, then the test fails */ if(GetVersionEx(pVersionInfo) == 0) { Fail("ERROR: The GetVersionEx function returned 0, which indicates " "failure."); } /* These values are fixed, ensure they're set properly */ if(pVersionInfo->dwMajorVersion != 5) { Fail("ERROR: The fixed value of dwMajorVersion shoud be 5, but is " " really %d.",pVersionInfo->dwMajorVersion); } /* The minor version values for Win2k and XP are different for Win2k minor version equals 0 and for XP minor version equals 1. Both values are excepted here. */ if((pVersionInfo->dwMinorVersion != 0) && (pVersionInfo->dwMinorVersion != 1)) { Fail("ERROR: The fixed value of dwMinorVersion shoud be 0 or 1, " "but is really %d.",pVersionInfo->dwMinorVersion); } if(pVersionInfo->dwBuildNumber_PAL_Undefined < 0) { Fail("ERROR: The value of dwBuildNumber shoud be at least 0, but is " "really %d.",pVersionInfo->dwBuildNumber_PAL_Undefined); }#if !WIN32 /* Under BSD, the PlatformID should be UNIX and the Service Pack version should be set to "". */ if(pVersionInfo->dwPlatformId != VER_PLATFORM_UNIX || pVersionInfo->szCSDVersion_PAL_Undefined[0] != 0) { Fail("ERROR: The dwPlatformId should be %d but is really %d. And the " "szCSDVerion should be NULL.",VER_PLATFORM_UNIX, pVersionInfo->dwPlatformId); }#endif PAL_Terminate(); return PASS;}
开发者ID:ArildF,项目名称:masters,代码行数:68,
示例15: VBoxDisplayInitint VBoxDisplayInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread){ Log(("VBoxTray: VBoxDisplayInit .../n")); OSVERSIONINFO OSinfo; OSinfo.dwOSVersionInfoSize = sizeof (OSinfo); GetVersionEx (&OSinfo); HMODULE hUser = GetModuleHandle("user32.dll"); gCtx.pEnv = pEnv; if (NULL == hUser) { Log(("VBoxTray: VBoxDisplayInit: Could not get module handle of USER32.DLL!/n")); return VERR_NOT_IMPLEMENTED; } else if (OSinfo.dwMajorVersion >= 5) /* APIs available only on W2K and up! */ { *(uintptr_t *)&gCtx.pfnChangeDisplaySettingsEx = (uintptr_t)GetProcAddress(hUser, "ChangeDisplaySettingsExA"); Log(("VBoxTray: VBoxDisplayInit: pfnChangeDisplaySettingsEx = %p/n", gCtx.pfnChangeDisplaySettingsEx)); *(uintptr_t *)&gCtx.pfnEnumDisplayDevices = (uintptr_t)GetProcAddress(hUser, "EnumDisplayDevicesA"); Log(("VBoxTray: VBoxDisplayInit: pfnEnumDisplayDevices = %p/n", gCtx.pfnEnumDisplayDevices));#ifdef VBOX_WITH_WDDM if (OSinfo.dwMajorVersion >= 6) { /* this is vista and up, check if we need to switch the display driver if to WDDM mode */ Log(("VBoxTray: VBoxDisplayInit: this is Windows Vista and up/n")); VBOXDISPLAY_DRIVER_TYPE enmType = getVBoxDisplayDriverType (&gCtx); if (enmType == VBOXDISPLAY_DRIVER_TYPE_WDDM) { Log(("VBoxTray: VBoxDisplayInit: WDDM driver is installed, switching display driver if to WDDM mode/n")); /* this is hacky, but the most easiest way */ VBOXDISPIF_MODE enmMode = (OSinfo.dwMajorVersion > 6 || OSinfo.dwMinorVersion > 0) ? VBOXDISPIF_MODE_WDDM_W7 : VBOXDISPIF_MODE_WDDM; DWORD err = VBoxDispIfSwitchMode(const_cast<PVBOXDISPIF>(&pEnv->dispIf), enmMode, NULL /* old mode, we don't care about it */); if (err == NO_ERROR) Log(("VBoxTray: VBoxDisplayInit: DispIf switched to WDDM mode successfully/n")); else Log(("VBoxTray: VBoxDisplayInit: Failed to switch DispIf to WDDM mode, err (%d)/n", err)); } }#endif } else if (OSinfo.dwMajorVersion <= 4) /* Windows NT 4.0 */ { /* Nothing to do here yet */ } else /* Unsupported platform */ { Log(("VBoxTray: VBoxDisplayInit: Warning, display for platform not handled yet!/n")); return VERR_NOT_IMPLEMENTED; } VBOXDISPIFESCAPE_ISANYX IsAnyX = {0}; IsAnyX.EscapeHdr.escapeCode = VBOXESC_ISANYX; DWORD err = VBoxDispIfEscapeInOut(&pEnv->dispIf, &IsAnyX.EscapeHdr, sizeof (uint32_t)); if (err == NO_ERROR) gCtx.fAnyX = !!IsAnyX.u32IsAnyX; else gCtx.fAnyX = TRUE; Log(("VBoxTray: VBoxDisplayInit: Display init successful/n")); *pfStartThread = true; *ppInstance = (void *)&gCtx; return VINF_SUCCESS;}
开发者ID:etiago,项目名称:vbox,代码行数:69,
示例16: getOSVersionstd::string getOSVersion(){#ifdef _WIN32 OSVERSIONINFOEX osvi; BOOL bOsVersionInfoEx; std::string bit=IsWow64()?" 64bit":" 32bit"; // Try calling GetVersionEx using the OSVERSIONINFOEX structure. // If that fails, try using the OSVERSIONINFO structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) { osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) return "Unknown"; } switch (osvi.dwPlatformId) { // Test for the Windows NT product family. case VER_PLATFORM_WIN32_NT: // Test for the specific product. if ( osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0 ) return "Microsoft Windows 10"+bit; if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3 ) return "Microsoft Windows 8.1"+bit; if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2 ) return "Microsoft Windows 8"+bit; if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 ) return "Microsoft Windows 7"+bit; if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 ) return "Microsoft Windows Vista"+bit; if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) return "Microsoft Windows Server 2003"+bit; if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) return "Microsoft Windows XP"+bit; if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) return "Microsoft Windows 2000"; if ( osvi.dwMajorVersion <= 4 ) return "Microsoft Windows NT"; // Test for the Windows Me/98/95. case VER_PLATFORM_WIN32_WINDOWS: if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { return "Microsoft Windows 95"; } if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) { return "Microsoft Windows 98"; } if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { return "Microsoft Windows Millennium Edition"; } break; case VER_PLATFORM_WIN32s: return "Microsoft Win32s"; } return "Microsoft Windows";#elif __linux utsname u; if ( uname(&u) != 0 ) { Logger::system().warning("Error detecting linux version"); return "Unknown"; } return std::string(u.sysname) + " " + u.release + " " + u.version + " " + u.machine + "; libc version: " + gnu_get_libc_version();#else return "Unknown OS";#endif}
开发者ID:uquendo,项目名称:calc,代码行数:90,
示例17: ngx_os_initngx_int_tngx_os_init(ngx_log_t *log){ DWORD bytes; SOCKET s; WSADATA wsd; ngx_err_t err; ngx_uint_t n; SYSTEM_INFO si; /* get Windows version */ ngx_memzero(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osviex = GetVersionEx((OSVERSIONINFO *) &osvi); if (osviex == 0) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (GetVersionEx((OSVERSIONINFO *) &osvi) == 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "GetVersionEx() failed"); return NGX_ERROR; } } /* * Windows 3.1 Win32s 0xxxxx * * Windows 95 140000 * Windows 98 141000 * Windows ME 149000 * Windows NT 3.51 235100 * Windows NT 4.0 240000 * Windows NT 4.0 SP5 240050 * Windows 2000 250000 * Windows XP 250100 * Windows 2003 250200 * Windows Vista/2008 260000 * * Windows CE x.x 3xxxxx */ ngx_win32_version = osvi.dwPlatformId * 100000 + osvi.dwMajorVersion * 10000 + osvi.dwMinorVersion * 100; if (osviex) { ngx_win32_version += osvi.wServicePackMajor * 10 + osvi.wServicePackMinor; } GetSystemInfo(&si); ngx_pagesize = si.dwPageSize; ngx_ncpu = si.dwNumberOfProcessors; ngx_cacheline_size = NGX_CPU_CACHE_LINE; for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ } /* delete default "C" locale for _wcsicmp() */ setlocale(LC_ALL, ""); /* init Winsock */ if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, "WSAStartup() failed"); return NGX_ERROR; } if (ngx_win32_version < NGX_WIN_NT) { ngx_max_wsabufs = 16; return NGX_OK; } /* STUB: ngx_uint_t max */ ngx_max_wsabufs = 1024 * 1024; /* * get AcceptEx(), GetAcceptExSockAddrs(), TransmitFile(), * TransmitPackets(), ConnectEx(), and DisconnectEx() addresses */ s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP); if (s == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, ngx_socket_n " falied"); return NGX_ERROR; } if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &ax_guid, sizeof(GUID), &ngx_acceptex, sizeof(LPFN_ACCEPTEX), &bytes, NULL, NULL) == -1) { ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " "WSAID_ACCEPTEX) failed"); }//.........这里部分代码省略.........
开发者ID:AsamQi,项目名称:ghttpd,代码行数:101,
示例18: StartLocalTaskSched// HA! straight from MSDN even!long StartLocalTaskSched(){ OSVERSIONINFO osver; osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ///////////////////////////////////////////////////// // Determine which version of OS you are running. //////////////////////////////////////////////////// GetVersionEx(&osver); if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { ////////////////////////////////////////////////// // If Windows 95, check to see if Windows 95 // version of Task Scheduler is running. ////////////////////////////////////////////////// HWND hwnd = FindWindow(SCHED_CLASS, SCHED_TITLE); if (hwnd != NULL) { // It is already running. return ERROR_SUCCESS; } // Execute the task scheduler process. STARTUPINFO sui; PROCESS_INFORMATION pi; ZeroMemory(&sui, sizeof(sui)); sui.cb = sizeof (STARTUPINFO); TCHAR szApp[MAX_PATH]; LPTSTR pszPath; DWORD dwRet = SearchPath(NULL, SCHED_SERVICE_APP_NAME, NULL, MAX_PATH, szApp, &pszPath); if (dwRet == 0) { SchedError = 2; return GetLastError(); } BOOL fRet = CreateProcess(szApp, NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, NULL, NULL, &sui, &pi); if (fRet == 0) { SchedError = 1; return GetLastError(); } CloseHandle(pi.hProcess); CloseHandle(pi.hThread); return ERROR_SUCCESS; } else { ////////////////////////////////////////////////// // If not Windows 95, check to see if Windows NT // version of Task Scheduler is running. ////////////////////////////////////////////////// SC_HANDLE hSC = NULL; SC_HANDLE hSchSvc = NULL; hSC = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); if (hSC == NULL) { SchedError = 4; return GetLastError(); } hSchSvc = OpenService(hSC, SCHED_SERVICE_NAME, SERVICE_START | SERVICE_QUERY_STATUS); CloseServiceHandle(hSC); if (hSchSvc == NULL) { SchedError = 5; return GetLastError(); } SERVICE_STATUS SvcStatus; //.........这里部分代码省略.........
开发者ID:doctorjbeam,项目名称:Syslist,代码行数:101,
示例19: create_segmentsstatic int create_segments(size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in){ int err, ret; zend_shared_segment *shared_segment; int map_retries = 0; void *default_mapping_base_set[] = { 0, 0 }; void *vista_mapping_base_set[] = { (void *)0x20000000, (void *)0x21000000, (void *)0x30000000, (void *)0x31000000, (void *)0x50000000, 0 }; void **wanted_mapping_base = default_mapping_base_set; TSRMLS_FETCH(); /* Mapping retries: When Apache2 restarts, the parent process startup routine can be called before the child process is killed. In this case, the map will fail and we have to sleep some time (until the child releases the mapping object) and retry.*/ do { memfile = OpenFileMapping(FILE_MAP_WRITE, 0, create_name_with_username(ACCEL_FILEMAP_NAME)); err = GetLastError(); if (memfile == NULL) break; ret = zend_shared_alloc_reattach(requested_size, error_in); err = GetLastError(); if (ret == ALLOC_FAIL_MAPPING) { /* Mapping failed, wait for mapping object to get freed and retry */ CloseHandle(memfile); memfile = NULL; Sleep(1000*(map_retries+1)); } else { return ret; } } while(++map_retries < MAX_MAP_RETRIES); if(map_retries == MAX_MAP_RETRIES) { zend_win_error_message(ACCEL_LOG_FATAL, "Unable to open file mapping", err); *error_in = "OpenFileMapping"; return ALLOC_FAILURE; } /* creating segment here */ *shared_segments_count = 1; *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment)+sizeof(void *)); if (!*shared_segments_p) { zend_win_error_message(ACCEL_LOG_FATAL, "calloc() failed", GetLastError()); *error_in = "calloc"; return ALLOC_FAILURE; } shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *)); (*shared_segments_p)[0] = shared_segment; memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, requested_size, create_name_with_username(ACCEL_FILEMAP_NAME)); err = GetLastError(); if(memfile == NULL) { zend_win_error_message(ACCEL_LOG_FATAL, "Unable to create file mapping", err); *error_in = "CreateFileMapping"; return ALLOC_FAILURE; } /* Starting from windows Vista, heap randomization occurs which might cause our mapping base to be taken (fail to map). So under Vista, we try to map into a hard coded predefined addresses in high memory. */ if (!ZCG(accel_directives).mmap_base || !*ZCG(accel_directives).mmap_base) { do { OSVERSIONINFOEX osvi; SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (! GetVersionEx ((OSVERSIONINFO *) &osvi)) { osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) break; } GetSystemInfo(&si); /* Are we running Vista ? */ if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion == 6 ) { /* Assert that platform is 32 bit (for 64 bit we need to test a different set */ if(si.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL) DebugBreak(); wanted_mapping_base = vista_mapping_base_set; } } while (0); } else { char *s = ZCG(accel_directives).mmap_base; /* skip leading 0x, %p assumes hexdeciaml format anyway */ if (*s == '0' && *(s+1) == 'x') { s += 2; } if (sscanf(s, "%p", &default_mapping_base_set[0]) != 1) { zend_win_error_message(ACCEL_LOG_FATAL, "Bad mapping address specified in zend_optimizerplus.mmap_base", err); return ALLOC_FAILURE; } }//.........这里部分代码省略.........
开发者ID:no2key,项目名称:ZendOptimizerPlus,代码行数:101,
示例20: GetOSVersionString// Calculates the Windows OS Version and install information, and returns it as a// human-readable string. :)// (Handy function borrowed from Microsoft's MSDN Online, and reformatted to use wxString.)wxString GetOSVersionString(){ wxString retval; OSVERSIONINFOEX osvi; SYSTEM_INFO si; PGNSI pGNSI; PGPI pGPI; BOOL bOsVersionInfoEx; DWORD dwType; memzero( si ); memzero( osvi ); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) return L"GetVersionEx Error!"; // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. pGNSI = (PGNSI) GetProcAddress( GetModuleHandle(L"kernel32.dll"), "GetNativeSystemInfo" ); if(NULL != pGNSI) pGNSI( &si ); else GetSystemInfo( &si ); if ( VER_PLATFORM_WIN32_NT!=osvi.dwPlatformId || osvi.dwMajorVersion <= 4 ) return L"Unsupported Operating System!"; retval += L"Microsoft "; // Test for the specific product. if ( osvi.dwMajorVersion == 6 ) { if( osvi.dwMinorVersion == 0 ) retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows Vista " : L"Windows Server 2008 "; if ( osvi.dwMinorVersion == 1 ) retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows 7 " : L"Windows Server 2008 R2 "; pGPI = (PGPI) GetProcAddress( GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); switch( dwType ) { case PRODUCT_ULTIMATE: retval += L"Ultimate Edition"; break; case PRODUCT_HOME_PREMIUM: retval += L"Home Premium Edition"; break; case PRODUCT_HOME_BASIC: retval += L"Home Basic Edition"; break; case PRODUCT_ENTERPRISE: retval += L"Enterprise Edition"; break; case PRODUCT_BUSINESS: retval += L"Business Edition"; break; case PRODUCT_STARTER: retval += L"Starter Edition"; break; case PRODUCT_CLUSTER_SERVER: retval += L"Cluster Server Edition"; break; case PRODUCT_DATACENTER_SERVER: retval += L"Datacenter Edition"; break; case PRODUCT_DATACENTER_SERVER_CORE: retval += L"Datacenter Edition (core installation)"; break; case PRODUCT_ENTERPRISE_SERVER: retval += L"Enterprise Edition"; break; case PRODUCT_ENTERPRISE_SERVER_CORE: retval += L"Enterprise Edition (core installation)"; break; case PRODUCT_SMALLBUSINESS_SERVER: retval += L"Small Business Server"; break; case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: retval += L"Small Business Server Premium Edition"; break; case PRODUCT_STANDARD_SERVER: retval += L"Standard Edition"; break; case PRODUCT_STANDARD_SERVER_CORE: retval += L"Standard Edition (core installation)"; break; case PRODUCT_WEB_SERVER: retval += L"Web Server Edition"; break; }//.........这里部分代码省略.........
开发者ID:revel8n,项目名称:pcsx2,代码行数:101,
示例21: GetWindowsVersionDebugInfostatic void GetWindowsVersionDebugInfo(){ // Detect operating system. OSVERSIONINFO ovi; ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx(&ovi)) { LOG->Info("GetVersionEx failed!"); return; } RString Ver = ssprintf("Windows %i.%i (", ovi.dwMajorVersion, ovi.dwMinorVersion); if(ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { if(ovi.dwMinorVersion == 0) Ver += "Win95"; else if(ovi.dwMinorVersion == 10) Ver += "Win98"; else if(ovi.dwMinorVersion == 90) Ver += "WinME"; else Ver += "unknown 9x-based"; } else if(ovi.dwPlatformId == VER_PLATFORM_WIN32_NT) { if(ovi.dwMajorVersion == 4 && ovi.dwMinorVersion == 0) Ver += "WinNT 4.0"; else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 0) Ver += "Win2000"; else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 1) Ver += "WinXP"; else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 2) { Ver += "WinServer2003"; // todo: check for R2 /* if(GetSystemMetrics(SM_SERVERR2) != 0) Ver += "R2"; */ } else if(ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 0) { Ver += "Vista"; // todo: make this check work /* if(ovi.wProductType == VER_NT_WORKSTATION) Ver += "Vista"; else Ver += "WinServer2008"; */ } else if(ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 1) { Ver += "Win7"; // todo: make this check work /* if(ovi.wProductType == VER_NT_WORKSTATION) Ver += "Win7"; else Ver += "WinServer2008 R2"; */ } else if(ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 2) { Ver += "Win8"; // todo: make this check work /* if(ovi.wProductType == VER_NT_WORKSTATION) Ver += "Win7"; else Ver += "WinServer2008 R2"; */ } else Ver += "unknown NT-based"; } else Ver += "???"; Ver += ssprintf(") build %i [%s]", ovi.dwBuildNumber & 0xffff, ovi.szCSDVersion); LOG->Info("%s", Ver.c_str());}
开发者ID:AratnitY,项目名称:stepmania,代码行数:80,
示例22: InitOSVersionVOID InitOSVersion(VOID){ LONG lResult; HKEY hKey; /* Get version information */ ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); /* Build OS version string */ /* Open registry key */ lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE//Microsoft//Windows NT//CurrentVersion"), 0, KEY_QUERY_VALUE, &hKey); if (lResult == ERROR_SUCCESS) { DWORD dwSize, dwType; /* Retrieve the ProductName value */ dwSize = sizeof(szOSName); lResult = RegQueryValueEx(hKey, _T("ProductName"), NULL, &dwType, (LPBYTE)szOSName, &dwSize); /* If we have failed or the data type is unsupported... */ if (lResult != ERROR_SUCCESS || dwType != REG_SZ) { /* ... reserve size for one NULL character only! */ dwSize = sizeof(TCHAR); /* Set an error code (anything != ERROR_SUCCESS) */ lResult = ERROR_INVALID_PARAMETER; } /* NULL-terminate the string */ szOSName[(dwSize / sizeof(TCHAR)) - 1] = _T('/0'); /* Close the key */ RegCloseKey(hKey); } /* * If the registry key somehow doesn't exist or cannot be loaded, then * determine at least whether the version of Windows is either 9x or NT. */ if (lResult != ERROR_SUCCESS) { switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: { if (osvi.dwMajorVersion == 4) { if (osvi.dwMinorVersion == 0) _tcscpy(szOSName, _T("Windows 95")); else if (osvi.dwMinorVersion == 1) _tcscpy(szOSName, _T("Windows 98")); else if (osvi.dwMinorVersion == 9) _tcscpy(szOSName, _T("Windows ME")); else _tcscpy(szOSName, _T("Windows 9x")); } break; } case VER_PLATFORM_WIN32_NT: { _tcscpy(szOSName, _T("Windows NT")); break; } } }}
开发者ID:RPG-7,项目名称:reactos,代码行数:80,
示例23: vboxDispIfSwitchToWDDMstatic DWORD vboxDispIfSwitchToWDDM(PVBOXDISPIF pIf){ DWORD err = NO_ERROR; OSVERSIONINFO OSinfo; OSinfo.dwOSVersionInfoSize = sizeof (OSinfo); GetVersionEx (&OSinfo); bool bSupported = true; if (OSinfo.dwMajorVersion >= 6) { Log((__FUNCTION__": this is vista and up/n")); HMODULE hUser = GetModuleHandle("USER32"); if (hUser) { *(uintptr_t *)&pIf->modeData.wddm.pfnChangeDisplaySettingsEx = (uintptr_t)GetProcAddress(hUser, "ChangeDisplaySettingsExA"); Log((__FUNCTION__": VBoxDisplayInit: pfnChangeDisplaySettingsEx = %p/n", pIf->modeData.wddm.pfnChangeDisplaySettingsEx)); bSupported &= !!(pIf->modeData.wddm.pfnChangeDisplaySettingsEx); *(uintptr_t *)&pIf->modeData.wddm.pfnEnumDisplayDevices = (uintptr_t)GetProcAddress(hUser, "EnumDisplayDevicesA"); Log((__FUNCTION__": VBoxDisplayInit: pfnEnumDisplayDevices = %p/n", pIf->modeData.wddm.pfnEnumDisplayDevices)); bSupported &= !!(pIf->modeData.wddm.pfnEnumDisplayDevices); /* this is vista and up */ HMODULE hGdi32 = GetModuleHandle("gdi32"); if (hGdi32 != NULL) { pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc = (PFND3DKMT_OPENADAPTERFROMHDC)GetProcAddress(hGdi32, "D3DKMTOpenAdapterFromHdc"); Log((__FUNCTION__"pfnD3DKMTOpenAdapterFromHdc = %p/n", pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc)); bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc); pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName = (PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME)GetProcAddress(hGdi32, "D3DKMTOpenAdapterFromGdiDisplayName"); Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName = %p/n", pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName)); bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName); pIf->modeData.wddm.pfnD3DKMTCloseAdapter = (PFND3DKMT_CLOSEADAPTER)GetProcAddress(hGdi32, "D3DKMTCloseAdapter"); Log((__FUNCTION__": pfnD3DKMTCloseAdapter = %p/n", pIf->modeData.wddm.pfnD3DKMTCloseAdapter)); bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTCloseAdapter); pIf->modeData.wddm.pfnD3DKMTEscape = (PFND3DKMT_ESCAPE)GetProcAddress(hGdi32, "D3DKMTEscape"); Log((__FUNCTION__": pfnD3DKMTEscape = %p/n", pIf->modeData.wddm.pfnD3DKMTEscape)); bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTCloseAdapter); pIf->modeData.wddm.pfnD3DKMTInvalidateActiveVidPn = (PFND3DKMT_INVALIDATEACTIVEVIDPN)GetProcAddress(hGdi32, "D3DKMTInvalidateActiveVidPn"); Log((__FUNCTION__": pfnD3DKMTInvalidateActiveVidPn = %p/n", pIf->modeData.wddm.pfnD3DKMTInvalidateActiveVidPn)); bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTInvalidateActiveVidPn); if (!bSupported) { Log((__FUNCTION__": one of pfnD3DKMT function pointers failed to initialize/n")); err = ERROR_NOT_SUPPORTED; } } else { Log((__FUNCTION__": GetModuleHandle(gdi32) failed, err(%d)/n", GetLastError())); err = ERROR_NOT_SUPPORTED; } } else { Log((__FUNCTION__": GetModuleHandle(USER32) failed, err(%d)/n", GetLastError())); err = ERROR_NOT_SUPPORTED; } } else { Log((__FUNCTION__": can not switch to VBOXDISPIF_MODE_WDDM, because os is not Vista or upper/n")); err = ERROR_NOT_SUPPORTED; } return err;}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:73,
示例24: init_winverBOOL init_winver(void){ ZeroMemory(&osVersion, sizeof(osVersion)); osVersion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); return GetVersionEx ( (OSVERSIONINFO *) &osVersion);}
开发者ID:identity0815,项目名称:os45,代码行数:6,
示例25: init_win32ioctl/*! Initialize internal structures for CD device. */boolinit_win32ioctl (_img_private_t *env){#ifdef WIN32 OSVERSIONINFO ov;#endif#ifdef _XBOX ANSI_STRING filename; OBJECT_ATTRIBUTES attributes; IO_STATUS_BLOCK status; HANDLE hDevice; NTSTATUS error;#else unsigned int len=strlen(env->gen.source_name); char psz_win32_drive[7]; DWORD dw_access_flags;#endif cdio_debug("using winNT/2K/XP ioctl layer");#ifdef WIN32 memset(&ov,0,sizeof(OSVERSIONINFO)); ov.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&ov); if((ov.dwPlatformId==VER_PLATFORM_WIN32_NT) && (ov.dwMajorVersion>4)) dw_access_flags = GENERIC_READ|GENERIC_WRITE; /* add gen write on W2k/XP */ else dw_access_flags = GENERIC_READ;#endif if (cdio_is_device_win32(env->gen.source_name)) {#ifdef _XBOX // Use XBOX cdrom, no matter what drive letter is given. RtlInitAnsiString(&filename,"//Device//Cdrom0"); InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL); error = NtCreateFile( &hDevice, GENERIC_READ |SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); if (!NT_SUCCESS(error)) { return false; } env->h_device_handle = hDevice;#else sprintf( psz_win32_drive, "////.//%c:", env->gen.source_name[len-2] ); env->h_device_handle = CreateFile( psz_win32_drive, dw_access_flags, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if( env->h_device_handle == INVALID_HANDLE_VALUE ) { /* No good. try toggle write. */ dw_access_flags ^= GENERIC_WRITE; env->h_device_handle = CreateFile( psz_win32_drive, dw_access_flags, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (env->h_device_handle == NULL) return false; }#endif env->b_ioctl_init = true; return true; } return false;}
开发者ID:Crome,项目名称:libcdio,代码行数:89,
示例26: sizeofCGnucleusDoc::CGnucleusDoc(CGnucleusApp* pApp){ m_pApp = pApp; m_pViewConnect = NULL; m_pViewShare = NULL; m_pViewTransfers = NULL; m_pViewChat = NULL; // Mark if XP OSVERSIONINFO osv; osv.dwOSVersionInfoSize = sizeof(osv); GetVersionEx(&osv); m_RunningXP = (osv.dwMajorVersion == 5 && osv.dwMinorVersion == 1); // Load main core ConnectCore(); // Get Gnucleus version info from resource file m_GnuVersion = GetVersionInfo(); m_autCore->SetClientName("Gnucleus"); m_autCore->SetClientVersion(m_GnuVersion); m_autCore->SetClientCode("GNUC"); m_RunPath = m_autCore->GetRunPath(); // Load Meta data schemas m_autMeta->LoadSchemaDir(m_RunPath + "//Schemas"); // Load preferences m_autPrefs->LoadConfig( m_RunPath + "Data//GnuConfig.ini"); m_autPrefs->LoadBlocked( m_RunPath + "Data//GnuBlocked.net"); // Load Gnuc specific prefs m_pPrefsEx = new CPrefsEx; m_pPrefsEx->LoadPrefsEx( m_RunPath + "Data//GnuConfigEx.ini"); // Load node caches m_autCache->LoadCache(m_RunPath + "Data//GnuCache.net"); // Load web caches //m_autCache->LoadWebCache(m_RunPath + "Data//WebCache.net"); if(!m_autCache->GetWebCacheSize()) { // HARDCODED: a few default caches, sites down //m_autCache->AddWebCache("http://www.zero-g.net/gcache/gcache.php"); //m_autCache->AddWebCache("http://www.gnucleus.net/gcache/gcache.php"); } // Load update servers and check for update //m_autUpdate->AddServer("http://gnucleus.gnutelliums.com:80/update2/update.xml"); m_autUpdate->AddServer("http://www.gnucleus.com/update2/update.xml"); m_autUpdate->Check(); // Load Chat m_pChat = new CChatControl(this); // Display LAN setup dialog if(m_autPrefs->GetLanMode()) { m_autNetwork->LanModeOn(); m_autCache->LoadWebCache(m_RunPath + "Data//LanWebCache.net"); if( !(m_pApp->m_Min && !m_autPrefs->GetLanName().IsEmpty()) ) { CNetSetup NetSetup(this); NetSetup.DoModal(); } } // Start connecting if(m_pPrefsEx->m_AutoConnect) { if(m_pPrefsEx->m_ConnectGnutella) m_autCore->Connect2(NETWORK_GNUTELLA); if(m_pPrefsEx->m_ConnectG2) m_autCore->Connect2(NETWORK_G2); m_pChat->m_AutoConnect = true; } if(m_pPrefsEx->m_ForceGnuUltra) m_autNetwork->ForceUltrapeer2(true, NETWORK_GNUTELLA); if(m_pPrefsEx->m_ForceG2Hub) m_autNetwork->ForceUltrapeer2(true, NETWORK_G2);//.........这里部分代码省略.........
开发者ID:swax,项目名称:Gnucleus,代码行数:101,
示例27: request_sys_config_sysinfo/* * sys_sysinfo * ---------- * * Get system information such as computer name and OS version */DWORD request_sys_config_sysinfo(Remote *remote, Packet *packet){ Packet *response = packet_create_response(packet); CHAR computer[512], buf[512], *osName = NULL, * osArch = NULL, * osWow = NULL; DWORD res = ERROR_SUCCESS; DWORD size = sizeof(computer); OSVERSIONINFOEX v; HMODULE hKernel32; memset(&v, 0, sizeof(v)); memset(computer, 0, sizeof(computer)); memset(buf, 0, sizeof(buf)); v.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); do { // Get the computer name if (!GetComputerName(computer, &size)) { res = GetLastError(); break; } packet_add_tlv_string(response, TLV_TYPE_COMPUTER_NAME, computer); // Get the operating system version information if (!GetVersionEx((LPOSVERSIONINFO)&v)) { res = GetLastError(); break; } if (v.dwMajorVersion == 3) osName = "Windows NT 3.51"; else if (v.dwMajorVersion == 4) { if (v.dwMinorVersion == 0 && v.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) osName = "Windows 95"; else if (v.dwMinorVersion == 10) osName = "Windows 98"; else if (v.dwMinorVersion == 90) osName = "Windows ME"; else if (v.dwMinorVersion == 0 && v.dwPlatformId == VER_PLATFORM_WIN32_NT) osName = "Windows NT 4.0"; } else if (v.dwMajorVersion == 5) { if (v.dwMinorVersion == 0) osName = "Windows 2000"; else if (v.dwMinorVersion == 1) osName = "Windows XP"; else if (v.dwMinorVersion == 2) osName = "Windows .NET Server"; } else if (v.dwMajorVersion == 6 && v.dwMinorVersion == 0) { if (v.wProductType == VER_NT_WORKSTATION) osName = "Windows Vista"; else osName = "Windows 2008"; } else if (v.dwMajorVersion == 6 && v.dwMinorVersion == 1) { if (v.wProductType == VER_NT_WORKSTATION) osName = "Windows 7"; else osName = "Windows 2008 R2"; } if (!osName) osName = "Unknown"; _snprintf(buf, sizeof(buf) - 1, "%s (Build %lu, %s).", osName, v.dwBuildNumber, v.szCSDVersion, osArch, osWow ); packet_add_tlv_string(response, TLV_TYPE_OS_NAME, buf); // sf: we dynamically retrieve GetNativeSystemInfo & IsWow64Process as NT and 2000 dont support it. hKernel32 = LoadLibraryA( "kernel32.dll" ); if( hKernel32 ) { typedef void (WINAPI * GETNATIVESYSTEMINFO)( LPSYSTEM_INFO lpSystemInfo ); typedef BOOL (WINAPI * ISWOW64PROCESS)( HANDLE, PBOOL ); GETNATIVESYSTEMINFO pGetNativeSystemInfo = (GETNATIVESYSTEMINFO)GetProcAddress( hKernel32, "GetNativeSystemInfo" ); ISWOW64PROCESS pIsWow64Process = (ISWOW64PROCESS)GetProcAddress( hKernel32, "IsWow64Process" ); if( pGetNativeSystemInfo ) { SYSTEM_INFO SystemInfo; pGetNativeSystemInfo( &SystemInfo ); switch( SystemInfo.wProcessorArchitecture ) { case PROCESSOR_ARCHITECTURE_AMD64: osArch = "x64";//.........这里部分代码省略.........
开发者ID:0265727207,项目名称:evandrix.github.com,代码行数:101,
注:本文中的GetVersionEx函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetVersionExA函数代码示例 C++ GetVersion函数代码示例 |