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 #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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "sandbox/win/src/interception.h" | 13 #include "sandbox/win/src/interception.h" |
14 #include "sandbox/win/src/sandbox_types.h" | 14 #include "sandbox/win/src/sandbox_types.h" |
15 #include "sandbox/win/src/target_process.h" | 15 #include "sandbox/win/src/target_process.h" |
16 | 16 |
17 namespace sandbox { | 17 namespace sandbox { |
18 | 18 |
19 // This is a map of handle-types to names that we need to close in the | 19 // This is a map of handle-types to names that we need to close in the |
20 // target process. A null set means we need to close all handles of the | 20 // target process. A null set means we need to close all handles of the |
21 // given type. | 21 // given type. |
22 typedef std::map<const base::string16, std::set<const base::string16> > | 22 typedef std::map<const base::string16, std::set<base::string16> > HandleMap; |
23 HandleMap; | |
24 | 23 |
25 // Type and set of corresponding handle names to close. | 24 // Type and set of corresponding handle names to close. |
26 struct HandleListEntry { | 25 struct HandleListEntry { |
27 size_t record_bytes; // Rounded to sizeof(size_t) bytes. | 26 size_t record_bytes; // Rounded to sizeof(size_t) bytes. |
28 size_t offset_to_names; // Nul terminated strings of name_count names. | 27 size_t offset_to_names; // Nul terminated strings of name_count names. |
29 size_t name_count; | 28 size_t name_count; |
30 base::char16 handle_type[1]; | 29 base::char16 handle_type[1]; |
31 }; | 30 }; |
32 | 31 |
33 // Global parameters and a pointer to the list of entries. | 32 // Global parameters and a pointer to the list of entries. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 64 |
66 DISALLOW_COPY_AND_ASSIGN(HandleCloser); | 65 DISALLOW_COPY_AND_ASSIGN(HandleCloser); |
67 }; | 66 }; |
68 | 67 |
69 // Returns the object manager's name associated with a handle | 68 // Returns the object manager's name associated with a handle |
70 bool GetHandleName(HANDLE handle, base::string16* handle_name); | 69 bool GetHandleName(HANDLE handle, base::string16* handle_name); |
71 | 70 |
72 } // namespace sandbox | 71 } // namespace sandbox |
73 | 72 |
74 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ | 73 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ |
OLD | NEW |