OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/handle_closer.h" | 5 #include "sandbox/win/src/handle_closer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "sandbox/win/src/interceptors.h" | 10 #include "sandbox/win/src/interceptors.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 return bytes_total; | 75 return bytes_total; |
76 } | 76 } |
77 | 77 |
78 bool HandleCloser::InitializeTargetHandles(TargetProcess* target) { | 78 bool HandleCloser::InitializeTargetHandles(TargetProcess* target) { |
79 // Do nothing on an empty list (global pointer already initialized to NULL). | 79 // Do nothing on an empty list (global pointer already initialized to NULL). |
80 if (handles_to_close_.empty()) | 80 if (handles_to_close_.empty()) |
81 return true; | 81 return true; |
82 | 82 |
83 size_t bytes_needed = GetBufferSize(); | 83 size_t bytes_needed = GetBufferSize(); |
84 scoped_array<size_t> local_buffer( | 84 scoped_ptr<size_t[]> local_buffer( |
85 new size_t[bytes_needed / sizeof(size_t)]); | 85 new size_t[bytes_needed / sizeof(size_t)]); |
86 | 86 |
87 if (!SetupHandleList(local_buffer.get(), bytes_needed)) | 87 if (!SetupHandleList(local_buffer.get(), bytes_needed)) |
88 return false; | 88 return false; |
89 | 89 |
90 HANDLE child = target->Process(); | 90 HANDLE child = target->Process(); |
91 | 91 |
92 // Allocate memory in the target process without specifying the address | 92 // Allocate memory in the target process without specifying the address |
93 void* remote_data = ::VirtualAllocEx(child, NULL, bytes_needed, | 93 void* remote_data = ::VirtualAllocEx(child, NULL, bytes_needed, |
94 MEM_COMMIT, PAGE_READWRITE); | 94 MEM_COMMIT, PAGE_READWRITE); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 if (NT_SUCCESS(result) && name->Buffer && name->Length) | 193 if (NT_SUCCESS(result) && name->Buffer && name->Length) |
194 handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t)); | 194 handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t)); |
195 else | 195 else |
196 handle_name->clear(); | 196 handle_name->clear(); |
197 | 197 |
198 return NT_SUCCESS(result); | 198 return NT_SUCCESS(result); |
199 } | 199 } |
200 | 200 |
201 } // namespace sandbox | 201 } // namespace sandbox |
OLD | NEW |