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

Side by Side Diff: base/debug/close_handle_hook_win.cc

Issue 1580873003: Enable handle verifier for tests and add some tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable handle hooks for drmemory Created 4 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/close_handle_hook_win.h" 5 #include "base/debug/close_handle_hook_win.h"
6 6
7 #include <Windows.h> 7 #include <Windows.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 returned = std::min(kSize, returned); 252 returned = std::min(kSize, returned);
253 253
254 for (DWORD current = 0; current < returned; current++) { 254 for (DWORD current = 0; current < returned; current++) {
255 hooks->AddIATPatch(modules[current]); 255 hooks->AddIATPatch(modules[current]);
256 } 256 }
257 } 257 }
258 258
259 } // namespace 259 } // namespace
260 260
261 void InstallHandleHooks() { 261 void InstallHandleHooks() {
262 #if !defined(DISABLE_HANDLE_VERIFIER_HOOKS)
262 HandleHooks* hooks = g_hooks.Pointer(); 263 HandleHooks* hooks = g_hooks.Pointer();
263 264
264 // Performing EAT interception first is safer in the presence of other 265 // Performing EAT interception first is safer in the presence of other
265 // threads attempting to call CloseHandle. 266 // threads attempting to call CloseHandle.
266 hooks->AddEATPatch(); 267 hooks->AddEATPatch();
267 PatchLoadedModules(hooks); 268 PatchLoadedModules(hooks);
269 #endif
268 } 270 }
269 271
270 void RemoveHandleHooks() { 272 void RemoveHandleHooks() {
271 // We are partching all loaded modules without forcing them to stay in memory, 273 // We are partching all loaded modules without forcing them to stay in memory,
272 // removing patches is not safe. 274 // removing patches is not safe.
273 } 275 }
274 276
275 } // namespace debug 277 } // namespace debug
276 } // namespace base 278 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/test/test_suite.cc » ('j') | base/test/test_suite.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698