[go: nahoru, domu]

blob: f0dbde87972fd281929b8f45386e1d16a7f99035 [file] [log] [blame]
rvargas@google.com90509cb2011-03-25 18:46:381// Copyright (c) 2011 The Chromium Authors. All rights reserved.
tony@chromium.orgbcff05a2010-04-14 01:46:432// 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_
tony@chromium.orgbcff05a2010-04-14 01:46:437
fdoray5b7de9e2016-06-29 23:13:118#include <windows.h>
9
10#include <stdint.h>
11
dcheng093de9b2016-04-04 21:25:5112#include <memory>
tony@chromium.orgbcff05a2010-04-14 01:46:4313#include <string>
fdoray5b7de9e2016-06-29 23:13:1114#include <vector>
tony@chromium.orgbcff05a2010-04-14 01:46:4315
darin@chromium.org0bea7252011-08-05 15:34:0016#include "base/base_export.h"
tony@chromium.orgbcff05a2010-04-14 01:46:4317#include "base/file_version_info.h"
avi9b6f42932015-12-26 22:15:1418#include "base/macros.h"
Alan Screene93de3a2019-10-02 13:56:0919#include "base/version.h"
tony@chromium.orgbcff05a2010-04-14 01:46:4320
21struct tagVS_FIXEDFILEINFO;
22typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
23
mgiuca8137fc22015-05-07 02:20:3124class BASE_EXPORT FileVersionInfoWin : public FileVersionInfo {
tony@chromium.orgbcff05a2010-04-14 01:46:4325 public:
mgiuca8137fc22015-05-07 02:20:3126 ~FileVersionInfoWin() override;
tony@chromium.orgbcff05a2010-04-14 01:46:4327
28 // Accessors to the different version properties.
29 // Returns an empty string if the property is not found.
dchengfbce1262015-04-17 07:35:4630 base::string16 company_name() override;
31 base::string16 company_short_name() override;
32 base::string16 product_name() override;
33 base::string16 product_short_name() override;
34 base::string16 internal_name() override;
35 base::string16 product_version() override;
dchengfbce1262015-04-17 07:35:4636 base::string16 special_build() override;
dchengfbce1262015-04-17 07:35:4637 base::string16 original_filename() override;
38 base::string16 file_description() override;
39 base::string16 file_version() override;
tony@chromium.orgbcff05a2010-04-14 01:46:4340
Lei Zhang4bb23de2019-10-04 16:17:0841 // Lets you access other properties not covered above. |value| is only
42 // modified if GetValue() returns true.
43 bool GetValue(const base::char16* name, base::string16* value) const;
tony@chromium.orgbcff05a2010-04-14 01:46:4344
jdoerrie5c4dc4e2019-02-01 18:02:3345 // Similar to GetValue but returns a string16 (empty string if the property
tony@chromium.orgbcff05a2010-04-14 01:46:4346 // does not exist).
Lei Zhang4bb23de2019-10-04 16:17:0847 base::string16 GetStringValue(const base::char16* name) const;
tony@chromium.orgbcff05a2010-04-14 01:46:4348
Alan Screene93de3a2019-10-02 13:56:0949 // Get file version number in dotted version format.
50 base::Version GetFileVersion() const;
tony@chromium.orgbcff05a2010-04-14 01:46:4351
David Benjamin04cc2b42019-01-29 05:30:3352 // Behaves like CreateFileVersionInfo, but returns a FileVersionInfoWin.
53 static std::unique_ptr<FileVersionInfoWin> CreateFileVersionInfoWin(
54 const base::FilePath& file_path);
55
tony@chromium.orgbcff05a2010-04-14 01:46:4356 private:
fdoray5b7de9e2016-06-29 23:13:1157 friend FileVersionInfo;
58
59 // |data| is a VS_VERSION_INFO resource. |language| and |code_page| are
60 // extracted from the \VarFileInfo\Translation value of |data|.
61 FileVersionInfoWin(std::vector<uint8_t>&& data,
62 WORD language,
63 WORD code_page);
64 FileVersionInfoWin(void* data, WORD language, WORD code_page);
65
66 const std::vector<uint8_t> owned_data_;
67 const void* const data_;
68 const WORD language_;
69 const WORD code_page_;
70
Lei Zhang4bb23de2019-10-04 16:17:0871 // This is a reference for a portion of |data_|.
72 const VS_FIXEDFILEINFO& fixed_file_info_;
tony@chromium.orgbcff05a2010-04-14 01:46:4373
74 DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin);
75};
76
77#endif // BASE_FILE_VERSION_INFO_WIN_H_