mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
b24022bb02
Starting with Windows 11 22H2, Microsoft has made internal changes in msctf.dll. The TF_Notify function, also known as CtfImmNotify from imm32.dll, uses a new convention for its third argument. These changes are incompatible with current versions of ZoneAlarm Anti-Keylogger, resulting in crashes in our main process. This patch converts messages forwarded by ZoneAlarm Anti-Keylogger to the new convention. If we detect the product and an incompatible version of msctf.dll, then we hook TF_Notify and detect any message using the old convention, and convert it to the new convention. Differential Revision: https://phabricator.services.mozilla.com/D189518
81 lines
2.3 KiB
C++
81 lines
2.3 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_WindowsVersion_h
|
|
#define mozilla_WindowsVersion_h
|
|
|
|
#include "mozilla/Atomics.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include <stdint.h>
|
|
#include <windows.h>
|
|
|
|
namespace mozilla {
|
|
|
|
inline bool IsWindows10BuildOrLater(uint32_t aBuild) {
|
|
static Atomic<uint32_t> minBuild(0);
|
|
static Atomic<uint32_t> maxBuild(UINT32_MAX);
|
|
|
|
if (minBuild >= aBuild) {
|
|
return true;
|
|
}
|
|
|
|
if (aBuild >= maxBuild) {
|
|
return false;
|
|
}
|
|
|
|
OSVERSIONINFOEXW info;
|
|
ZeroMemory(&info, sizeof(OSVERSIONINFOEXW));
|
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
|
|
info.dwMajorVersion = 10;
|
|
info.dwBuildNumber = aBuild;
|
|
|
|
DWORDLONG conditionMask = 0;
|
|
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
|
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
VER_SET_CONDITION(conditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
|
VER_SET_CONDITION(conditionMask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
|
VER_SET_CONDITION(conditionMask, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
|
|
|
|
if (VerifyVersionInfoW(&info,
|
|
VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER |
|
|
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
|
|
conditionMask)) {
|
|
minBuild = aBuild;
|
|
return true;
|
|
}
|
|
|
|
maxBuild = aBuild;
|
|
return false;
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin10AnniversaryUpdateOrLater() {
|
|
return IsWindows10BuildOrLater(14393);
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin10CreatorsUpdateOrLater() {
|
|
return IsWindows10BuildOrLater(15063);
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin10FallCreatorsUpdateOrLater() {
|
|
return IsWindows10BuildOrLater(16299);
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin10Sep2018UpdateOrLater() {
|
|
return IsWindows10BuildOrLater(17763);
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin11OrLater() {
|
|
return IsWindows10BuildOrLater(22000);
|
|
}
|
|
|
|
MOZ_ALWAYS_INLINE bool IsWin1122H2OrLater() {
|
|
return IsWindows10BuildOrLater(22621);
|
|
}
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif /* mozilla_WindowsVersion_h */
|