2 * Copyright 2015 Klemens Morgenstern
3 * Copyright 2016 Jorge Lodos
4 * Copyright 2016 Andrey Semashev
6 * Distributed under the Boost Software License, Version 1.0.
7 * See http://www.boost.org/LICENSE_1_0.txt
10 #ifndef BOOST_WINAPI_DBGHELP_HPP_INCLUDED_
11 #define BOOST_WINAPI_DBGHELP_HPP_INCLUDED_
13 #include <boost/winapi/basic_types.hpp>
15 #if defined( BOOST_USE_WINDOWS_H )
16 #if !defined( BOOST_WINAPI_IS_MINGW )
19 // In MinGW there is no dbghelp.h but an older imagehlp.h header defines some of the symbols from it.
20 // Note that the user has to link with libimagehlp.a instead of libdbghelp.a for it to work.
25 #ifdef BOOST_HAS_PRAGMA_ONCE
29 #if BOOST_WINAPI_PARTITION_DESKTOP
31 // Some symbols declared below are not present in all versions of Windows SDK, MinGW and MinGW-w64.
32 // dbghelp.h/imagehlp.h define the API_VERSION_NUMBER macro which we use to detect its version.
33 // When the macro is not available we can only guess based on the compiler version or SDK type.
34 #if defined(API_VERSION_NUMBER)
35 #if API_VERSION_NUMBER >= 11
36 // UnDecorateSymbolNameW available since Windows SDK 6.0A and MinGW-w64 (as of 2016-02-14)
37 #define BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW
39 #elif defined(_MSC_VER) && _MSC_VER >= 1500
40 // Until MSVC 9.0 Windows SDK was bundled in Visual Studio and didn't have UnDecorateSymbolNameW.
41 // Supposedly, Windows SDK 6.0A was the first standalone one and it is used with MSVC 9.0.
42 #define BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW
43 #elif !defined(BOOST_WINAPI_IS_MINGW)
44 // MinGW does not provide UnDecorateSymbolNameW (as of 2016-02-14)
45 #define BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW
48 #if !defined( BOOST_USE_WINDOWS_H )
53 BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ WINAPI
55 boost::winapi::LPCSTR_ DecoratedName,
56 boost::winapi::LPSTR_ UnDecoratedName,
57 boost::winapi::DWORD_ UndecoratedLength,
58 boost::winapi::DWORD_ Flags);
60 #if defined( BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW )
61 BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ WINAPI
62 UnDecorateSymbolNameW(
63 boost::winapi::LPCWSTR_ DecoratedName,
64 boost::winapi::LPWSTR_ UnDecoratedName,
65 boost::winapi::DWORD_ UndecoratedLength,
66 boost::winapi::DWORD_ Flags);
69 BOOST_SYMBOL_IMPORT API_VERSION* WINAPI
70 ImagehlpApiVersion(BOOST_WINAPI_DETAIL_VOID);
78 #if defined( BOOST_USE_WINDOWS_H )
80 const DWORD_ UNDNAME_COMPLETE_ = UNDNAME_COMPLETE;
81 const DWORD_ UNDNAME_NO_LEADING_UNDERSCORES_ = UNDNAME_NO_LEADING_UNDERSCORES;
82 const DWORD_ UNDNAME_NO_MS_KEYWORDS_ = UNDNAME_NO_MS_KEYWORDS;
83 const DWORD_ UNDNAME_NO_FUNCTION_RETURNS_ = UNDNAME_NO_FUNCTION_RETURNS;
84 const DWORD_ UNDNAME_NO_ALLOCATION_MODEL_ = UNDNAME_NO_ALLOCATION_MODEL;
85 const DWORD_ UNDNAME_NO_ALLOCATION_LANGUAGE_ = UNDNAME_NO_ALLOCATION_LANGUAGE;
86 const DWORD_ UNDNAME_NO_MS_THISTYPE_ = UNDNAME_NO_MS_THISTYPE;
87 const DWORD_ UNDNAME_NO_CV_THISTYPE_ = UNDNAME_NO_CV_THISTYPE;
88 const DWORD_ UNDNAME_NO_THISTYPE_ = UNDNAME_NO_THISTYPE;
89 const DWORD_ UNDNAME_NO_ACCESS_SPECIFIERS_ = UNDNAME_NO_ACCESS_SPECIFIERS;
90 const DWORD_ UNDNAME_NO_THROW_SIGNATURES_ = UNDNAME_NO_THROW_SIGNATURES;
91 const DWORD_ UNDNAME_NO_MEMBER_TYPE_ = UNDNAME_NO_MEMBER_TYPE;
92 const DWORD_ UNDNAME_NO_RETURN_UDT_MODEL_ = UNDNAME_NO_RETURN_UDT_MODEL;
93 const DWORD_ UNDNAME_32_BIT_DECODE_ = UNDNAME_32_BIT_DECODE;
94 const DWORD_ UNDNAME_NAME_ONLY_ = UNDNAME_NAME_ONLY;
95 const DWORD_ UNDNAME_NO_ARGUMENTS_ = UNDNAME_NO_ARGUMENTS;
96 const DWORD_ UNDNAME_NO_SPECIAL_SYMS_ = UNDNAME_NO_SPECIAL_SYMS;
98 #else // defined( BOOST_USE_WINDOWS_H )
100 const DWORD_ UNDNAME_COMPLETE_ = 0x00000000;
101 const DWORD_ UNDNAME_NO_LEADING_UNDERSCORES_ = 0x00000001;
102 const DWORD_ UNDNAME_NO_MS_KEYWORDS_ = 0x00000002;
103 const DWORD_ UNDNAME_NO_FUNCTION_RETURNS_ = 0x00000004;
104 const DWORD_ UNDNAME_NO_ALLOCATION_MODEL_ = 0x00000008;
105 const DWORD_ UNDNAME_NO_ALLOCATION_LANGUAGE_ = 0x00000010;
106 const DWORD_ UNDNAME_NO_MS_THISTYPE_ = 0x00000020;
107 const DWORD_ UNDNAME_NO_CV_THISTYPE_ = 0x00000040;
108 const DWORD_ UNDNAME_NO_THISTYPE_ = 0x00000060;
109 const DWORD_ UNDNAME_NO_ACCESS_SPECIFIERS_ = 0x00000080;
110 const DWORD_ UNDNAME_NO_THROW_SIGNATURES_ = 0x00000100;
111 const DWORD_ UNDNAME_NO_MEMBER_TYPE_ = 0x00000200;
112 const DWORD_ UNDNAME_NO_RETURN_UDT_MODEL_ = 0x00000400;
113 const DWORD_ UNDNAME_32_BIT_DECODE_ = 0x00000800;
114 const DWORD_ UNDNAME_NAME_ONLY_ = 0x00001000;
115 const DWORD_ UNDNAME_NO_ARGUMENTS_ = 0x00002000;
116 const DWORD_ UNDNAME_NO_SPECIAL_SYMS_ = 0x00004000;
118 #endif // defined( BOOST_USE_WINDOWS_H )
120 using ::UnDecorateSymbolName;
121 #if defined( BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW )
122 using ::UnDecorateSymbolNameW;
125 typedef struct BOOST_MAY_ALIAS API_VERSION {
126 USHORT_ MajorVersion;
127 USHORT_ MinorVersion;
130 } API_VERSION_, *LPAPI_VERSION_;
132 BOOST_FORCEINLINE LPAPI_VERSION_ ImagehlpApiVersion()
134 return reinterpret_cast<LPAPI_VERSION_>(::ImagehlpApiVersion());
137 BOOST_FORCEINLINE DWORD_ undecorate_symbol_name(
138 LPCSTR_ DecoratedName,
139 LPSTR_ UnDecoratedName,
140 DWORD_ UndecoratedLength,
143 return ::UnDecorateSymbolName(
150 #if defined( BOOST_WINAPI_DETAIL_HAS_UNDECORATESYMBOLNAMEW )
152 BOOST_FORCEINLINE DWORD_ undecorate_symbol_name(
153 LPCWSTR_ DecoratedName,
154 LPWSTR_ UnDecoratedName,
155 DWORD_ UndecoratedLength,
158 return ::UnDecorateSymbolNameW(
170 #endif // BOOST_WINAPI_PARTITION_DESKTOP
171 #endif // BOOST_WINAPI_DBGHELP_HPP_INCLUDED_