Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / toolkit / xre / dllservices / ModuleVersionInfo.h
blob2b4681741765ba96c2f0a2772bad475b885fbdf7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ModuleVersionInfo_h
8 #define mozilla_ModuleVersionInfo_h
10 #include <windows.h>
11 #include "nsString.h"
13 namespace mozilla {
15 // Obtains basic version info from a module image's version info resource.
16 class ModuleVersionInfo {
17 public:
18 // We favor English(US) for these fields, otherwise we take the first
19 // translation provided in the version resource.
20 nsString mCompanyName;
21 nsString mProductName;
22 nsString mLegalCopyright;
23 nsString mFileDescription;
25 // Represents an A.B.C.D style version number, internally stored as a uint64_t
26 class VersionNumber {
27 uint64_t mVersion64 = 0;
29 public:
30 VersionNumber() = default;
32 VersionNumber(DWORD aMostSig, DWORD aLeastSig)
33 : mVersion64((uint64_t)aMostSig << 32 | aLeastSig) {}
35 uint16_t A() const {
36 return (uint16_t)((mVersion64 & 0xffff000000000000) >> 48);
39 uint16_t B() const {
40 return (uint16_t)((mVersion64 & 0x0000ffff00000000) >> 32);
43 uint16_t C() const {
44 return (uint16_t)((mVersion64 & 0x00000000ffff0000) >> 16);
47 uint16_t D() const { return (uint16_t)(mVersion64 & 0x000000000000ffff); }
49 uint64_t Version64() const { return mVersion64; }
51 bool operator==(const VersionNumber& aOther) const {
52 return mVersion64 == aOther.mVersion64;
55 nsCString ToString() const {
56 nsCString ret;
57 ret.AppendPrintf("%d.%d.%d.%d", (int)A(), (int)B(), (int)C(), (int)D());
58 return ret;
62 VersionNumber mFileVersion;
63 VersionNumber mProductVersion;
65 // Returns false if it has no version resource or has no fixed version info.
66 bool GetFromImage(const nsAString& aPath);
69 } // namespace mozilla
71 #endif // mozilla_ModuleVersionInfo_h