| 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 "base/iat_patch.h" | 5 #include "base/iat_patch.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 | 7 |
| 8 namespace iat_patch { | 8 namespace iat_patch { |
| 9 | 9 |
| 10 struct InterceptFunctionInformation { | 10 struct InterceptFunctionInformation { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 &old_page_protection); | 162 &old_page_protection); |
| 163 } else { | 163 } else { |
| 164 error = GetLastError(); | 164 error = GetLastError(); |
| 165 NOTREACHED(); | 165 NOTREACHED(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 return error; | 168 return error; |
| 169 } | 169 } |
| 170 | 170 |
| 171 IATPatchFunction::IATPatchFunction() | 171 IATPatchFunction::IATPatchFunction() |
| 172 : original_function_(NULL), | 172 : module_handle_(NULL), |
| 173 original_function_(NULL), |
| 173 iat_thunk_(NULL), | 174 iat_thunk_(NULL), |
| 174 intercept_function_(NULL) { | 175 intercept_function_(NULL) { |
| 175 } | 176 } |
| 176 | 177 |
| 177 IATPatchFunction::~IATPatchFunction() { | 178 IATPatchFunction::~IATPatchFunction() { |
| 178 if (NULL != intercept_function_) { | 179 if (NULL != intercept_function_) { |
| 179 DWORD error = Unpatch(); | 180 DWORD error = Unpatch(); |
| 180 DCHECK_EQ(NO_ERROR, error); | 181 DCHECK_EQ(NO_ERROR, error); |
| 181 } | 182 } |
| 182 } | 183 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 FreeLibrary(module_handle_); | 231 FreeLibrary(module_handle_); |
| 231 module_handle_ = NULL; | 232 module_handle_ = NULL; |
| 232 intercept_function_ = NULL; | 233 intercept_function_ = NULL; |
| 233 original_function_ = NULL; | 234 original_function_ = NULL; |
| 234 iat_thunk_ = NULL; | 235 iat_thunk_ = NULL; |
| 235 | 236 |
| 236 return error; | 237 return error; |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace iat_patch | 240 } // namespace iat_patch |
| OLD | NEW |