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

Unified Diff: base/debug/close_handle_hook_win.cc

Issue 1540723002: Allow IAT patches to fail when patching for Active Verifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review change Created 5 years 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 | base/test/run_all_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/close_handle_hook_win.cc
diff --git a/base/debug/close_handle_hook_win.cc b/base/debug/close_handle_hook_win.cc
index 359b758ed33924727c59136265e60b97f4ac22ab..70d40b21b5895db5f5a1f78c6cd3670df23b15f3 100644
--- a/base/debug/close_handle_hook_win.cc
+++ b/base/debug/close_handle_hook_win.cc
@@ -203,15 +203,14 @@ bool HandleHooks::AddIATPatch(HMODULE module) {
base::win::IATPatchFunction* patch = NULL;
patch = IATPatch(module, "CloseHandle", &CloseHandleHook,
reinterpret_cast<void**>(&g_close_function));
- if (!patch)
- return false;
- hooks_.push_back(patch);
+ if (patch)
+ hooks_.push_back(patch);
patch = IATPatch(module, "DuplicateHandle", &DuplicateHandleHook,
reinterpret_cast<void**>(&g_duplicate_function));
- if (!patch)
- return false;
- hooks_.push_back(patch);
+ if (patch)
+ hooks_.push_back(patch);
+
return true;
}
@@ -249,15 +248,12 @@ bool PatchLoadedModules(HandleHooks* hooks) {
returned /= sizeof(HMODULE);
returned = std::min(kSize, returned);
- bool success = false;
-
for (DWORD current = 0; current < returned; current++) {
- success = hooks->AddIATPatch(modules[current]);
- if (!success)
- break;
+ if (!hooks->AddIATPatch(modules[current]))
+ return false;
}
- return success;
+ return true;
}
} // namespace
« no previous file with comments | « no previous file | base/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698