Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: base/win/iat_patch_function.cc

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: / Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/i18n.cc ('k') | base/win/scoped_bstr.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Save the old pointer. 60 // Save the old pointer.
61 if (NULL != intercept_information->old_function) { 61 if (NULL != intercept_information->old_function) {
62 *(intercept_information->old_function) = GetIATFunction(iat); 62 *(intercept_information->old_function) = GetIATFunction(iat);
63 } 63 }
64 64
65 if (NULL != intercept_information->iat_thunk) { 65 if (NULL != intercept_information->iat_thunk) {
66 *(intercept_information->iat_thunk) = iat; 66 *(intercept_information->iat_thunk) = iat;
67 } 67 }
68 68
69 // portability check 69 // portability check
70 COMPILE_ASSERT(sizeof(iat->u1.Function) == 70 static_assert(
71 sizeof(intercept_information->new_function), unknown_IAT_thunk_format); 71 sizeof(iat->u1.Function) == sizeof(intercept_information->new_function),
72 "unknown IAT thunk format");
72 73
73 // Patch the function. 74 // Patch the function.
74 intercept_information->return_code = 75 intercept_information->return_code =
75 ModifyCode(&(iat->u1.Function), 76 ModifyCode(&(iat->u1.Function),
76 &(intercept_information->new_function), 77 &(intercept_information->new_function),
77 sizeof(intercept_information->new_function)); 78 sizeof(intercept_information->new_function));
78 79
79 // Terminate further enumeration. 80 // Terminate further enumeration.
80 intercept_information->finished_operation = true; 81 intercept_information->finished_operation = true;
81 return false; 82 return false;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return error; 299 return error;
299 } 300 }
300 301
301 void* IATPatchFunction::original_function() const { 302 void* IATPatchFunction::original_function() const {
302 DCHECK(is_patched()); 303 DCHECK(is_patched());
303 return original_function_; 304 return original_function_;
304 } 305 }
305 306
306 } // namespace win 307 } // namespace win
307 } // namespace base 308 } // namespace base
OLDNEW
« no previous file with comments | « base/win/i18n.cc ('k') | base/win/scoped_bstr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698