| 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 "sandbox/win/src/service_resolver.h" | 5 #include "sandbox/win/src/service_resolver.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "sandbox/win/src/win_utils.h" | 8 #include "sandbox/win/src/win_utils.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ULONG call_fs1; // = 64 FF 15 C0 | 116 ULONG call_fs1; // = 64 FF 15 C0 |
| 117 USHORT call_fs2; // = 00 00 | 117 USHORT call_fs2; // = 00 00 |
| 118 BYTE call_fs3; // = 00 | 118 BYTE call_fs3; // = 00 |
| 119 BYTE ret; // = C2 | 119 BYTE ret; // = C2 |
| 120 USHORT num_params; | 120 USHORT num_params; |
| 121 BYTE nop; | 121 BYTE nop; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 // Make sure that relaxed patching works as expected. | 124 // Make sure that relaxed patching works as expected. |
| 125 const size_t kMinServiceSize = offsetof(ServiceEntry, ret); | 125 const size_t kMinServiceSize = offsetof(ServiceEntry, ret); |
| 126 COMPILE_ASSERT(sizeof(ServiceEntryW8) >= kMinServiceSize, wrong_service_len); | 126 static_assert(sizeof(ServiceEntryW8) >= kMinServiceSize, |
| 127 COMPILE_ASSERT(sizeof(Wow64Entry) >= kMinServiceSize, wrong_service_len); | 127 "wrong service length"); |
| 128 COMPILE_ASSERT(sizeof(Wow64EntryW8) >= kMinServiceSize, wrong_service_len); | 128 static_assert(sizeof(Wow64Entry) >= kMinServiceSize, "wrong service length"); |
| 129 static_assert(sizeof(Wow64EntryW8) >= kMinServiceSize, "wrong service length"); |
| 129 | 130 |
| 130 struct ServiceFullThunk { | 131 struct ServiceFullThunk { |
| 131 union { | 132 union { |
| 132 ServiceEntry original; | 133 ServiceEntry original; |
| 133 ServiceEntryW8 original_w8; | 134 ServiceEntryW8 original_w8; |
| 134 Wow64Entry wow_64; | 135 Wow64Entry wow_64; |
| 135 Wow64EntryW8 wow_64_w8; | 136 Wow64EntryW8 wow_64_w8; |
| 136 }; | 137 }; |
| 137 int internal_thunk; // Dummy member to the beginning of the internal thunk. | 138 int internal_thunk; // Dummy member to the beginning of the internal thunk. |
| 138 }; | 139 }; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 return false; | 418 return false; |
| 418 } | 419 } |
| 419 | 420 |
| 420 // Save the verified code | 421 // Save the verified code |
| 421 memcpy(local_thunk, &function_code, sizeof(function_code)); | 422 memcpy(local_thunk, &function_code, sizeof(function_code)); |
| 422 | 423 |
| 423 return true; | 424 return true; |
| 424 } | 425 } |
| 425 | 426 |
| 426 } // namespace sandbox | 427 } // namespace sandbox |
| OLD | NEW |