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

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

Issue 13888007: Rewrite scoped_array<T> to scoped_ptr<T[]> in sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/win/src/interception_unittest.cc ('k') | sandbox/win/src/service_resolver_64.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 "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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 size_t storage_bytes, 152 size_t storage_bytes,
153 size_t* storage_used) { 153 size_t* storage_used) {
154 NTSTATUS ret = Init(target_module, interceptor_module, target_name, 154 NTSTATUS ret = Init(target_module, interceptor_module, target_name,
155 interceptor_name, interceptor_entry_point, 155 interceptor_name, interceptor_entry_point,
156 thunk_storage, storage_bytes); 156 thunk_storage, storage_bytes);
157 if (!NT_SUCCESS(ret)) 157 if (!NT_SUCCESS(ret))
158 return ret; 158 return ret;
159 159
160 relative_jump_ = 0; 160 relative_jump_ = 0;
161 size_t thunk_bytes = GetThunkSize(); 161 size_t thunk_bytes = GetThunkSize();
162 scoped_array<char> thunk_buffer(new char[thunk_bytes]); 162 scoped_ptr<char[]> thunk_buffer(new char[thunk_bytes]);
163 ServiceFullThunk* thunk = reinterpret_cast<ServiceFullThunk*>( 163 ServiceFullThunk* thunk = reinterpret_cast<ServiceFullThunk*>(
164 thunk_buffer.get()); 164 thunk_buffer.get());
165 165
166 if (!IsFunctionAService(&thunk->original) && 166 if (!IsFunctionAService(&thunk->original) &&
167 (!relaxed_ || !SaveOriginalFunction(&thunk->original, thunk_storage))) 167 (!relaxed_ || !SaveOriginalFunction(&thunk->original, thunk_storage)))
168 return STATUS_UNSUCCESSFUL; 168 return STATUS_UNSUCCESSFUL;
169 169
170 ret = PerformPatch(thunk, thunk_storage); 170 ret = PerformPatch(thunk, thunk_storage);
171 171
172 if (NULL != storage_used) 172 if (NULL != storage_used)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 return false; 411 return false;
412 } 412 }
413 413
414 // Save the verified code 414 // Save the verified code
415 memcpy(local_thunk, &function_code, sizeof(function_code)); 415 memcpy(local_thunk, &function_code, sizeof(function_code));
416 416
417 return true; 417 return true;
418 } 418 }
419 419
420 } // namespace sandbox 420 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/interception_unittest.cc ('k') | sandbox/win/src/service_resolver_64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698