1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/chromium/base/file_version_info.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +// Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef BASE_FILE_VERSION_INFO_H__ 1.9 +#define BASE_FILE_VERSION_INFO_H__ 1.10 + 1.11 +#include "build/build_config.h" 1.12 + 1.13 +#if defined(OS_WIN) 1.14 +#include <windows.h> 1.15 +// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx 1.16 +extern "C" IMAGE_DOS_HEADER __ImageBase; 1.17 +#endif // OS_WIN 1.18 + 1.19 +#include <string> 1.20 + 1.21 +#include "base/base_export.h" 1.22 +#include "base/strings/string16.h" 1.23 + 1.24 +namespace base { 1.25 +class FilePath; 1.26 +} 1.27 + 1.28 +// Provides an interface for accessing the version information for a file. This 1.29 +// is the information you access when you select a file in the Windows Explorer, 1.30 +// right-click select Properties, then click the Version tab, and on the Mac 1.31 +// when you select a file in the Finder and do a Get Info. 1.32 +// 1.33 +// This list of properties is straight out of Win32's VerQueryValue 1.34 +// <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac 1.35 +// version returns values from the Info.plist as appropriate. TODO(avi): make 1.36 +// this a less-obvious Windows-ism. 1.37 + 1.38 +class FileVersionInfo { 1.39 + public: 1.40 + virtual ~FileVersionInfo() {} 1.41 +#if defined(OS_WIN) || defined(OS_MACOSX) 1.42 + // Creates a FileVersionInfo for the specified path. Returns NULL if something 1.43 + // goes wrong (typically the file does not exit or cannot be opened). The 1.44 + // returned object should be deleted when you are done with it. 1.45 + BASE_EXPORT static FileVersionInfo* CreateFileVersionInfo( 1.46 + const base::FilePath& file_path); 1.47 +#endif // OS_WIN || OS_MACOSX 1.48 + 1.49 +#if defined(OS_WIN) 1.50 + // Creates a FileVersionInfo for the specified module. Returns NULL in case 1.51 + // of error. The returned object should be deleted when you are done with it. 1.52 + BASE_EXPORT static FileVersionInfo* CreateFileVersionInfoForModule( 1.53 + HMODULE module); 1.54 + 1.55 + // Creates a FileVersionInfo for the current module. Returns NULL in case 1.56 + // of error. The returned object should be deleted when you are done with it. 1.57 + // This function should be inlined so that the "current module" is evaluated 1.58 + // correctly, instead of being the module that contains base. 1.59 + __forceinline static FileVersionInfo* 1.60 + CreateFileVersionInfoForCurrentModule() { 1.61 + HMODULE module = reinterpret_cast<HMODULE>(&__ImageBase); 1.62 + return CreateFileVersionInfoForModule(module); 1.63 + } 1.64 +#else 1.65 + // Creates a FileVersionInfo for the current module. Returns NULL in case 1.66 + // of error. The returned object should be deleted when you are done with it. 1.67 + BASE_EXPORT static FileVersionInfo* CreateFileVersionInfoForCurrentModule(); 1.68 +#endif // OS_WIN 1.69 + 1.70 + // Accessors to the different version properties. 1.71 + // Returns an empty string if the property is not found. 1.72 + virtual string16 company_name() = 0; 1.73 + virtual string16 company_short_name() = 0; 1.74 + virtual string16 product_name() = 0; 1.75 + virtual string16 product_short_name() = 0; 1.76 + virtual string16 internal_name() = 0; 1.77 + virtual string16 product_version() = 0; 1.78 + virtual string16 private_build() = 0; 1.79 + virtual string16 special_build() = 0; 1.80 + virtual string16 comments() = 0; 1.81 + virtual string16 original_filename() = 0; 1.82 + virtual string16 file_description() = 0; 1.83 + virtual string16 file_version() = 0; 1.84 + virtual string16 legal_copyright() = 0; 1.85 + virtual string16 legal_trademarks() = 0; 1.86 + virtual string16 last_change() = 0; 1.87 + virtual bool is_official_build() = 0; 1.88 +}; 1.89 + 1.90 +#endif // BASE_FILE_VERSION_INFO_H__