1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_PROCESS_PROCESS_INFO_H_ 6 #define BASE_PROCESS_PROCESS_INFO_H_ 7 8 #include "base/base_export.h" 9 #include "base/process/process_handle.h" 10 #include "build/build_config.h" 11 12 namespace base { 13 14 #if BUILDFLAG(IS_WIN) 15 enum IntegrityLevel { 16 INTEGRITY_UNKNOWN, 17 UNTRUSTED_INTEGRITY, 18 LOW_INTEGRITY, 19 MEDIUM_INTEGRITY, 20 HIGH_INTEGRITY, 21 }; 22 23 // Returns the integrity level of the process with PID `process_id`. Returns 24 // INTEGRITY_UNKNOWN in the case of an underlying system failure. 25 BASE_EXPORT IntegrityLevel GetProcessIntegrityLevel(ProcessId process_id); 26 27 // Returns the integrity level of the process. Returns INTEGRITY_UNKNOWN in the 28 // case of an underlying system failure. 29 BASE_EXPORT IntegrityLevel GetCurrentProcessIntegrityLevel(); 30 31 // Determines whether the current process is elevated. Note: in some 32 // configurations this may be true for processes launched without using 33 // LaunchOptions::elevated. 34 BASE_EXPORT bool IsCurrentProcessElevated(); 35 36 // Determines whether the current process is running within an App Container. 37 BASE_EXPORT bool IsCurrentProcessInAppContainer(); 38 39 #endif // BUILDFLAG(IS_WIN) 40 41 #if BUILDFLAG(IS_MAC) 42 // Returns whether the current process is responsible for itself. See 43 // https://bugs.chromium.org/p/chromium/issues/detail?id=945969 and 44 // https://bugs.chromium.org/p/chromium/issues/detail?id=996993. 45 // 46 // On versions of macOS that do not have the concept, this will always return 47 // true. 48 BASE_EXPORT bool IsProcessSelfResponsible(); 49 #endif 50 51 } // namespace base 52 53 #endif // BASE_PROCESS_PROCESS_INFO_H_ 54