| 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/handle_closer_agent.h" | 5 #include "sandbox/win/src/handle_closer_agent.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "sandbox/win/src/nt_internals.h" | 8 #include "sandbox/win/src/nt_internals.h" |
| 9 #include "sandbox/win/src/win_utils.h" | 9 #include "sandbox/win/src/win_utils.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 SANDBOX_INTERCEPT HandleCloserInfo* g_handles_to_close = NULL; | 38 SANDBOX_INTERCEPT HandleCloserInfo* g_handles_to_close = NULL; |
| 39 | 39 |
| 40 bool HandleCloserAgent::NeedsHandlesClosed() { | 40 bool HandleCloserAgent::NeedsHandlesClosed() { |
| 41 return g_handles_to_close != NULL; | 41 return g_handles_to_close != NULL; |
| 42 } | 42 } |
| 43 | 43 |
| 44 HandleCloserAgent::HandleCloserAgent() | 44 HandleCloserAgent::HandleCloserAgent() |
| 45 : dummy_handle_(::CreateEvent(NULL, FALSE, FALSE, NULL)) { | 45 : dummy_handle_(::CreateEvent(NULL, FALSE, FALSE, NULL)) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 HandleCloserAgent::~HandleCloserAgent() { |
| 49 } |
| 50 |
| 48 // Attempts to stuff |closed_handle| with a duplicated handle for a dummy Event | 51 // Attempts to stuff |closed_handle| with a duplicated handle for a dummy Event |
| 49 // with no access. This should allow the handle to be closed, to avoid | 52 // with no access. This should allow the handle to be closed, to avoid |
| 50 // generating EXCEPTION_INVALID_HANDLE on shutdown, but nothing else. For now | 53 // generating EXCEPTION_INVALID_HANDLE on shutdown, but nothing else. For now |
| 51 // the only supported |type| is Event or File. | 54 // the only supported |type| is Event or File. |
| 52 bool HandleCloserAgent::AttemptToStuffHandleSlot(HANDLE closed_handle, | 55 bool HandleCloserAgent::AttemptToStuffHandleSlot(HANDLE closed_handle, |
| 53 const base::string16& type) { | 56 const base::string16& type) { |
| 54 // Only attempt to stuff Files and Events at the moment. | 57 // Only attempt to stuff Files and Events at the moment. |
| 55 if (type != L"Event" && type != L"File") { | 58 if (type != L"Event" && type != L"File") { |
| 56 return true; | 59 return true; |
| 57 } | 60 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 return false; | 185 return false; |
| 183 // Attempt to stuff this handle with a new dummy Event. | 186 // Attempt to stuff this handle with a new dummy Event. |
| 184 AttemptToStuffHandleSlot(handle, result->first); | 187 AttemptToStuffHandleSlot(handle, result->first); |
| 185 } | 188 } |
| 186 } | 189 } |
| 187 | 190 |
| 188 return true; | 191 return true; |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace sandbox | 194 } // namespace sandbox |
| OLD | NEW |