зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1483687: Part 2 - Updates to WindowsDllBlocklistCommon.h macros; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D36994 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
41e787ef1a
Коммит
5e011338b2
|
@ -17,9 +17,9 @@ template <typename StrType>
|
|||
struct DllBlockInfoT {
|
||||
// The name of the DLL -- in LOWERCASE! It will be compared to
|
||||
// a lowercase version of the DLL name only.
|
||||
StrType name;
|
||||
StrType mName;
|
||||
|
||||
// If maxVersion is ALL_VERSIONS, we'll block all versions of this
|
||||
// If mMaxVersion is ALL_VERSIONS, we'll block all versions of this
|
||||
// dll. Otherwise, we'll block all versions less than or equal to
|
||||
// the given version, as queried by GetFileVersionInfo and
|
||||
// VS_FIXEDFILEINFO's dwFileVersionMS and dwFileVersionLS fields.
|
||||
|
@ -27,7 +27,7 @@ struct DllBlockInfoT {
|
|||
// Note that the version is usually 4 components, which is A.B.C.D
|
||||
// encoded as 0x AAAA BBBB CCCC DDDD ULL (spaces added for clarity),
|
||||
// but it's not required to be of that format.
|
||||
uint64_t maxVersion;
|
||||
uint64_t mMaxVersion;
|
||||
|
||||
// If the USE_TIMESTAMP flag is set, then we use the timestamp from
|
||||
// the IMAGE_FILE_HEADER in lieu of a version number.
|
||||
|
@ -40,7 +40,15 @@ struct DllBlockInfoT {
|
|||
BLOCK_WIN8_ONLY = 2,
|
||||
USE_TIMESTAMP = 4,
|
||||
CHILD_PROCESSES_ONLY = 8
|
||||
} flags;
|
||||
} mFlags;
|
||||
|
||||
bool IsVersionBlocked(const uint64_t aOther) const {
|
||||
if (mMaxVersion == ALL_VERSIONS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return aOther <= mMaxVersion;
|
||||
}
|
||||
|
||||
static const uint64_t ALL_VERSIONS = (uint64_t)-1LL;
|
||||
|
||||
|
@ -76,22 +84,33 @@ static inline constexpr uint64_t MAKE_VERSION(uint16_t a, uint16_t b,
|
|||
# error "You must define DLL_BLOCKLIST_STRING_TYPE"
|
||||
#endif // !defined(DLL_BLOCKLIST_STRING_TYPE)
|
||||
|
||||
#define DLL_BLOCKLIST_DEFINITIONS_BEGIN \
|
||||
#define DLL_BLOCKLIST_DEFINITIONS_BEGIN_NAMED(name) \
|
||||
using DllBlockInfo = mozilla::DllBlockInfoT<DLL_BLOCKLIST_STRING_TYPE>; \
|
||||
static const DllBlockInfo gWindowsDllBlocklist[] = {
|
||||
#define ALL_VERSIONS DllBlockInfo::ALL_VERSIONS
|
||||
#define UNVERSIONED DllBlockInfo::UNVERSIONED
|
||||
static const DllBlockInfo name[] = {
|
||||
#define DLL_BLOCKLIST_DEFINITIONS_BEGIN \
|
||||
DLL_BLOCKLIST_DEFINITIONS_BEGIN_NAMED(gWindowsDllBlocklist)
|
||||
|
||||
#define DLL_BLOCKLIST_DEFINITIONS_END \
|
||||
{} \
|
||||
} \
|
||||
;
|
||||
|
||||
#define DECLARE_POINTER_TO_FIRST_DLL_BLOCKLIST_ENTRY_FOR(name, list) \
|
||||
const DllBlockInfo* name = &list[0]
|
||||
|
||||
#define DECLARE_POINTER_TO_FIRST_DLL_BLOCKLIST_ENTRY(name) \
|
||||
const DllBlockInfo* name = &gWindowsDllBlocklist[0]
|
||||
DECLARE_POINTER_TO_FIRST_DLL_BLOCKLIST_ENTRY_FOR(name, gWindowsDllBlocklist)
|
||||
|
||||
#define DECLARE_POINTER_TO_LAST_DLL_BLOCKLIST_ENTRY_FOR(name, list) \
|
||||
const DllBlockInfo* name = &list[mozilla::ArrayLength(list) - 1]
|
||||
|
||||
#define DECLARE_POINTER_TO_LAST_DLL_BLOCKLIST_ENTRY(name) \
|
||||
const DllBlockInfo* name = \
|
||||
&gWindowsDllBlocklist[mozilla::ArrayLength(gWindowsDllBlocklist) - 1]
|
||||
DECLARE_POINTER_TO_LAST_DLL_BLOCKLIST_ENTRY_FOR(name, gWindowsDllBlocklist)
|
||||
|
||||
#define DECLARE_DLL_BLOCKLIST_NUM_ENTRIES_FOR(name, list) \
|
||||
const size_t name = mozilla::ArrayLength(list) - 1
|
||||
|
||||
#define DECLARE_DLL_BLOCKLIST_NUM_ENTRIES(name) \
|
||||
DECLARE_DLL_BLOCKLIST_NUM_ENTRIES_FOR(name, gWindowsDllBlocklist)
|
||||
|
||||
#endif // mozilla_WindowsDllBlocklistCommon_h
|
||||
|
|
Загрузка…
Ссылка в новой задаче