| 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/target_services.h" | 5 #include "sandbox/win/src/target_services.h" |
| 6 | 6 |
| 7 #include <process.h> | 7 #include <process.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // although this behavior is undocumented and there is no guarantee that in | 39 // although this behavior is undocumented and there is no guarantee that in |
| 40 // fact this will happen in future versions of windows. | 40 // fact this will happen in future versions of windows. |
| 41 bool FlushCachedRegHandles() { | 41 bool FlushCachedRegHandles() { |
| 42 return (FlushRegKey(HKEY_LOCAL_MACHINE) && | 42 return (FlushRegKey(HKEY_LOCAL_MACHINE) && |
| 43 FlushRegKey(HKEY_CLASSES_ROOT) && | 43 FlushRegKey(HKEY_CLASSES_ROOT) && |
| 44 FlushRegKey(HKEY_USERS)); | 44 FlushRegKey(HKEY_USERS)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Checks if we have handle entries pending and runs the closer. | 47 // Checks if we have handle entries pending and runs the closer. |
| 48 bool CloseOpenHandles() { | 48 bool CloseOpenHandles() { |
| 49 // Windows 10 has FLG_ENABLE_HANDLE_EXCEPTIONS enabled by default so causes | |
| 50 // exceptions to be raised if target process attempts to close a handle that | |
| 51 // has already been closed by HandleCloser. Therefore, do not close any | |
| 52 // handles on Windows 10 until this flag is removed by MS. | |
| 53 // See crbug.com/452613. | |
| 54 if (base::win::GetVersion() == base::win::VERSION_WIN10) | |
| 55 return true; | |
| 56 if (sandbox::HandleCloserAgent::NeedsHandlesClosed()) { | 49 if (sandbox::HandleCloserAgent::NeedsHandlesClosed()) { |
| 57 sandbox::HandleCloserAgent handle_closer; | 50 sandbox::HandleCloserAgent handle_closer; |
| 58 | 51 |
| 59 handle_closer.InitializeHandlesToClose(); | 52 handle_closer.InitializeHandlesToClose(); |
| 60 if (!handle_closer.CloseHandles()) | 53 if (!handle_closer.CloseHandles()) |
| 61 return false; | 54 return false; |
| 62 } | 55 } |
| 63 | 56 |
| 64 return true; | 57 return true; |
| 65 } | 58 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 ResultCode TargetServicesBase::DuplicateHandle(HANDLE source_handle, | 186 ResultCode TargetServicesBase::DuplicateHandle(HANDLE source_handle, |
| 194 DWORD target_process_id, | 187 DWORD target_process_id, |
| 195 HANDLE* target_handle, | 188 HANDLE* target_handle, |
| 196 DWORD desired_access, | 189 DWORD desired_access, |
| 197 DWORD options) { | 190 DWORD options) { |
| 198 return sandbox::DuplicateHandleProxy(source_handle, target_process_id, | 191 return sandbox::DuplicateHandleProxy(source_handle, target_process_id, |
| 199 target_handle, desired_access, options); | 192 target_handle, desired_access, options); |
| 200 } | 193 } |
| 201 | 194 |
| 202 } // namespace sandbox | 195 } // namespace sandbox |
| OLD | NEW |