| OLD | NEW |
| (Empty) |
| 1 // Copyright 2003-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #ifndef OMAHA_COMMON_FILE_VER_H_ | |
| 17 #define OMAHA_COMMON_FILE_VER_H_ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <tchar.h> | |
| 21 #include <atlstr.h> | |
| 22 #include "base/basictypes.h" | |
| 23 | |
| 24 namespace omaha { | |
| 25 | |
| 26 class FileVer { | |
| 27 public: | |
| 28 FileVer(); | |
| 29 ~FileVer(); | |
| 30 | |
| 31 // opens the version info for the specified file | |
| 32 BOOL Open(const TCHAR* lpszModuleName); | |
| 33 | |
| 34 // Cleanup | |
| 35 void Close(); | |
| 36 | |
| 37 // Query for a given vlaue | |
| 38 CString QueryValue(const TCHAR* lpszValueName) const; | |
| 39 | |
| 40 // Shortcuts for common values | |
| 41 CString GetFileDescription() const {return QueryValue(_T("FileDescription"));} | |
| 42 CString GetFileVersion() const {return QueryValue(_T("FileVersion")); } | |
| 43 CString GetCompanyName() const {return QueryValue(_T("CompanyName")); } | |
| 44 CString GetProductName() const {return QueryValue(_T("ProductName")); } | |
| 45 CString GetProductVersion() const {return QueryValue(_T("ProductVersion")); } | |
| 46 | |
| 47 // gets the FIXEDFILEINFO datastructure | |
| 48 BOOL GetFixedInfo(VS_FIXEDFILEINFO& vsffi) const; // NOLINT | |
| 49 | |
| 50 // returns a formated string representing the file and product versions | |
| 51 // e.g. 2.4.124.34 | |
| 52 CString FormatFixedFileVersion() const; | |
| 53 CString FormatFixedProductVersion() const; | |
| 54 | |
| 55 // Returns a ULONGLONG containing the version in DLL version format. | |
| 56 ULONGLONG GetFileVersionAsULONGLONG() const; | |
| 57 | |
| 58 // gets the language ID | |
| 59 LCID GetLanguageID() const { return HIWORD(lang_charset_); } | |
| 60 | |
| 61 private: | |
| 62 // versioning data returned by GetFileVersionInfo | |
| 63 byte* file_ver_data_; | |
| 64 | |
| 65 // language charset | |
| 66 DWORD lang_charset_; | |
| 67 | |
| 68 DISALLOW_EVIL_CONSTRUCTORS(FileVer); | |
| 69 }; | |
| 70 | |
| 71 } // namespace omaha | |
| 72 | |
| 73 #endif // OMAHA_COMMON_FILE_VER_H_ | |
| OLD | NEW |