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 "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 // Adds policy rules for unloaded the known dlls that cause chrome to crash. | 214 // Adds policy rules for unloaded the known dlls that cause chrome to crash. |
215 // Eviction of injected DLLs is done by the sandbox so that the injected module | 215 // Eviction of injected DLLs is done by the sandbox so that the injected module |
216 // does not get a chance to execute any code. | 216 // does not get a chance to execute any code. |
217 void AddGenericDllEvictionPolicy(sandbox::TargetPolicy* policy) { | 217 void AddGenericDllEvictionPolicy(sandbox::TargetPolicy* policy) { |
218 for (int ix = 0; ix != arraysize(kTroublesomeDlls); ++ix) | 218 for (int ix = 0; ix != arraysize(kTroublesomeDlls); ++ix) |
219 BlacklistAddOneDll(kTroublesomeDlls[ix], true, policy); | 219 BlacklistAddOneDll(kTroublesomeDlls[ix], true, policy); |
220 } | 220 } |
221 | 221 |
222 // Returns the object path prepended with the current logon session. | 222 // Returns the object path prepended with the current logon session. |
223 base::string16 PrependWindowsSessionPath(const char16* object) { | 223 base::string16 PrependWindowsSessionPath(const base::char16* object) { |
224 // Cache this because it can't change after process creation. | 224 // Cache this because it can't change after process creation. |
225 static uintptr_t s_session_id = 0; | 225 static uintptr_t s_session_id = 0; |
226 if (s_session_id == 0) { | 226 if (s_session_id == 0) { |
227 HANDLE token; | 227 HANDLE token; |
228 DWORD session_id_length; | 228 DWORD session_id_length; |
229 DWORD session_id = 0; | 229 DWORD session_id = 0; |
230 | 230 |
231 CHECK(::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)); | 231 CHECK(::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)); |
232 CHECK(::GetTokenInformation(token, TokenSessionId, &session_id, | 232 CHECK(::GetTokenInformation(token, TokenSessionId, &session_id, |
233 sizeof(session_id), &session_id_length)); | 233 sizeof(session_id), &session_id_length)); |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } | 739 } |
740 | 740 |
741 return false; | 741 return false; |
742 } | 742 } |
743 | 743 |
744 bool BrokerAddTargetPeer(HANDLE peer_process) { | 744 bool BrokerAddTargetPeer(HANDLE peer_process) { |
745 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 745 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
746 } | 746 } |
747 | 747 |
748 } // namespace content | 748 } // namespace content |
OLD | NEW |