diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-13 13:24:50 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 10:57:25 +0000 |
commit | af3d4809763ef308f08ced947a73b624729ac7ea (patch) | |
tree | 4402b911e30383f6c6dace1e8cf3b8e85355db3a /chromium/base/win/win_util.cc | |
parent | 0e8ff63a407fe323e215bb1a2c423c09a4747c8a (diff) |
BASELINE: Update Chromium to 47.0.2526.14
Also adding in sources needed for spellchecking.
Change-Id: Idd44170fa1616f26315188970a8d5ba7d472b18a
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'chromium/base/win/win_util.cc')
-rw-r--r-- | chromium/base/win/win_util.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/chromium/base/win/win_util.cc b/chromium/base/win/win_util.cc index 96d646ad31f..98d451f9cc7 100644 --- a/chromium/base/win/win_util.cc +++ b/chromium/base/win/win_util.cc @@ -57,6 +57,44 @@ void __cdecl ForceCrashOnSigAbort(int) { *((volatile int*)0) = 0x1337; } +typedef decltype(GetProcessMitigationPolicy)* GetProcessMitigationPolicyType; + +class LazyIsUser32AndGdi32Available { + public: + LazyIsUser32AndGdi32Available() : value_(!IsWin32kSyscallsDisabled()) {} + + ~LazyIsUser32AndGdi32Available() {} + + bool value() { return value_; } + + private: + static bool IsWin32kSyscallsDisabled() { + // Can't disable win32k prior to windows 8. + if (base::win::GetVersion() < base::win::VERSION_WIN8) + return false; + + GetProcessMitigationPolicyType get_process_mitigation_policy_func = + reinterpret_cast<GetProcessMitigationPolicyType>(GetProcAddress( + GetModuleHandle(L"kernel32.dll"), "GetProcessMitigationPolicy")); + + if (!get_process_mitigation_policy_func) + return false; + + PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {}; + if (get_process_mitigation_policy_func(GetCurrentProcess(), + ProcessSystemCallDisablePolicy, + &policy, sizeof(policy))) { + return policy.DisallowWin32kSystemCalls != 0; + } + + return false; + } + + const bool value_; + + DISALLOW_COPY_AND_ASSIGN(LazyIsUser32AndGdi32Available); +}; + const wchar_t kWindows8OSKRegPath[] = L"Software\\Classes\\CLSID\\{054AAE20-4BEA-4347-8A35-64A533254A9D}" L"\\LocalServer32"; @@ -537,5 +575,11 @@ bool MaybeHasSHA256Support() { return true; // New enough to have SHA-256 support. } +bool IsUser32AndGdi32Available() { + static base::LazyInstance<LazyIsUser32AndGdi32Available>::Leaky available = + LAZY_INSTANCE_INITIALIZER; + return available.Get().value(); +} + } // namespace win } // namespace base |