Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Unified Diff: chrome/browser/chrome_elf_init_win.cc

Issue 1452393002: Block legacy hooking mechanisms on Win8+ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/sandbox_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_elf_init_win.cc
diff --git a/chrome/browser/chrome_elf_init_win.cc b/chrome/browser/chrome_elf_init_win.cc
index 28af7f8228ac565760377242847556ba50506668..f1f5847cec469f87a6cc9ebb81fd68b6e2b7c35b 100644
--- a/chrome/browser/chrome_elf_init_win.cc
+++ b/chrome/browser/chrome_elf_init_win.cc
@@ -8,6 +8,7 @@
#include "base/metrics/sparse_histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
+#include "base/win/windows_version.h"
#include "chrome/browser/chrome_elf_init_win.h"
#include "chrome/common/chrome_version.h"
#include "chrome_elf/blacklist/blacklist.h"
@@ -86,6 +87,22 @@ void ReportSuccessfulBlocks() {
} // namespace
void InitializeChromeElf() {
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ base::FieldTrialList::FindFullName("WindowsHookBlocking") != "Disabled") {
robertshield 2015/11/18 17:51:03 Not sure it's useful to apply the policy here. Thi
jschuh 2015/11/18 18:21:15 Okay, that makes a lot more sense. Because I trace
robertshield 2015/11/18 19:50:29 You can, but there are hoops to jump through and i
+ typedef BOOL(WINAPI * SetProcessMitigationPolicyFunction)(
+ PROCESS_MITIGATION_POLICY mitigation_policy, PVOID buffer,
+ SIZE_T length);
+
+ PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {};
+ policy.DisableExtensionPoints = true;
+ SetProcessMitigationPolicyFunction set_process_mitigation_policy =
+ reinterpret_cast<SetProcessMitigationPolicyFunction>(::GetProcAddress(
+ ::GetModuleHandleA("kernel32.dll"), "SetProcessMitigationPolicy"));
+ bool result = !!set_process_mitigation_policy(
+ ProcessExtensionPointDisablePolicy, &policy, sizeof(policy));
+ DCHECK(result);
+ }
+
if (base::FieldTrialList::FindFullName(kBrowserBlacklistTrialName) ==
kBrowserBlacklistTrialDisabledGroupName) {
// Disable the blacklist for all future runs by removing the beacon.
« no previous file with comments | « no previous file | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698