OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_REGISTRY_POLICY_H__ | 5 #ifndef SANDBOX_SRC_REGISTRY_POLICY_H__ |
6 #define SANDBOX_SRC_REGISTRY_POLICY_H__ | 6 #define SANDBOX_SRC_REGISTRY_POLICY_H__ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <string> | 8 #include <string> |
11 | 9 |
| 10 #include "base/basictypes.h" |
12 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
13 #include "sandbox/win/src/crosscall_server.h" | 12 #include "sandbox/win/src/crosscall_server.h" |
14 #include "sandbox/win/src/nt_internals.h" | 13 #include "sandbox/win/src/nt_internals.h" |
15 #include "sandbox/win/src/policy_low_level.h" | 14 #include "sandbox/win/src/policy_low_level.h" |
16 #include "sandbox/win/src/sandbox_policy.h" | 15 #include "sandbox/win/src/sandbox_policy.h" |
17 | 16 |
18 namespace sandbox { | 17 namespace sandbox { |
19 | 18 |
20 enum EvalResult; | 19 enum EvalResult; |
21 | 20 |
22 // This class centralizes most of the knowledge related to registry policy | 21 // This class centralizes most of the knowledge related to registry policy |
23 class RegistryPolicy { | 22 class RegistryPolicy { |
24 public: | 23 public: |
25 // Creates the required low-level policy rules to evaluate a high-level | 24 // Creates the required low-level policy rules to evaluate a high-level |
26 // policy rule for registry IO, in particular open or create actions. | 25 // policy rule for registry IO, in particular open or create actions. |
27 static bool GenerateRules(const wchar_t* name, | 26 static bool GenerateRules(const wchar_t* name, |
28 TargetPolicy::Semantics semantics, | 27 TargetPolicy::Semantics semantics, |
29 LowLevelPolicy* policy); | 28 LowLevelPolicy* policy); |
30 | 29 |
31 // Performs the desired policy action on a create request with an | 30 // Performs the desired policy action on a create request with an |
32 // API that is compatible with the IPC-received parameters. | 31 // API that is compatible with the IPC-received parameters. |
33 static bool CreateKeyAction(EvalResult eval_result, | 32 static bool CreateKeyAction(EvalResult eval_result, |
34 const ClientInfo& client_info, | 33 const ClientInfo& client_info, |
35 const base::string16& key, | 34 const base::string16 &key, |
36 uint32_t attributes, | 35 uint32 attributes, |
37 HANDLE root_directory, | 36 HANDLE root_directory, |
38 uint32_t desired_access, | 37 uint32 desired_access, |
39 uint32_t title_index, | 38 uint32 title_index, |
40 uint32_t create_options, | 39 uint32 create_options, |
41 HANDLE* handle, | 40 HANDLE* handle, |
42 NTSTATUS* nt_status, | 41 NTSTATUS* nt_status, |
43 ULONG* disposition); | 42 ULONG* disposition); |
44 | 43 |
45 // Performs the desired policy action on an open request with an | 44 // Performs the desired policy action on an open request with an |
46 // API that is compatible with the IPC-received parameters. | 45 // API that is compatible with the IPC-received parameters. |
47 static bool OpenKeyAction(EvalResult eval_result, | 46 static bool OpenKeyAction(EvalResult eval_result, |
48 const ClientInfo& client_info, | 47 const ClientInfo& client_info, |
49 const base::string16& key, | 48 const base::string16 &key, |
50 uint32_t attributes, | 49 uint32 attributes, |
51 HANDLE root_directory, | 50 HANDLE root_directory, |
52 uint32_t desired_access, | 51 uint32 desired_access, |
53 HANDLE* handle, | 52 HANDLE* handle, |
54 NTSTATUS* nt_status); | 53 NTSTATUS* nt_status); |
55 }; | 54 }; |
56 | 55 |
57 } // namespace sandbox | 56 } // namespace sandbox |
58 | 57 |
59 #endif // SANDBOX_SRC_REGISTRY_POLICY_H__ | 58 #endif // SANDBOX_SRC_REGISTRY_POLICY_H__ |
OLD | NEW |