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

Side by Side Diff: sandbox/win/src/interception.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/handle_closer.cc ('k') | sandbox/win/src/interception_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 // For information about interceptions as a whole see 5 // For information about interceptions as a whole see
6 // http://dev.chromium.org/developers/design-documents/sandbox . 6 // http://dev.chromium.org/developers/design-documents/sandbox .
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <set> 11 #include <set>
11 12
12 #include "sandbox/win/src/interception.h" 13 #include "sandbox/win/src/interception.h"
13 14
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/win/pe_image.h" 17 #include "base/win/pe_image.h"
18 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
19 #include "sandbox/win/src/interception_internal.h" 19 #include "sandbox/win/src/interception_internal.h"
20 #include "sandbox/win/src/interceptors.h" 20 #include "sandbox/win/src/interceptors.h"
21 #include "sandbox/win/src/sandbox.h" 21 #include "sandbox/win/src/sandbox.h"
22 #include "sandbox/win/src/sandbox_rand.h" 22 #include "sandbox/win/src/sandbox_rand.h"
23 #include "sandbox/win/src/service_resolver.h" 23 #include "sandbox/win/src/service_resolver.h"
24 #include "sandbox/win/src/target_interceptions.h" 24 #include "sandbox/win/src/target_interceptions.h"
25 #include "sandbox/win/src/target_process.h" 25 #include "sandbox/win/src/target_process.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 interceptions_.push_back(module_to_unload); 123 interceptions_.push_back(module_to_unload);
124 return true; 124 return true;
125 } 125 }
126 126
127 bool InterceptionManager::InitializeInterceptions() { 127 bool InterceptionManager::InitializeInterceptions() {
128 if (interceptions_.empty()) 128 if (interceptions_.empty())
129 return true; // Nothing to do here 129 return true; // Nothing to do here
130 130
131 size_t buffer_bytes = GetBufferSize(); 131 size_t buffer_bytes = GetBufferSize();
132 scoped_ptr<char[]> local_buffer(new char[buffer_bytes]); 132 std::unique_ptr<char[]> local_buffer(new char[buffer_bytes]);
133 133
134 if (!SetupConfigBuffer(local_buffer.get(), buffer_bytes)) 134 if (!SetupConfigBuffer(local_buffer.get(), buffer_bytes))
135 return false; 135 return false;
136 136
137 void* remote_buffer; 137 void* remote_buffer;
138 if (!CopyDataToChild(local_buffer.get(), buffer_bytes, &remote_buffer)) 138 if (!CopyDataToChild(local_buffer.get(), buffer_bytes, &remote_buffer))
139 return false; 139 return false;
140 140
141 bool hot_patch_needed = (0 != buffer_bytes); 141 bool hot_patch_needed = (0 != buffer_bytes);
142 if (!PatchNtdll(hot_patch_needed)) 142 if (!PatchNtdll(hot_patch_needed))
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 ::FreeLibrary(local_interceptor); 544 ::FreeLibrary(local_interceptor);
545 #endif 545 #endif
546 546
547 if (it != interceptions_.end()) 547 if (it != interceptions_.end())
548 return false; 548 return false;
549 549
550 return true; 550 return true;
551 } 551 }
552 552
553 } // namespace sandbox 553 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/handle_closer.cc ('k') | sandbox/win/src/interception_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698