| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "sandbox/src/service_resolver.h" | 5 #include "sandbox/src/service_resolver.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "sandbox/src/pe_image.h" | 9 #include "sandbox/src/pe_image.h" |
| 10 #include "sandbox/src/sandbox_types.h" | 10 #include "sandbox/src/sandbox_types.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, | 229 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
| 230 bit_cast<const wchar_t*>(ki_system_call), | 230 bit_cast<const wchar_t*>(ki_system_call), |
| 231 &module_1)) | 231 &module_1)) |
| 232 return false; | 232 return false; |
| 233 | 233 |
| 234 if (NULL != ntdll_base_) { | 234 if (NULL != ntdll_base_) { |
| 235 // This path is only taken when running the unit tests. We want to be | 235 // This path is only taken when running the unit tests. We want to be |
| 236 // able to patch a buffer in memory, so target_ is not inside ntdll. | 236 // able to patch a buffer in memory, so target_ is not inside ntdll. |
| 237 module_2 = ntdll_base_; | 237 module_2 = ntdll_base_; |
| 238 } else { | 238 } else { |
| 239 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | | 239 if (!GetModuleHandleHelper( |
| 240 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
, | 240 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
| 241 reinterpret_cast<const wchar_t*>(target_), | 241 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
| 242 &module_2)) | 242 reinterpret_cast<const wchar_t*>(target_), |
| 243 &module_2)) { |
| 243 return false; | 244 return false; |
| 245 } |
| 244 } | 246 } |
| 245 | 247 |
| 246 if (module_1 != module_2) | 248 if (module_1 != module_2) |
| 247 return false; | 249 return false; |
| 248 } | 250 } |
| 249 | 251 |
| 250 // Save the verified code | 252 // Save the verified code |
| 251 memcpy(local_thunk, &function_code, sizeof(function_code)); | 253 memcpy(local_thunk, &function_code, sizeof(function_code)); |
| 252 | 254 |
| 253 return true; | 255 return true; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 return false; | 393 return false; |
| 392 | 394 |
| 393 // Save the verified code | 395 // Save the verified code |
| 394 memcpy(local_thunk, &function_code, sizeof(function_code)); | 396 memcpy(local_thunk, &function_code, sizeof(function_code)); |
| 395 | 397 |
| 396 return true; | 398 return true; |
| 397 } | 399 } |
| 398 | 400 |
| 399 } // namespace sandbox | 401 } // namespace sandbox |
| 400 | 402 |
| OLD | NEW |