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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include <memory> |
| 10 |
10 #include "sandbox/win/src/sandbox_nt_util.h" | 11 #include "sandbox/win/src/sandbox_nt_util.h" |
11 #include "sandbox/win/src/win_utils.h" | 12 #include "sandbox/win/src/win_utils.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 #pragma pack(push, 1) | 15 #pragma pack(push, 1) |
15 | 16 |
16 const ULONG kMmovR10EcxMovEax = 0xB8D18B4C; | 17 const ULONG kMmovR10EcxMovEax = 0xB8D18B4C; |
17 const USHORT kSyscall = 0x050F; | 18 const USHORT kSyscall = 0x050F; |
18 const BYTE kRetNp = 0xC3; | 19 const BYTE kRetNp = 0xC3; |
19 const ULONG64 kMov1 = 0x54894808244C8948; | 20 const ULONG64 kMov1 = 0x54894808244C8948; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void* thunk_storage, | 142 void* thunk_storage, |
142 size_t storage_bytes, | 143 size_t storage_bytes, |
143 size_t* storage_used) { | 144 size_t* storage_used) { |
144 NTSTATUS ret = | 145 NTSTATUS ret = |
145 Init(target_module, interceptor_module, target_name, interceptor_name, | 146 Init(target_module, interceptor_module, target_name, interceptor_name, |
146 interceptor_entry_point, thunk_storage, storage_bytes); | 147 interceptor_entry_point, thunk_storage, storage_bytes); |
147 if (!NT_SUCCESS(ret)) | 148 if (!NT_SUCCESS(ret)) |
148 return ret; | 149 return ret; |
149 | 150 |
150 size_t thunk_bytes = GetThunkSize(); | 151 size_t thunk_bytes = GetThunkSize(); |
151 scoped_ptr<char[]> thunk_buffer(new char[thunk_bytes]); | 152 std::unique_ptr<char[]> thunk_buffer(new char[thunk_bytes]); |
152 ServiceFullThunk* thunk = reinterpret_cast<ServiceFullThunk*>( | 153 ServiceFullThunk* thunk = reinterpret_cast<ServiceFullThunk*>( |
153 thunk_buffer.get()); | 154 thunk_buffer.get()); |
154 | 155 |
155 if (!IsFunctionAService(&thunk->original)) | 156 if (!IsFunctionAService(&thunk->original)) |
156 return STATUS_UNSUCCESSFUL; | 157 return STATUS_UNSUCCESSFUL; |
157 | 158 |
158 ret = PerformPatch(thunk, thunk_storage); | 159 ret = PerformPatch(thunk, thunk_storage); |
159 | 160 |
160 if (NULL != storage_used) | 161 if (NULL != storage_used) |
161 *storage_used = thunk_bytes; | 162 *storage_used = thunk_bytes; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 244 |
244 return STATUS_SUCCESS; | 245 return STATUS_SUCCESS; |
245 } | 246 } |
246 | 247 |
247 bool Wow64ResolverThunk::IsFunctionAService(void* local_thunk) const { | 248 bool Wow64ResolverThunk::IsFunctionAService(void* local_thunk) const { |
248 NOTREACHED_NT(); | 249 NOTREACHED_NT(); |
249 return false; | 250 return false; |
250 } | 251 } |
251 | 252 |
252 } // namespace sandbox | 253 } // namespace sandbox |
OLD | NEW |