OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 // For information about interceptions as a whole see | 5 // For information about interceptions as a whole see |
6 // http://dev.chromium.org/developers/design-documents/sandbox . | 6 // http://dev.chromium.org/developers/design-documents/sandbox . |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "sandbox/src/interception.h" | 10 #include "sandbox/src/interception.h" |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/pe_image.h" | |
14 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/win/pe_image.h" |
15 #include "sandbox/src/interception_internal.h" | 15 #include "sandbox/src/interception_internal.h" |
16 #include "sandbox/src/interceptors.h" | 16 #include "sandbox/src/interceptors.h" |
17 #include "sandbox/src/sandbox.h" | 17 #include "sandbox/src/sandbox.h" |
18 #include "sandbox/src/sandbox_utils.h" | 18 #include "sandbox/src/sandbox_utils.h" |
19 #include "sandbox/src/service_resolver.h" | 19 #include "sandbox/src/service_resolver.h" |
20 #include "sandbox/src/target_interceptions.h" | 20 #include "sandbox/src/target_interceptions.h" |
21 #include "sandbox/src/target_process.h" | 21 #include "sandbox/src/target_process.h" |
22 #include "sandbox/src/wow64.h" | 22 #include "sandbox/src/wow64.h" |
23 | 23 |
24 namespace { | 24 namespace { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, | 404 bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, |
405 size_t thunk_bytes, | 405 size_t thunk_bytes, |
406 DllInterceptionData* dll_data) { | 406 DllInterceptionData* dll_data) { |
407 DCHECK(NULL != thunks); | 407 DCHECK(NULL != thunks); |
408 DCHECK(NULL != dll_data); | 408 DCHECK(NULL != dll_data); |
409 | 409 |
410 HMODULE ntdll_base = ::GetModuleHandle(kNtdllName); | 410 HMODULE ntdll_base = ::GetModuleHandle(kNtdllName); |
411 if (!ntdll_base) | 411 if (!ntdll_base) |
412 return false; | 412 return false; |
413 | 413 |
414 PEImage ntdll_image(ntdll_base); | 414 base::win::PEImage ntdll_image(ntdll_base); |
415 | 415 |
416 // Bypass purify's interception. | 416 // Bypass purify's interception. |
417 wchar_t* loader_get = reinterpret_cast<wchar_t*>( | 417 wchar_t* loader_get = reinterpret_cast<wchar_t*>( |
418 ntdll_image.GetProcAddress("LdrGetDllHandle")); | 418 ntdll_image.GetProcAddress("LdrGetDllHandle")); |
419 if (loader_get) { | 419 if (loader_get) { |
420 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | | 420 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
421 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, | 421 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
422 loader_get, &ntdll_base)) | 422 loader_get, &ntdll_base)) |
423 return false; | 423 return false; |
424 } | 424 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 ::FreeLibrary(local_interceptor); | 492 ::FreeLibrary(local_interceptor); |
493 #endif | 493 #endif |
494 | 494 |
495 if (it != interceptions_.end()) | 495 if (it != interceptions_.end()) |
496 return false; | 496 return false; |
497 | 497 |
498 return true; | 498 return true; |
499 } | 499 } |
500 | 500 |
501 } // namespace sandbox | 501 } // namespace sandbox |
OLD | NEW |