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 #ifndef SANDBOX_SRC_HANDLE_CLOSER_H_ | 5 #ifndef SANDBOX_SRC_HANDLE_CLOSER_H_ |
6 #define SANDBOX_SRC_HANDLE_CLOSER_H_ | 6 #define SANDBOX_SRC_HANDLE_CLOSER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 SANDBOX_INTERCEPT HandleCloserInfo* g_handle_closer_info; | 39 SANDBOX_INTERCEPT HandleCloserInfo* g_handle_closer_info; |
40 | 40 |
41 // Adds handles to close after lockdown. | 41 // Adds handles to close after lockdown. |
42 class HandleCloser { | 42 class HandleCloser { |
43 public: | 43 public: |
44 HandleCloser(); | 44 HandleCloser(); |
45 | 45 |
46 // Adds a handle that will be closed in the target process after lockdown. | 46 // Adds a handle that will be closed in the target process after lockdown. |
47 // A NULL value for handle_name indicates all handles of the specified type. | 47 // A NULL value for handle_name indicates all handles of the specified type. |
48 // An empty string for handle_name indicates the handle is unnamed. | 48 // An empty string for handle_name indicates the handle is unnamed. |
49 ResultCode HandleCloser::AddHandle(const char16* handle_type, | 49 ResultCode AddHandle(const char16* handle_type, const char16* handle_name); |
50 const char16* handle_name); | |
51 | 50 |
52 // Serializes and copies the closer table into the target process. | 51 // Serializes and copies the closer table into the target process. |
53 bool InitializeTargetHandles(TargetProcess* target); | 52 bool InitializeTargetHandles(TargetProcess* target); |
54 | 53 |
55 // Adds any interceptions that may be required due to closed system handles. | 54 // Adds any interceptions that may be required due to closed system handles. |
56 bool SetupHandleInterceptions(InterceptionManager* manager); | 55 bool SetupHandleInterceptions(InterceptionManager* manager); |
57 | 56 |
58 private: | 57 private: |
59 // Calculates the memory needed to copy the serialized handles list (rounded | 58 // Calculates the memory needed to copy the serialized handles list (rounded |
60 // to the nearest machine-word size). | 59 // to the nearest machine-word size). |
61 size_t GetBufferSize(); | 60 size_t GetBufferSize(); |
62 | 61 |
63 // Serializes the handle list into the target process. | 62 // Serializes the handle list into the target process. |
64 bool SetupHandleList(void* buffer, size_t buffer_bytes); | 63 bool SetupHandleList(void* buffer, size_t buffer_bytes); |
65 | 64 |
66 HandleMap handles_to_close_; | 65 HandleMap handles_to_close_; |
67 | 66 |
68 DISALLOW_COPY_AND_ASSIGN(HandleCloser); | 67 DISALLOW_COPY_AND_ASSIGN(HandleCloser); |
69 }; | 68 }; |
70 | 69 |
71 // Returns the object manager's name associated with a handle | 70 // Returns the object manager's name associated with a handle |
72 bool GetHandleName(HANDLE handle, string16* handle_name); | 71 bool GetHandleName(HANDLE handle, string16* handle_name); |
73 | 72 |
74 } // namespace sandbox | 73 } // namespace sandbox |
75 | 74 |
76 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ | 75 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ |
OLD | NEW |