michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef SANDBOX_SRC_REGISTRY_POLICY_H__ michael@0: #define SANDBOX_SRC_REGISTRY_POLICY_H__ michael@0: michael@0: #include michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "sandbox/win/src/crosscall_server.h" michael@0: #include "sandbox/win/src/nt_internals.h" michael@0: #include "sandbox/win/src/policy_low_level.h" michael@0: #include "sandbox/win/src/sandbox_policy.h" michael@0: michael@0: namespace sandbox { michael@0: michael@0: enum EvalResult; michael@0: michael@0: // This class centralizes most of the knowledge related to registry policy michael@0: class RegistryPolicy { michael@0: public: michael@0: // Creates the required low-level policy rules to evaluate a high-level michael@0: // policy rule for registry IO, in particular open or create actions. michael@0: static bool GenerateRules(const wchar_t* name, michael@0: TargetPolicy::Semantics semantics, michael@0: LowLevelPolicy* policy); michael@0: michael@0: // Performs the desired policy action on a create request with an michael@0: // API that is compatible with the IPC-received parameters. michael@0: static bool CreateKeyAction(EvalResult eval_result, michael@0: const ClientInfo& client_info, michael@0: const std::wstring &key, michael@0: uint32 attributes, michael@0: HANDLE root_directory, michael@0: uint32 desired_access, michael@0: uint32 title_index, michael@0: uint32 create_options, michael@0: HANDLE* handle, michael@0: NTSTATUS* nt_status, michael@0: ULONG* disposition); michael@0: michael@0: // Performs the desired policy action on an open request with an michael@0: // API that is compatible with the IPC-received parameters. michael@0: static bool OpenKeyAction(EvalResult eval_result, michael@0: const ClientInfo& client_info, michael@0: const std::wstring &key, michael@0: uint32 attributes, michael@0: HANDLE root_directory, michael@0: uint32 desired_access, michael@0: HANDLE* handle, michael@0: NTSTATUS* nt_status); michael@0: }; michael@0: michael@0: } // namespace sandbox michael@0: michael@0: #endif // SANDBOX_SRC_REGISTRY_POLICY_H__