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 Andrey Semashev
0004  * Copyright 2016 Jorge Lodos
0005  *
0006  * Distributed under the Boost Software License, Version 1.0.
0007  * See http://www.boost.org/LICENSE_1_0.txt
0008  */
0009 
0010 #ifndef BOOST_WINAPI_ERROR_HANDLING_HPP_INCLUDED_
0011 #define BOOST_WINAPI_ERROR_HANDLING_HPP_INCLUDED_
0012 
0013 #include <stdarg.h>
0014 #include <boost/winapi/basic_types.hpp>
0015 #include <boost/winapi/get_last_error.hpp>
0016 #include <boost/winapi/detail/header.hpp>
0017 
0018 #ifdef BOOST_HAS_PRAGMA_ONCE
0019 #pragma once
0020 #endif
0021 
0022 #if !defined( BOOST_USE_WINDOWS_H )
0023 extern "C" {
0024 #if !defined( BOOST_NO_ANSI_APIS )
0025 BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
0026 FormatMessageA(
0027     boost::winapi::DWORD_ dwFlags,
0028     boost::winapi::LPCVOID_ lpSource,
0029     boost::winapi::DWORD_ dwMessageId,
0030     boost::winapi::DWORD_ dwLanguageId,
0031     boost::winapi::LPSTR_ lpBuffer,
0032     boost::winapi::DWORD_ nSize,
0033     va_list *Arguments);
0034 #endif
0035 
0036 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
0037 FormatMessageW(
0038     boost::winapi::DWORD_ dwFlags,
0039     boost::winapi::LPCVOID_ lpSource,
0040     boost::winapi::DWORD_ dwMessageId,
0041     boost::winapi::DWORD_ dwLanguageId,
0042     boost::winapi::LPWSTR_ lpBuffer,
0043     boost::winapi::DWORD_ nSize,
0044     va_list *Arguments);
0045 
0046 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0047 BOOST_WINAPI_IMPORT boost::winapi::UINT_ BOOST_WINAPI_WINAPI_CC
0048 SetErrorMode(boost::winapi::UINT_ uMode);
0049 #endif
0050 } // extern "C"
0051 #endif
0052 
0053 namespace boost {
0054 namespace winapi {
0055 
0056 #if defined( BOOST_USE_WINDOWS_H )
0057 
0058 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0059 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_ALLOCATE_BUFFER_= FORMAT_MESSAGE_ALLOCATE_BUFFER;
0060 #endif
0061 
0062 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_IGNORE_INSERTS_=  FORMAT_MESSAGE_IGNORE_INSERTS;
0063 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_STRING_=     FORMAT_MESSAGE_FROM_STRING;
0064 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_HMODULE_=    FORMAT_MESSAGE_FROM_HMODULE;
0065 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_SYSTEM_=     FORMAT_MESSAGE_FROM_SYSTEM;
0066 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_ARGUMENT_ARRAY_=  FORMAT_MESSAGE_ARGUMENT_ARRAY;
0067 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_MAX_WIDTH_MASK_=  FORMAT_MESSAGE_MAX_WIDTH_MASK;
0068 
0069 BOOST_CONSTEXPR_OR_CONST WORD_ LANG_NEUTRAL_=                  LANG_NEUTRAL;
0070 BOOST_CONSTEXPR_OR_CONST WORD_ LANG_INVARIANT_=                LANG_INVARIANT;
0071 
0072 BOOST_CONSTEXPR_OR_CONST WORD_ SUBLANG_DEFAULT_=               SUBLANG_DEFAULT;    // user default
0073 
0074 BOOST_FORCEINLINE BOOST_CONSTEXPR WORD_ MAKELANGID_(WORD_ p, WORD_ s) BOOST_NOEXCEPT
0075 {
0076     return static_cast< WORD_ >(MAKELANGID(p, s));
0077 }
0078 
0079 #if BOOST_WINAPI_PARTITION_DESKTOP
0080 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_FAILCRITICALERRORS_ =     SEM_FAILCRITICALERRORS;
0081 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOGPFAULTERRORBOX_ =      SEM_NOGPFAULTERRORBOX;
0082 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOALIGNMENTFAULTEXCEPT_ = SEM_NOALIGNMENTFAULTEXCEPT;
0083 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOOPENFILEERRORBOX_ =     SEM_NOOPENFILEERRORBOX;
0084 #endif
0085 
0086 #else
0087 
0088 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0089 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_ALLOCATE_BUFFER_= 0x00000100;
0090 #endif
0091 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_IGNORE_INSERTS_=  0x00000200;
0092 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_STRING_=     0x00000400;
0093 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_HMODULE_=    0x00000800;
0094 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_FROM_SYSTEM_=     0x00001000;
0095 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_ARGUMENT_ARRAY_=  0x00002000;
0096 BOOST_CONSTEXPR_OR_CONST DWORD_ FORMAT_MESSAGE_MAX_WIDTH_MASK_=  0x000000FF;
0097 
0098 BOOST_CONSTEXPR_OR_CONST WORD_ LANG_NEUTRAL_=                  0x00;
0099 BOOST_CONSTEXPR_OR_CONST WORD_ LANG_INVARIANT_=                0x7f;
0100 
0101 BOOST_CONSTEXPR_OR_CONST WORD_ SUBLANG_DEFAULT_=               0x01;    // user default
0102 
0103 BOOST_FORCEINLINE BOOST_CONSTEXPR WORD_ MAKELANGID_(WORD_ p, WORD_ s) BOOST_NOEXCEPT
0104 {
0105     return static_cast< WORD_ >((static_cast< DWORD_ >(s) << 10u) | p);
0106 }
0107 
0108 #if BOOST_WINAPI_PARTITION_DESKTOP
0109 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_FAILCRITICALERRORS_ =     0x0001;
0110 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOGPFAULTERRORBOX_ =      0x0002;
0111 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOALIGNMENTFAULTEXCEPT_ = 0x0004;
0112 BOOST_CONSTEXPR_OR_CONST DWORD_ SEM_NOOPENFILEERRORBOX_ =     0x8000;
0113 #endif
0114 
0115 #endif
0116 
0117 #if !defined( BOOST_NO_ANSI_APIS )
0118 using ::FormatMessageA;
0119 #endif
0120 using ::FormatMessageW;
0121 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0122 using ::SetErrorMode;
0123 #endif
0124 
0125 #if !defined( BOOST_NO_ANSI_APIS )
0126 BOOST_FORCEINLINE DWORD_ format_message(
0127     DWORD_ dwFlags,
0128     LPCVOID_ lpSource,
0129     DWORD_ dwMessageId,
0130     DWORD_ dwLanguageId,
0131     LPSTR_ lpBuffer,
0132     DWORD_ nSize,
0133     va_list *Arguments)
0134 {
0135     return ::FormatMessageA(dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments);
0136 }
0137 #endif
0138 
0139 BOOST_FORCEINLINE DWORD_ format_message(
0140     DWORD_ dwFlags,
0141     LPCVOID_ lpSource,
0142     DWORD_ dwMessageId,
0143     DWORD_ dwLanguageId,
0144     LPWSTR_ lpBuffer,
0145     DWORD_ nSize,
0146     va_list *Arguments)
0147 {
0148     return ::FormatMessageW(dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments);
0149 }
0150 
0151 }
0152 }
0153 
0154 #include <boost/winapi/detail/footer.hpp>
0155 
0156 #endif // BOOST_WINAPI_ERROR_HANDLING_HPP_INCLUDED_