OLD | NEW |
1 // Copyright (c) 2006-2008 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 "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 { |
11 bool finished_operation; | 11 bool finished_operation; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 IATPatchFunction::IATPatchFunction() | 171 IATPatchFunction::IATPatchFunction() |
172 : module_handle_(NULL), | 172 : module_handle_(NULL), |
173 original_function_(NULL), | 173 original_function_(NULL), |
174 iat_thunk_(NULL), | 174 iat_thunk_(NULL), |
175 intercept_function_(NULL) { | 175 intercept_function_(NULL) { |
176 } | 176 } |
177 | 177 |
178 IATPatchFunction::~IATPatchFunction() { | 178 IATPatchFunction::~IATPatchFunction() { |
179 if (NULL != intercept_function_) { | 179 if (NULL != intercept_function_) { |
180 DWORD error = Unpatch(); | 180 DWORD error = Unpatch(); |
181 DCHECK_EQ(NO_ERROR, error); | 181 DCHECK(error == NO_ERROR); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 DWORD IATPatchFunction::Patch(const wchar_t* module, | 185 DWORD IATPatchFunction::Patch(const wchar_t* module, |
186 const char* imported_from_module, | 186 const char* imported_from_module, |
187 const char* function_name, | 187 const char* function_name, |
188 void* new_function) { | 188 void* new_function) { |
189 DCHECK_EQ(static_cast<void*>(NULL), original_function_); | 189 DCHECK_EQ(static_cast<void*>(NULL), original_function_); |
190 DCHECK_EQ(static_cast<IMAGE_THUNK_DATA*>(NULL), iat_thunk_); | 190 DCHECK_EQ(static_cast<IMAGE_THUNK_DATA*>(NULL), iat_thunk_); |
191 DCHECK_EQ(static_cast<void*>(NULL), intercept_function_); | 191 DCHECK_EQ(static_cast<void*>(NULL), intercept_function_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 FreeLibrary(module_handle_); | 231 FreeLibrary(module_handle_); |
232 module_handle_ = NULL; | 232 module_handle_ = NULL; |
233 intercept_function_ = NULL; | 233 intercept_function_ = NULL; |
234 original_function_ = NULL; | 234 original_function_ = NULL; |
235 iat_thunk_ = NULL; | 235 iat_thunk_ = NULL; |
236 | 236 |
237 return error; | 237 return error; |
238 } | 238 } |
239 | 239 |
240 } // namespace iat_patch | 240 } // namespace iat_patch |
OLD | NEW |