File indexing completed on 2025-01-30 10:02:27
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_WINAPI_JOBS_HPP_INCLUDED_
0009 #define BOOST_WINAPI_JOBS_HPP_INCLUDED_
0010
0011 #include <boost/winapi/config.hpp>
0012
0013 #ifdef BOOST_HAS_PRAGMA_ONCE
0014 #pragma once
0015 #endif
0016
0017 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K
0018
0019 #include <boost/winapi/basic_types.hpp>
0020 #include <boost/winapi/access_rights.hpp>
0021 #include <boost/winapi/detail/header.hpp>
0022
0023 #if !defined( BOOST_USE_WINDOWS_H )
0024 extern "C" {
0025 #if !defined( BOOST_NO_ANSI_APIS )
0026 #if BOOST_WINAPI_PARTITION_DESKTOP
0027 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC CreateJobObjectA(
0028 ::_SECURITY_ATTRIBUTES* lpJobAttributes,
0029 boost::winapi::LPCSTR_ lpName);
0030 #endif
0031 #endif
0032
0033 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0034 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC CreateJobObjectW(
0035 ::_SECURITY_ATTRIBUTES* lpJobAttributes,
0036 boost::winapi::LPCWSTR_ lpName);
0037
0038 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC AssignProcessToJobObject(
0039 boost::winapi::HANDLE_ hJob,
0040 boost::winapi::HANDLE_ hProcess);
0041
0042 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
0043 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC IsProcessInJob(
0044 boost::winapi::HANDLE_ ProcessHandle,
0045 boost::winapi::HANDLE_ JobHandle,
0046 boost::winapi::PBOOL_ Result);
0047 #endif
0048
0049 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC TerminateJobObject(
0050 boost::winapi::HANDLE_ hJob,
0051 boost::winapi::UINT_ uExitCode);
0052 #endif
0053 }
0054 #endif
0055
0056
0057 #if !defined( BOOST_USE_WINDOWS_H ) || defined( BOOST_WINAPI_IS_MINGW )
0058 extern "C" {
0059 #if !defined( BOOST_NO_ANSI_APIS )
0060 #if BOOST_WINAPI_PARTITION_DESKTOP
0061 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenJobObjectA(
0062 boost::winapi::DWORD_ dwDesiredAccess,
0063 boost::winapi::BOOL_ bInheritHandles,
0064 boost::winapi::LPCSTR_ lpName);
0065 #endif
0066 #endif
0067
0068 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0069 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenJobObjectW(
0070 boost::winapi::DWORD_ dwDesiredAccess,
0071 boost::winapi::BOOL_ bInheritHandles,
0072 boost::winapi::LPCWSTR_ lpName);
0073 #endif
0074 }
0075 #endif
0076
0077 namespace boost {
0078 namespace winapi {
0079
0080
0081 #if defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
0082 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_ASSIGN_PROCESS_ = JOB_OBJECT_ASSIGN_PROCESS;
0083 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_SET_ATTRIBUTES_ = JOB_OBJECT_SET_ATTRIBUTES;
0084 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_QUERY_ = JOB_OBJECT_QUERY;
0085 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_TERMINATE_ = JOB_OBJECT_TERMINATE;
0086 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_SET_SECURITY_ATTRIBUTES_ = JOB_OBJECT_SET_SECURITY_ATTRIBUTES;
0087 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_ALL_ACCESS_ = JOB_OBJECT_ALL_ACCESS;
0088 #else
0089 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_ASSIGN_PROCESS_ = 0x0001;
0090 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_SET_ATTRIBUTES_ = 0x0002;
0091 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_QUERY_ = 0x0004;
0092 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_TERMINATE_ = 0x0008;
0093 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_SET_SECURITY_ATTRIBUTES_ = 0x0010;
0094 BOOST_CONSTEXPR_OR_CONST DWORD_ JOB_OBJECT_ALL_ACCESS_ = (STANDARD_RIGHTS_REQUIRED_ | SYNCHRONIZE_ | 0x1F);
0095 #endif
0096
0097 #if BOOST_WINAPI_PARTITION_DESKTOP
0098 #if !defined( BOOST_NO_ANSI_APIS )
0099 BOOST_FORCEINLINE HANDLE_ CreateJobObjectA(LPSECURITY_ATTRIBUTES_ lpJobAttributes, LPCSTR_ lpName)
0100 {
0101 return ::CreateJobObjectA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpJobAttributes), lpName);
0102 }
0103
0104 BOOST_FORCEINLINE HANDLE_ create_job_object(LPSECURITY_ATTRIBUTES_ lpJobAttributes, LPCSTR_ lpName)
0105 {
0106 return ::CreateJobObjectA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpJobAttributes), lpName);
0107 }
0108
0109 using ::OpenJobObjectA;
0110
0111 BOOST_FORCEINLINE HANDLE_ open_job_object(DWORD_ dwDesiredAccess, BOOL_ bInheritHandles, LPCSTR_ lpName)
0112 {
0113 return ::OpenJobObjectA(dwDesiredAccess, bInheritHandles, lpName);
0114 }
0115 #endif
0116 #endif
0117
0118 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0119 using ::AssignProcessToJobObject;
0120 BOOST_FORCEINLINE HANDLE_ CreateJobObjectW(LPSECURITY_ATTRIBUTES_ lpJobAttributes, LPCWSTR_ lpName)
0121 {
0122 return ::CreateJobObjectW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpJobAttributes), lpName);
0123 }
0124
0125 BOOST_FORCEINLINE HANDLE_ create_job_object(LPSECURITY_ATTRIBUTES_ lpJobAttributes, LPCWSTR_ lpName)
0126 {
0127 return ::CreateJobObjectW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpJobAttributes), lpName);
0128 }
0129
0130 BOOST_FORCEINLINE HANDLE_ open_job_object(DWORD_ dwDesiredAccess, BOOL_ bInheritHandles, LPCWSTR_ lpName)
0131 {
0132 return ::OpenJobObjectW(dwDesiredAccess, bInheritHandles, lpName);
0133 }
0134
0135 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
0136 using ::IsProcessInJob;
0137 #endif
0138
0139 using ::OpenJobObjectW;
0140 using ::TerminateJobObject;
0141 #endif
0142
0143 }
0144 }
0145
0146 #include <boost/winapi/detail/footer.hpp>
0147
0148 #endif
0149 #endif