Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef SANDBOX_SRC_SYNC_POLICY_H__ |
michael@0 | 6 | #define SANDBOX_SRC_SYNC_POLICY_H__ |
michael@0 | 7 | |
michael@0 | 8 | #include <string> |
michael@0 | 9 | |
michael@0 | 10 | #include "base/basictypes.h" |
michael@0 | 11 | #include "sandbox/win/src/crosscall_server.h" |
michael@0 | 12 | #include "sandbox/win/src/nt_internals.h" |
michael@0 | 13 | #include "sandbox/win/src/policy_low_level.h" |
michael@0 | 14 | #include "sandbox/win/src/sandbox_policy.h" |
michael@0 | 15 | |
michael@0 | 16 | namespace sandbox { |
michael@0 | 17 | |
michael@0 | 18 | enum EvalResult; |
michael@0 | 19 | |
michael@0 | 20 | // This class centralizes most of the knowledge related to sync policy |
michael@0 | 21 | class SyncPolicy { |
michael@0 | 22 | public: |
michael@0 | 23 | // Creates the required low-level policy rules to evaluate a high-level |
michael@0 | 24 | // policy rule for sync calls, in particular open or create actions. |
michael@0 | 25 | // name is the sync object name, semantics is the desired semantics for the |
michael@0 | 26 | // open or create and policy is the policy generator to which the rules are |
michael@0 | 27 | // going to be added. |
michael@0 | 28 | static bool GenerateRules(const wchar_t* name, |
michael@0 | 29 | TargetPolicy::Semantics semantics, |
michael@0 | 30 | LowLevelPolicy* policy); |
michael@0 | 31 | |
michael@0 | 32 | // Performs the desired policy action on a request. |
michael@0 | 33 | // client_info is the target process that is making the request and |
michael@0 | 34 | // eval_result is the desired policy action to accomplish. |
michael@0 | 35 | static DWORD CreateEventAction(EvalResult eval_result, |
michael@0 | 36 | const ClientInfo& client_info, |
michael@0 | 37 | const std::wstring &event_name, |
michael@0 | 38 | uint32 manual_reset, |
michael@0 | 39 | uint32 initial_state, |
michael@0 | 40 | HANDLE *handle); |
michael@0 | 41 | static DWORD OpenEventAction(EvalResult eval_result, |
michael@0 | 42 | const ClientInfo& client_info, |
michael@0 | 43 | const std::wstring &event_name, |
michael@0 | 44 | uint32 desired_access, |
michael@0 | 45 | uint32 inherit_handle, |
michael@0 | 46 | HANDLE *handle); |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | } // namespace sandbox |
michael@0 | 50 | |
michael@0 | 51 | #endif // SANDBOX_SRC_SYNC_POLICY_H__ |