1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/win/src/registry_policy.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef SANDBOX_SRC_REGISTRY_POLICY_H__ 1.9 +#define SANDBOX_SRC_REGISTRY_POLICY_H__ 1.10 + 1.11 +#include <string> 1.12 + 1.13 +#include "base/basictypes.h" 1.14 +#include "sandbox/win/src/crosscall_server.h" 1.15 +#include "sandbox/win/src/nt_internals.h" 1.16 +#include "sandbox/win/src/policy_low_level.h" 1.17 +#include "sandbox/win/src/sandbox_policy.h" 1.18 + 1.19 +namespace sandbox { 1.20 + 1.21 +enum EvalResult; 1.22 + 1.23 +// This class centralizes most of the knowledge related to registry policy 1.24 +class RegistryPolicy { 1.25 + public: 1.26 + // Creates the required low-level policy rules to evaluate a high-level 1.27 + // policy rule for registry IO, in particular open or create actions. 1.28 + static bool GenerateRules(const wchar_t* name, 1.29 + TargetPolicy::Semantics semantics, 1.30 + LowLevelPolicy* policy); 1.31 + 1.32 + // Performs the desired policy action on a create request with an 1.33 + // API that is compatible with the IPC-received parameters. 1.34 + static bool CreateKeyAction(EvalResult eval_result, 1.35 + const ClientInfo& client_info, 1.36 + const std::wstring &key, 1.37 + uint32 attributes, 1.38 + HANDLE root_directory, 1.39 + uint32 desired_access, 1.40 + uint32 title_index, 1.41 + uint32 create_options, 1.42 + HANDLE* handle, 1.43 + NTSTATUS* nt_status, 1.44 + ULONG* disposition); 1.45 + 1.46 + // Performs the desired policy action on an open request with an 1.47 + // API that is compatible with the IPC-received parameters. 1.48 + static bool OpenKeyAction(EvalResult eval_result, 1.49 + const ClientInfo& client_info, 1.50 + const std::wstring &key, 1.51 + uint32 attributes, 1.52 + HANDLE root_directory, 1.53 + uint32 desired_access, 1.54 + HANDLE* handle, 1.55 + NTSTATUS* nt_status); 1.56 +}; 1.57 + 1.58 +} // namespace sandbox 1.59 + 1.60 +#endif // SANDBOX_SRC_REGISTRY_POLICY_H__