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