/// Parses a version number like this: "4.2.12325 Compatibility Profile Context 13.100.0.0" /// to extract the "12325" portion. /// \param pVersion the version string to extract the number from /// \return 0 on failure, the build version number on success int extractVersionNumber(const GLubyte* pVersion) { const char* pcszVer = reinterpret_cast<const char*>(pVersion); std::string strVer(pcszVer); // the build number ends at the first space int nEndBuild = (int)strVer.find_first_of(' '); // truncate the input at the first space strVer = strVer.substr(0, nEndBuild); // the build number starts after the last decimal point int nStartBuild = (int)strVer.find_last_of('.') + 1; // parse the version number int nVersion = atoi(strVer.substr(nStartBuild, nEndBuild - nStartBuild).c_str()); // couldn't extract version -- return MAX_INT to simulate most recent driver if (0 == nVersion) { nVersion = INT_MAX; } return nVersion; }
void GLIB::FetchFirmWare() { ValWord< uint32_t > mem; char regName[12]; for(int i=1 ; i<=6 ; i++) { sprintf(regName,"firmware_REG_%d",i); mem = hw.getNode ( regName ).read(); hw.dispatch(); //std::cout<<mem.value()<<" . "; char *pEnd; char firmChar[1]; sprintf(firmChar,"%d",int(mem.value())); long int li1; li1 = strtol (firmChar,&pEnd,16); //std::cout<<li1<<" . "; //int c = int(mem.value()); if(i==1) _firmWare_Id_Ver_MAJOR=li1; if(i==2) _firmWare_Id_Ver_MINOR=li1; if(i==3) _firmWare_Id_Ver_BUILD=li1; if(i==4) _firmWare_Id_YY=li1; if(i==5) _firmWare_Id_MM=li1; if(i==6) _firmWare_Id_DD=li1; //std::cout<<li1<<" . "; } //std::cout<<_firmWare_Id_Ver_MAJOR<<" . "<<_firmWare_Id_Ver_MINOR<<" . "<<_firmWare_Id_Ver_BUILD<<" . "<<_firmWare_Id_YY<<" . "<<_firmWare_Id_MM << " . "<<_firmWare_Id_DD<<std::endl; char version[20]=""; char frmDat[20]=""; //char *frmDat; sprintf(frmDat,"%x/%x/%x",_firmWare_Id_DD,_firmWare_Id_MM,_firmWare_Id_YY); sprintf(version,"%x.%x.%x",_firmWare_Id_Ver_MAJOR,_firmWare_Id_Ver_MINOR,_firmWare_Id_Ver_BUILD); std::string strVer(version); std::string strDate(frmDat); _firmWareVersion.append(strVer); _firmWareDate.append(strDate); //std::cout<<frmDat<<std::endl; //std::cout<<_firmWareVersion<<" : "<<_firmWareDate<<std::endl; //std::cout<<_firmWare_Id_Ver_MAJOR<<" . "<<_firmWare_Id_Ver_MINOR<<" . "<<_firmWare_Id_Ver_BUILD<<" . "<<_firmWare_Id_YY<<" . "<<_firmWare_Id_MM << " . "<<_firmWare_Id_DD<<std::endl; //std::cout<<std::endl; }
STDMETHODIMP CShellExtControl::GetVersion(LONG* plVersion, BSTR* pbstrVersion) { if(!plVersion || !pbstrVersion || (*pbstrVersion)) return E_INVALIDARG; (*plVersion) = PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4; _bstr_t strVer(SHELLEXT_PRODUCT_FULL_VERSION); pbstrVersion = strVer.GetAddress(); return S_OK; }
wxString wxGetOsDescription() { wxString strVer(_T("OS/2")); ULONG ulSysInfo = 0; if (::DosQuerySysInfo( QSV_VERSION_MINOR, QSV_VERSION_MINOR, (PVOID)&ulSysInfo, sizeof(ULONG) ) == 0L ) { wxString ver; ver.Printf( _T(" ver. %d.%d"), int(ulSysInfo / 10), int(ulSysInfo % 10) ); strVer += ver; } return strVer; }