File indexing completed on 2025-01-18 09:53:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_WINAPI_INIT_ONCE_HPP_INCLUDED_
0010 #define BOOST_WINAPI_INIT_ONCE_HPP_INCLUDED_
0011
0012 #include <boost/winapi/config.hpp>
0013
0014 #ifdef BOOST_HAS_PRAGMA_ONCE
0015 #pragma once
0016 #endif
0017
0018 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0019
0020 #include <boost/winapi/basic_types.hpp>
0021 #include <boost/winapi/detail/header.hpp>
0022
0023 #if !defined(BOOST_USE_WINDOWS_H)
0024 extern "C" {
0025 #if defined(BOOST_WINAPI_IS_CYGWIN) || defined(BOOST_WINAPI_IS_MINGW_W64)
0026 struct _RTL_RUN_ONCE;
0027 #else
0028 union _RTL_RUN_ONCE;
0029 #endif
0030
0031 typedef boost::winapi::BOOL_
0032 (BOOST_WINAPI_WINAPI_CC *PINIT_ONCE_FN) (
0033 ::_RTL_RUN_ONCE* InitOnce,
0034 boost::winapi::PVOID_ Parameter,
0035 boost::winapi::PVOID_ *Context);
0036
0037 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0038 InitOnceInitialize(::_RTL_RUN_ONCE* InitOnce);
0039
0040 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0041 InitOnceExecuteOnce(
0042 ::_RTL_RUN_ONCE* InitOnce,
0043 ::PINIT_ONCE_FN InitFn,
0044 boost::winapi::PVOID_ Parameter,
0045 boost::winapi::LPVOID_ *Context);
0046
0047 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0048 InitOnceBeginInitialize(
0049 ::_RTL_RUN_ONCE* lpInitOnce,
0050 boost::winapi::DWORD_ dwFlags,
0051 boost::winapi::PBOOL_ fPending,
0052 boost::winapi::LPVOID_ *lpContext);
0053
0054 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0055 InitOnceComplete(
0056 ::_RTL_RUN_ONCE* lpInitOnce,
0057 boost::winapi::DWORD_ dwFlags,
0058 boost::winapi::LPVOID_ lpContext);
0059 }
0060 #endif
0061
0062 namespace boost {
0063 namespace winapi {
0064
0065 typedef union BOOST_MAY_ALIAS _RTL_RUN_ONCE {
0066 PVOID_ Ptr;
0067 } INIT_ONCE_, *PINIT_ONCE_, *LPINIT_ONCE_;
0068
0069 extern "C" {
0070 typedef BOOL_ (BOOST_WINAPI_WINAPI_CC *PINIT_ONCE_FN_) (PINIT_ONCE_ lpInitOnce, PVOID_ Parameter, PVOID_ *Context);
0071 }
0072
0073 BOOST_FORCEINLINE VOID_ InitOnceInitialize(PINIT_ONCE_ lpInitOnce)
0074 {
0075 ::InitOnceInitialize(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce));
0076 }
0077
0078 BOOST_FORCEINLINE BOOL_ InitOnceExecuteOnce(PINIT_ONCE_ lpInitOnce, PINIT_ONCE_FN_ InitFn, PVOID_ Parameter, LPVOID_ *Context)
0079 {
0080 return ::InitOnceExecuteOnce(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), reinterpret_cast< ::PINIT_ONCE_FN >(InitFn), Parameter, Context);
0081 }
0082
0083 BOOST_FORCEINLINE BOOL_ InitOnceBeginInitialize(PINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, PBOOL_ fPending, LPVOID_ *lpContext)
0084 {
0085 return ::InitOnceBeginInitialize(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), dwFlags, fPending, lpContext);
0086 }
0087
0088 BOOST_FORCEINLINE BOOL_ InitOnceComplete(PINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, LPVOID_ lpContext)
0089 {
0090 return ::InitOnceComplete(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), dwFlags, lpContext);
0091 }
0092
0093 #if defined( BOOST_USE_WINDOWS_H )
0094
0095 #define BOOST_WINAPI_INIT_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT
0096 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_ASYNC_ = INIT_ONCE_ASYNC;
0097 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_CHECK_ONLY_ = INIT_ONCE_CHECK_ONLY;
0098 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_INIT_FAILED_ = INIT_ONCE_INIT_FAILED;
0099 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_CTX_RESERVED_BITS_ = INIT_ONCE_CTX_RESERVED_BITS;
0100
0101 #else
0102
0103 #define BOOST_WINAPI_INIT_ONCE_STATIC_INIT {0}
0104 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_ASYNC_ = 0x00000002UL;
0105 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_CHECK_ONLY_ = 0x00000001UL;
0106 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_INIT_FAILED_ = 0x00000004UL;
0107 BOOST_CONSTEXPR_OR_CONST DWORD_ INIT_ONCE_CTX_RESERVED_BITS_ = 2;
0108
0109 #endif
0110
0111 BOOST_CONSTEXPR_OR_CONST DWORD_ init_once_async = INIT_ONCE_ASYNC_;
0112 BOOST_CONSTEXPR_OR_CONST DWORD_ init_once_check_only = INIT_ONCE_CHECK_ONLY_;
0113 BOOST_CONSTEXPR_OR_CONST DWORD_ init_once_init_failed = INIT_ONCE_INIT_FAILED_;
0114 BOOST_CONSTEXPR_OR_CONST DWORD_ init_once_ctx_reserved_bits = INIT_ONCE_CTX_RESERVED_BITS_;
0115
0116 }
0117 }
0118
0119 #include <boost/winapi/detail/footer.hpp>
0120
0121 #endif
0122
0123 #endif