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

Side by Side Diff: sandbox/win/src/service_resolver_64.cc

Issue 1849323003: Convert //sandbox to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup nonsfi_sandbox_unittest.cc Created 4 years, 8 months 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 | « sandbox/win/src/service_resolver_32.cc ('k') | sandbox/win/src/service_resolver_unittest.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) 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
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
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
OLDNEW
« no previous file with comments | « sandbox/win/src/service_resolver_32.cc ('k') | sandbox/win/src/service_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698