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

Unified Diff: base/debug/close_handle_hook_win.cc

Issue 1542553002: Revert of Allow IAT patches to fail when patching for Active Verifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 70d40b21b5895db5f5a1f78c6cd3670df23b15f3..359b758ed33924727c59136265e60b97f4ac22ab 100644
--- a/base/debug/close_handle_hook_win.cc
+++ b/base/debug/close_handle_hook_win.cc
@@ -203,14 +203,15 @@
base::win::IATPatchFunction* patch = NULL;
patch = IATPatch(module, "CloseHandle", &CloseHandleHook,
reinterpret_cast<void**>(&g_close_function));
- if (patch)
- hooks_.push_back(patch);
+ if (!patch)
+ return false;
+ hooks_.push_back(patch);
patch = IATPatch(module, "DuplicateHandle", &DuplicateHandleHook,
reinterpret_cast<void**>(&g_duplicate_function));
- if (patch)
- hooks_.push_back(patch);
-
+ if (!patch)
+ return false;
+ hooks_.push_back(patch);
return true;
}
@@ -248,12 +249,15 @@
returned /= sizeof(HMODULE);
returned = std::min(kSize, returned);
+ bool success = false;
+
for (DWORD current = 0; current < returned; current++) {
- if (!hooks->AddIATPatch(modules[current]))
- return false;
- }
-
- return true;
+ success = hooks->AddIATPatch(modules[current]);
+ if (!success)
+ break;
+ }
+
+ return success;
}
} // 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