| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "sandbox/src/policy_broker.h" | 7 #include "sandbox/src/policy_broker.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/pe_image.h" | 10 #include "base/win/pe_image.h" |
| 11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
| 12 #include "sandbox/src/interception.h" | 12 #include "sandbox/src/interception.h" |
| 13 #include "sandbox/src/interceptors.h" | 13 #include "sandbox/src/interceptors.h" |
| 14 #include "sandbox/src/policy_target.h" | 14 #include "sandbox/src/policy_target.h" |
| 15 #include "sandbox/src/process_thread_interception.h" | 15 #include "sandbox/src/process_thread_interception.h" |
| 16 #include "sandbox/src/sandbox.h" | 16 #include "sandbox/src/sandbox.h" |
| 17 #include "sandbox/src/sandbox_nt_types.h" | 17 #include "sandbox/src/sandbox_nt_types.h" |
| 18 #include "sandbox/src/sandbox_types.h" | 18 #include "sandbox/src/sandbox_types.h" |
| 19 #include "sandbox/src/sandbox_utils.h" | 19 #include "sandbox/src/sandbox_utils.h" |
| 20 #include "sandbox/src/target_process.h" | 20 #include "sandbox/src/target_process.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 return false | 34 return false |
| 35 | 35 |
| 36 #define INIT_GLOBAL_RTL(member) \ | 36 #define INIT_GLOBAL_RTL(member) \ |
| 37 g_nt.##member = reinterpret_cast<##member##Function>( \ | 37 g_nt.##member = reinterpret_cast<##member##Function>( \ |
| 38 ntdll_image.GetProcAddress(#member)); \ | 38 ntdll_image.GetProcAddress(#member)); \ |
| 39 if (NULL == g_nt.##member) \ | 39 if (NULL == g_nt.##member) \ |
| 40 return false | 40 return false |
| 41 | 41 |
| 42 bool SetupNtdllImports(TargetProcess *child) { | 42 bool SetupNtdllImports(TargetProcess *child) { |
| 43 HMODULE ntdll = ::GetModuleHandle(kNtdllName); | 43 HMODULE ntdll = ::GetModuleHandle(kNtdllName); |
| 44 PEImage ntdll_image(ntdll); | 44 base::win::PEImage ntdll_image(ntdll); |
| 45 | 45 |
| 46 // Bypass purify's interception. | 46 // Bypass purify's interception. |
| 47 wchar_t* loader_get = reinterpret_cast<wchar_t*>( | 47 wchar_t* loader_get = reinterpret_cast<wchar_t*>( |
| 48 ntdll_image.GetProcAddress("LdrGetDllHandle")); | 48 ntdll_image.GetProcAddress("LdrGetDllHandle")); |
| 49 if (loader_get) { | 49 if (loader_get) { |
| 50 GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | | 50 GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
| 51 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, | 51 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
| 52 loader_get, &ntdll); | 52 loader_get, &ntdll); |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return false; | 108 return false; |
| 109 | 109 |
| 110 return INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID, | 110 return INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID, |
| 111 24); | 111 24); |
| 112 } | 112 } |
| 113 | 113 |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace sandbox | 117 } // namespace sandbox |
| OLD | NEW |