OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/win/iat_patch_function.h" | 5 #include "base/win/iat_patch_function.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/win/pe_image.h" | 8 #include "base/win/pe_image.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 &old_page_protection); | 212 &old_page_protection); |
213 } else { | 213 } else { |
214 error = GetLastError(); | 214 error = GetLastError(); |
215 } | 215 } |
216 | 216 |
217 return error; | 217 return error; |
218 } | 218 } |
219 | 219 |
220 IATPatchFunction::IATPatchFunction() | 220 IATPatchFunction::IATPatchFunction() |
221 : module_handle_(NULL), | 221 : module_handle_(NULL), |
| 222 intercept_function_(NULL), |
222 original_function_(NULL), | 223 original_function_(NULL), |
223 iat_thunk_(NULL), | 224 iat_thunk_(NULL) {} |
224 intercept_function_(NULL) { | |
225 } | |
226 | 225 |
227 IATPatchFunction::~IATPatchFunction() { | 226 IATPatchFunction::~IATPatchFunction() { |
228 if (NULL != intercept_function_) { | 227 if (NULL != intercept_function_) { |
229 DWORD error = Unpatch(); | 228 DWORD error = Unpatch(); |
230 DCHECK_EQ(static_cast<DWORD>(NO_ERROR), error); | 229 DCHECK_EQ(static_cast<DWORD>(NO_ERROR), error); |
231 } | 230 } |
232 } | 231 } |
233 | 232 |
234 DWORD IATPatchFunction::Patch(const wchar_t* module, | 233 DWORD IATPatchFunction::Patch(const wchar_t* module, |
235 const char* imported_from_module, | 234 const char* imported_from_module, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 return error; | 297 return error; |
299 } | 298 } |
300 | 299 |
301 void* IATPatchFunction::original_function() const { | 300 void* IATPatchFunction::original_function() const { |
302 DCHECK(is_patched()); | 301 DCHECK(is_patched()); |
303 return original_function_; | 302 return original_function_; |
304 } | 303 } |
305 | 304 |
306 } // namespace win | 305 } // namespace win |
307 } // namespace base | 306 } // namespace base |
OLD | NEW |