From eba6db7bde03f078d5d6ce2836e2d47240ca903e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 24 Oct 2017 23:46:57 +0300 Subject: [PATCH] Updated Boost.WinAPI usage to the new location and namespace. --- .../boost/stacktrace/detail/collect_msvc.ipp | 10 +++---- .../boost/stacktrace/detail/frame_msvc.ipp | 4 +-- .../detail/location_from_symbol.hpp | 18 ++++++------- .../boost/stacktrace/detail/safe_dump_win.ipp | 26 +++++++++---------- include/boost/stacktrace/safe_dump_to.hpp | 2 +- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/include/boost/stacktrace/detail/collect_msvc.ipp b/include/boost/stacktrace/detail/collect_msvc.ipp index d75df55..37d3a29 100644 --- a/include/boost/stacktrace/detail/collect_msvc.ipp +++ b/include/boost/stacktrace/detail/collect_msvc.ipp @@ -14,15 +14,15 @@ #include -#include +#include namespace boost { namespace stacktrace { namespace detail { std::size_t this_thread_frames::collect(native_frame_ptr_t* out_frames, std::size_t max_frames_count, std::size_t skip) BOOST_NOEXCEPT { - return boost::detail::winapi::RtlCaptureStackBackTrace( - static_cast(skip), - static_cast(max_frames_count), - const_cast(out_frames), + return boost::winapi::RtlCaptureStackBackTrace( + static_cast(skip), + static_cast(max_frames_count), + const_cast(out_frames), 0 ); } diff --git a/include/boost/stacktrace/detail/frame_msvc.ipp b/include/boost/stacktrace/detail/frame_msvc.ipp index 6110524..d059775 100644 --- a/include/boost/stacktrace/detail/frame_msvc.ipp +++ b/include/boost/stacktrace/detail/frame_msvc.ipp @@ -21,8 +21,6 @@ #include #include "dbgeng.h" -#include - #ifdef BOOST_MSVC # pragma comment(lib, "ole32.lib") # pragma comment(lib, "Dbgeng.lib") @@ -59,7 +57,7 @@ public: // // If we call CoInitializeEx befire user - user may end up with different mode, which is a problem. // So we need to call that initialization function as late as possible. - const boost::detail::winapi::DWORD_ res = ::CoInitializeEx(0, COINIT_MULTITHREADED); + const DWORD res = ::CoInitializeEx(0, COINIT_MULTITHREADED); ok_ = (res == S_OK || res == S_FALSE); } diff --git a/include/boost/stacktrace/detail/location_from_symbol.hpp b/include/boost/stacktrace/detail/location_from_symbol.hpp index ed82ef5..534ac91 100644 --- a/include/boost/stacktrace/detail/location_from_symbol.hpp +++ b/include/boost/stacktrace/detail/location_from_symbol.hpp @@ -15,7 +15,7 @@ #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) # include #else -# include +# include #endif namespace boost { namespace stacktrace { namespace detail { @@ -52,20 +52,20 @@ public: #else class location_from_symbol { - BOOST_STATIC_CONSTEXPR boost::detail::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; + BOOST_STATIC_CONSTEXPR boost::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; char file_name_[DEFAULT_PATH_SIZE_]; public: explicit location_from_symbol(const void* addr) BOOST_NOEXCEPT { file_name_[0] = '\0'; - boost::detail::winapi::MEMORY_BASIC_INFORMATION_ mbi; - if (!boost::detail::winapi::VirtualQuery(addr, &mbi, sizeof(mbi))) { + boost::winapi::MEMORY_BASIC_INFORMATION_ mbi; + if (!boost::winapi::VirtualQuery(addr, &mbi, sizeof(mbi))) { return; } - boost::detail::winapi::HMODULE_ handle = reinterpret_cast(mbi.AllocationBase); - if (!boost::detail::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { + boost::winapi::HMODULE_ handle = reinterpret_cast(mbi.AllocationBase); + if (!boost::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { file_name_[0] = '\0'; return; } @@ -81,15 +81,15 @@ public: }; class program_location { - BOOST_STATIC_CONSTEXPR boost::detail::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; + BOOST_STATIC_CONSTEXPR boost::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; char file_name_[DEFAULT_PATH_SIZE_]; public: program_location() BOOST_NOEXCEPT { file_name_[0] = '\0'; - const boost::detail::winapi::HMODULE_ handle = 0; - if (!boost::detail::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { + const boost::winapi::HMODULE_ handle = 0; + if (!boost::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { file_name_[0] = '\0'; } } diff --git a/include/boost/stacktrace/detail/safe_dump_win.ipp b/include/boost/stacktrace/detail/safe_dump_win.ipp index 26f0516..cc25847 100644 --- a/include/boost/stacktrace/detail/safe_dump_win.ipp +++ b/include/boost/stacktrace/detail/safe_dump_win.ipp @@ -16,19 +16,19 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include namespace boost { namespace stacktrace { namespace detail { std::size_t dump(void* fd, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT { - boost::detail::winapi::DWORD_ written; - const boost::detail::winapi::DWORD_ bytes_to_write = static_cast( + boost::winapi::DWORD_ written; + const boost::winapi::DWORD_ bytes_to_write = static_cast( sizeof(native_frame_ptr_t) * frames_count ); - if (!boost::detail::winapi::WriteFile(fd, frames, bytes_to_write, &written, 0)) { + if (!boost::winapi::WriteFile(fd, frames, bytes_to_write, &written, 0)) { return 0; } @@ -36,22 +36,22 @@ std::size_t dump(void* fd, const native_frame_ptr_t* frames, std::size_t frames_ } std::size_t dump(const char* file, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT { - void* const fd = boost::detail::winapi::CreateFileA( + void* const fd = boost::winapi::CreateFileA( file, - boost::detail::winapi::GENERIC_WRITE_, + boost::winapi::GENERIC_WRITE_, 0, 0, - boost::detail::winapi::CREATE_ALWAYS_, - boost::detail::winapi::FILE_ATTRIBUTE_NORMAL_, + boost::winapi::CREATE_ALWAYS_, + boost::winapi::FILE_ATTRIBUTE_NORMAL_, 0 ); - if (fd == boost::detail::winapi::invalid_handle_value) { + if (fd == boost::winapi::invalid_handle_value) { return 0; } const std::size_t size = boost::stacktrace::detail::dump(fd, frames, frames_count); - boost::detail::winapi::CloseHandle(fd); + boost::winapi::CloseHandle(fd); return size; } diff --git a/include/boost/stacktrace/safe_dump_to.hpp b/include/boost/stacktrace/safe_dump_to.hpp index bfd6072..dbaa6d8 100644 --- a/include/boost/stacktrace/safe_dump_to.hpp +++ b/include/boost/stacktrace/safe_dump_to.hpp @@ -12,7 +12,7 @@ # pragma once #endif -#include +#include #include #ifdef BOOST_INTEL