OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/app/close_handle_hook_win.h" | 5 #include "chrome/app/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 | 10 |
10 #include <algorithm> | 11 #include <algorithm> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/win/iat_patch_function.h" | 17 #include "base/win/iat_patch_function.h" |
16 #include "base/win/pe_image.h" | 18 #include "base/win/pe_image.h" |
17 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 20 #include "build/build_config.h" |
18 #include "chrome/common/channel_info.h" | 21 #include "chrome/common/channel_info.h" |
19 #include "components/version_info/version_info.h" | 22 #include "components/version_info/version_info.h" |
20 | 23 |
21 namespace { | 24 namespace { |
22 | 25 |
23 typedef BOOL (WINAPI* CloseHandleType) (HANDLE handle); | 26 typedef BOOL (WINAPI* CloseHandleType) (HANDLE handle); |
24 | 27 |
25 typedef BOOL (WINAPI* DuplicateHandleType)(HANDLE source_process, | 28 typedef BOOL (WINAPI* DuplicateHandleType)(HANDLE source_process, |
26 HANDLE source_handle, | 29 HANDLE source_handle, |
27 HANDLE target_process, | 30 HANDLE target_process, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 PatchLoadedModules(hooks); | 279 PatchLoadedModules(hooks); |
277 } else { | 280 } else { |
278 base::win::DisableHandleVerifier(); | 281 base::win::DisableHandleVerifier(); |
279 } | 282 } |
280 } | 283 } |
281 | 284 |
282 void RemoveHandleHooks() { | 285 void RemoveHandleHooks() { |
283 // We are partching all loaded modules without forcing them to stay in memory, | 286 // We are partching all loaded modules without forcing them to stay in memory, |
284 // removing patches is not safe. | 287 // removing patches is not safe. |
285 } | 288 } |
OLD | NEW |