file_version_info_win.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef BASE_FILE_VERSION_INFO_WIN_H_ 6#define BASE_FILE_VERSION_INFO_WIN_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "base/file_version_info.h" 12#include "base/scoped_ptr.h" 13 14struct tagVS_FIXEDFILEINFO; 15typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO; 16 17class FilePath; 18 19// Provides a way to access the version information for a file. 20// This is the information you access when you select a file in the Windows 21// explorer, right-click select Properties, then click the Version tab. 22 23class FileVersionInfoWin : public FileVersionInfo { 24 public: 25 FileVersionInfoWin(void* data, int language, int code_page); 26 ~FileVersionInfoWin(); 27 28 // Accessors to the different version properties. 29 // Returns an empty string if the property is not found. 30 virtual std::wstring company_name(); 31 virtual std::wstring company_short_name(); 32 virtual std::wstring product_name(); 33 virtual std::wstring product_short_name(); 34 virtual std::wstring internal_name(); 35 virtual std::wstring product_version(); 36 virtual std::wstring private_build(); 37 virtual std::wstring special_build(); 38 virtual std::wstring comments(); 39 virtual std::wstring original_filename(); 40 virtual std::wstring file_description(); 41 virtual std::wstring file_version(); 42 virtual std::wstring legal_copyright(); 43 virtual std::wstring legal_trademarks(); 44 virtual std::wstring last_change(); 45 virtual bool is_official_build(); 46 47 // Lets you access other properties not covered above. 48 bool GetValue(const wchar_t* name, std::wstring* value); 49 50 // Similar to GetValue but returns a wstring (empty string if the property 51 // does not exist). 52 std::wstring GetStringValue(const wchar_t* name); 53 54 // Get the fixed file info if it exists. Otherwise NULL 55 VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; } 56 57 private: 58 scoped_ptr_malloc<char> data_; 59 int language_; 60 int code_page_; 61 // This is a pointer into the data_ if it exists. Otherwise NULL. 62 VS_FIXEDFILEINFO* fixed_file_info_; 63 64 DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin); 65}; 66 67#endif // BASE_FILE_VERSION_INFO_WIN_H_ 68