15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef BASE_FILE_VERSION_INFO_WIN_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define BASE_FILE_VERSION_INFO_WIN_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/base_export.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/file_version_info.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct tagVS_FIXEDFILEINFO;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FileVersionInfoWin : public FileVersionInfo {
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BASE_EXPORT FileVersionInfoWin(void* data, int language, int code_page);
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BASE_EXPORT ~FileVersionInfoWin();
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Accessors to the different version properties.
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns an empty string if the property is not found.
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 company_name() OVERRIDE;
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 company_short_name() OVERRIDE;
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 product_name() OVERRIDE;
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 product_short_name() OVERRIDE;
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 internal_name() OVERRIDE;
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 product_version() OVERRIDE;
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 private_build() OVERRIDE;
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 special_build() OVERRIDE;
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 comments() OVERRIDE;
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 original_filename() OVERRIDE;
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 file_description() OVERRIDE;
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 file_version() OVERRIDE;
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 legal_copyright() OVERRIDE;
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 legal_trademarks() OVERRIDE;
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual base::string16 last_change() OVERRIDE;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool is_official_build() OVERRIDE;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Lets you access other properties not covered above.
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BASE_EXPORT bool GetValue(const wchar_t* name, std::wstring* value);
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Similar to GetValue but returns a wstring (empty string if the property
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // does not exist).
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BASE_EXPORT std::wstring GetStringValue(const wchar_t* name);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get the fixed file info if it exists. Otherwise NULL
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; }
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_ptr<char, base::FreeDeleter> data_;
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int language_;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int code_page_;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is a pointer into the data_ if it exists. Otherwise NULL.
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  VS_FIXEDFILEINFO* fixed_file_info_;
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin);
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // BASE_FILE_VERSION_INFO_WIN_H_
63