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) 2012 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_WIN_PROCESS_MITIGATIONS_H_ |
michael@0 | 6 | #define SANDBOX_SRC_WIN_PROCESS_MITIGATIONS_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include <windows.h> |
michael@0 | 9 | |
michael@0 | 10 | #include "base/basictypes.h" |
michael@0 | 11 | #include "sandbox/win/src/security_level.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace sandbox { |
michael@0 | 14 | |
michael@0 | 15 | // Sets the mitigation policy for the current process, ignoring any settings |
michael@0 | 16 | // that are invalid for the current version of Windows. |
michael@0 | 17 | bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags); |
michael@0 | 18 | |
michael@0 | 19 | // Returns the flags that must be enforced after startup for the current OS |
michael@0 | 20 | // version. |
michael@0 | 21 | MitigationFlags FilterPostStartupProcessMitigations(MitigationFlags flags); |
michael@0 | 22 | |
michael@0 | 23 | // Converts sandbox flags to the PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES |
michael@0 | 24 | // policy flags used by UpdateProcThreadAttribute(). The size field varies |
michael@0 | 25 | // between a 32-bit and a 64-bit type based on the exact build and version of |
michael@0 | 26 | // Windows, so the returned size must be passed to UpdateProcThreadAttribute(). |
michael@0 | 27 | void ConvertProcessMitigationsToPolicy(MitigationFlags flags, |
michael@0 | 28 | DWORD64* policy_flags, size_t* size); |
michael@0 | 29 | |
michael@0 | 30 | // Adds mitigations that need to be performed on the suspended target process |
michael@0 | 31 | // before execution begins. |
michael@0 | 32 | bool ApplyProcessMitigationsToSuspendedProcess(HANDLE process, |
michael@0 | 33 | MitigationFlags flags); |
michael@0 | 34 | |
michael@0 | 35 | // Returns true if all the supplied flags can be set after a process starts. |
michael@0 | 36 | bool CanSetProcessMitigationsPostStartup(MitigationFlags flags); |
michael@0 | 37 | |
michael@0 | 38 | // Returns true if all the supplied flags can be set before a process starts. |
michael@0 | 39 | bool CanSetProcessMitigationsPreStartup(MitigationFlags flags); |
michael@0 | 40 | |
michael@0 | 41 | } // namespace sandbox |
michael@0 | 42 | |
michael@0 | 43 | #endif // SANDBOX_SRC_WIN_PROCESS_MITIGATIONS_H_ |
michael@0 | 44 |