Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:27

0001 /*
0002  * Copyright 2010 Vicente J. Botet Escriba
0003  * Copyright 2015, 2017 Andrey Semashev
0004  *
0005  * Distributed under the Boost Software License, Version 1.0.
0006  * See http://www.boost.org/LICENSE_1_0.txt
0007  */
0008 
0009 #ifndef BOOST_WINAPI_EVENT_HPP_INCLUDED_
0010 #define BOOST_WINAPI_EVENT_HPP_INCLUDED_
0011 
0012 #include <boost/winapi/basic_types.hpp>
0013 #include <boost/winapi/detail/header.hpp>
0014 
0015 #ifdef BOOST_HAS_PRAGMA_ONCE
0016 #pragma once
0017 #endif
0018 
0019 #if !defined( BOOST_USE_WINDOWS_H ) && BOOST_WINAPI_PARTITION_APP_SYSTEM
0020 extern "C" {
0021 #if !defined( BOOST_NO_ANSI_APIS )
0022 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0023 CreateEventA(
0024     ::_SECURITY_ATTRIBUTES* lpEventAttributes,
0025     boost::winapi::BOOL_ bManualReset,
0026     boost::winapi::BOOL_ bInitialState,
0027     boost::winapi::LPCSTR_ lpName);
0028 #endif
0029 
0030 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0031 CreateEventW(
0032     ::_SECURITY_ATTRIBUTES* lpEventAttributes,
0033     boost::winapi::BOOL_ bManualReset,
0034     boost::winapi::BOOL_ bInitialState,
0035     boost::winapi::LPCWSTR_ lpName);
0036 } // extern "C"
0037 #endif // !defined( BOOST_USE_WINDOWS_H ) && BOOST_WINAPI_PARTITION_APP_SYSTEM
0038 
0039 #if !defined( BOOST_USE_WINDOWS_H )
0040 extern "C" {
0041 #if !defined( BOOST_NO_ANSI_APIS )
0042 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0043 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0044 CreateEventExA(
0045     ::_SECURITY_ATTRIBUTES *lpEventAttributes,
0046     boost::winapi::LPCSTR_ lpName,
0047     boost::winapi::DWORD_ dwFlags,
0048     boost::winapi::DWORD_ dwDesiredAccess);
0049 #endif
0050 
0051 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0052 OpenEventA(
0053     boost::winapi::DWORD_ dwDesiredAccess,
0054     boost::winapi::BOOL_ bInheritHandle,
0055     boost::winapi::LPCSTR_ lpName);
0056 #endif // !defined( BOOST_NO_ANSI_APIS )
0057 
0058 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0059 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0060 CreateEventExW(
0061     ::_SECURITY_ATTRIBUTES *lpEventAttributes,
0062     boost::winapi::LPCWSTR_ lpName,
0063     boost::winapi::DWORD_ dwFlags,
0064     boost::winapi::DWORD_ dwDesiredAccess);
0065 #endif
0066 
0067 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0068 OpenEventW(
0069     boost::winapi::DWORD_ dwDesiredAccess,
0070     boost::winapi::BOOL_ bInheritHandle,
0071     boost::winapi::LPCWSTR_ lpName);
0072 
0073 // Windows CE define SetEvent/ResetEvent as inline functions in kfuncs.h
0074 #if !defined( UNDER_CE )
0075 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0076 SetEvent(boost::winapi::HANDLE_ hEvent);
0077 
0078 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0079 ResetEvent(boost::winapi::HANDLE_ hEvent);
0080 #endif
0081 } // extern "C"
0082 #endif
0083 
0084 namespace boost {
0085 namespace winapi {
0086 
0087 #if !defined( BOOST_NO_ANSI_APIS )
0088 using ::OpenEventA;
0089 #endif
0090 using ::OpenEventW;
0091 using ::SetEvent;
0092 using ::ResetEvent;
0093 
0094 #if defined( BOOST_USE_WINDOWS_H )
0095 
0096 BOOST_CONSTEXPR_OR_CONST DWORD_ EVENT_ALL_ACCESS_ = EVENT_ALL_ACCESS;
0097 BOOST_CONSTEXPR_OR_CONST DWORD_ EVENT_MODIFY_STATE_ = EVENT_MODIFY_STATE;
0098 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0099 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_EVENT_INITIAL_SET_ = CREATE_EVENT_INITIAL_SET;
0100 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_EVENT_MANUAL_RESET_ = CREATE_EVENT_MANUAL_RESET;
0101 #endif
0102 
0103 #else // defined( BOOST_USE_WINDOWS_H )
0104 
0105 BOOST_CONSTEXPR_OR_CONST DWORD_ EVENT_ALL_ACCESS_ = 0x001F0003;
0106 BOOST_CONSTEXPR_OR_CONST DWORD_ EVENT_MODIFY_STATE_ = 0x00000002;
0107 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0108 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_EVENT_INITIAL_SET_ = 0x00000002;
0109 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_EVENT_MANUAL_RESET_ = 0x00000001;
0110 #endif
0111 
0112 #endif // defined( BOOST_USE_WINDOWS_H )
0113 
0114 // Undocumented and not present in Windows SDK. Enables NtQueryEvent.
0115 // http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FEvent%2FNtQueryEvent.html
0116 BOOST_CONSTEXPR_OR_CONST DWORD_ EVENT_QUERY_STATE_ = 0x00000001;
0117 
0118 BOOST_CONSTEXPR_OR_CONST DWORD_ event_all_access = EVENT_ALL_ACCESS_;
0119 BOOST_CONSTEXPR_OR_CONST DWORD_ event_modify_state = EVENT_MODIFY_STATE_;
0120 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0121 BOOST_CONSTEXPR_OR_CONST DWORD_ create_event_initial_set = CREATE_EVENT_INITIAL_SET_;
0122 BOOST_CONSTEXPR_OR_CONST DWORD_ create_event_manual_reset = CREATE_EVENT_MANUAL_RESET_;
0123 #endif
0124 
0125 #if !defined( BOOST_NO_ANSI_APIS )
0126 BOOST_FORCEINLINE HANDLE_ CreateEventA(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCSTR_ lpName)
0127 {
0128 #if !BOOST_WINAPI_PARTITION_APP_SYSTEM && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0129     const DWORD_ flags = (bManualReset ? create_event_manual_reset : 0u) | (bInitialState ? create_event_initial_set : 0u);
0130     return ::CreateEventExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, flags, event_all_access);
0131 #else
0132     return ::CreateEventA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), bManualReset, bInitialState, lpName);
0133 #endif
0134 }
0135 
0136 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0137 BOOST_FORCEINLINE HANDLE_ CreateEventExA(SECURITY_ATTRIBUTES_* lpEventAttributes, LPCSTR_ lpName, DWORD_ dwFlags, DWORD_ dwDesiredAccess)
0138 {
0139     return ::CreateEventExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, dwFlags, dwDesiredAccess);
0140 }
0141 #endif
0142 #endif
0143 
0144 BOOST_FORCEINLINE HANDLE_ CreateEventW(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCWSTR_ lpName)
0145 {
0146 #if !BOOST_WINAPI_PARTITION_APP_SYSTEM && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0147     const DWORD_ flags = (bManualReset ? create_event_manual_reset : 0u) | (bInitialState ? create_event_initial_set : 0u);
0148     return ::CreateEventExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, flags, event_all_access);
0149 #else
0150     return ::CreateEventW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), bManualReset, bInitialState, lpName);
0151 #endif
0152 }
0153 
0154 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0155 BOOST_FORCEINLINE HANDLE_ CreateEventExW(SECURITY_ATTRIBUTES_* lpEventAttributes, LPCWSTR_ lpName, DWORD_ dwFlags, DWORD_ dwDesiredAccess)
0156 {
0157     return ::CreateEventExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, dwFlags, dwDesiredAccess);
0158 }
0159 #endif
0160 
0161 #if !defined( BOOST_NO_ANSI_APIS )
0162 BOOST_FORCEINLINE HANDLE_ create_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCSTR_ lpName)
0163 {
0164     return winapi::CreateEventA(lpEventAttributes, bManualReset, bInitialState, lpName);
0165 }
0166 
0167 BOOST_FORCEINLINE HANDLE_ open_event(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName)
0168 {
0169     return ::OpenEventA(dwDesiredAccess, bInheritHandle, lpName);
0170 }
0171 #endif
0172 
0173 BOOST_FORCEINLINE HANDLE_ create_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCWSTR_ lpName)
0174 {
0175     return winapi::CreateEventW(lpEventAttributes, bManualReset, bInitialState, lpName);
0176 }
0177 
0178 BOOST_FORCEINLINE HANDLE_ open_event(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName)
0179 {
0180     return ::OpenEventW(dwDesiredAccess, bInheritHandle, lpName);
0181 }
0182 
0183 BOOST_FORCEINLINE HANDLE_ create_anonymous_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState)
0184 {
0185     return winapi::CreateEventW(lpEventAttributes, bManualReset, bInitialState, 0);
0186 }
0187 
0188 }
0189 }
0190 
0191 #include <boost/winapi/detail/footer.hpp>
0192 
0193 #endif // BOOST_WINAPI_EVENT_HPP_INCLUDED_