OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_frame/buggy_bho_handling.h" | 5 #include "chrome_frame/buggy_bho_handling.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/win/scoped_comptr.h" | 11 #include "base/win/scoped_comptr.h" |
12 #include "chrome_frame/exception_barrier.h" | 12 #include "chrome_frame/exception_barrier.h" |
13 #include "chrome_frame/function_stub.h" | 13 #include "chrome_frame/function_stub.h" |
| 14 #include "chrome_frame/pin_module.h" |
14 #include "chrome_frame/utils.h" | 15 #include "chrome_frame/utils.h" |
15 #include "chrome_frame/vtable_patch_manager.h" | 16 #include "chrome_frame/vtable_patch_manager.h" |
16 | 17 |
17 namespace buggy_bho { | 18 namespace buggy_bho { |
18 | 19 |
19 base::ThreadLocalPointer<BuggyBhoTls> BuggyBhoTls::s_bad_object_tls_; | 20 base::ThreadLocalPointer<BuggyBhoTls> BuggyBhoTls::s_bad_object_tls_; |
20 | 21 |
21 struct ModuleAndVersion { | 22 struct ModuleAndVersion { |
22 const char* module_name_; | 23 const char* module_name_; |
23 const uint32 major_version_; | 24 const uint32 major_version_; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 BuggyBhoInvoke); | 219 BuggyBhoInvoke); |
219 if (!stub) { | 220 if (!stub) { |
220 hr = E_OUTOFMEMORY; | 221 hr = E_OUTOFMEMORY; |
221 } else { | 222 } else { |
222 if (!vtable_patch::internal::ReplaceFunctionPointer( | 223 if (!vtable_patch::internal::ReplaceFunctionPointer( |
223 reinterpret_cast<void**>(invoke), stub->code(), | 224 reinterpret_cast<void**>(invoke), stub->code(), |
224 reinterpret_cast<void*>(stub->argument()))) { | 225 reinterpret_cast<void*>(stub->argument()))) { |
225 hr = E_UNEXPECTED; | 226 hr = E_UNEXPECTED; |
226 FunctionStub::Destroy(stub); | 227 FunctionStub::Destroy(stub); |
227 } else { | 228 } else { |
228 PinModule(); // No backing out now. | 229 chrome_frame::PinModule(); // No backing out now. |
229 ::FlushInstructionCache(::GetCurrentProcess(), invoke, sizeof(PROC)); | 230 ::FlushInstructionCache(::GetCurrentProcess(), invoke, sizeof(PROC)); |
230 } | 231 } |
231 } | 232 } |
232 ::VirtualProtect(invoke, sizeof(PROC), flags, &flags); | 233 ::VirtualProtect(invoke, sizeof(PROC), flags, &flags); |
233 return hr; | 234 return hr; |
234 } | 235 } |
235 | 236 |
236 } // end namespace buggy_bho | 237 } // end namespace buggy_bho |
OLD | NEW |