OLD | NEW |
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 Loading... |
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 |
OLD | NEW |