mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-01-23 18:12:11 +00:00
Updated Boost.WinAPI usage to the new location and namespace.
This commit is contained in:
@@ -14,15 +14,15 @@
|
||||
|
||||
#include <boost/stacktrace/safe_dump_to.hpp>
|
||||
|
||||
#include <boost/detail/winapi/stack_backtrace.hpp>
|
||||
#include <boost/winapi/stack_backtrace.hpp>
|
||||
|
||||
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<boost::detail::winapi::ULONG_>(skip),
|
||||
static_cast<boost::detail::winapi::ULONG_>(max_frames_count),
|
||||
const_cast<boost::detail::winapi::PVOID_*>(out_frames),
|
||||
return boost::winapi::RtlCaptureStackBackTrace(
|
||||
static_cast<boost::winapi::ULONG_>(skip),
|
||||
static_cast<boost::winapi::ULONG_>(max_frames_count),
|
||||
const_cast<boost::winapi::PVOID_*>(out_frames),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <windows.h>
|
||||
#include "dbgeng.h"
|
||||
|
||||
#include <boost/detail/winapi/get_current_process.hpp>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
|
||||
# include <dlfcn.h>
|
||||
#else
|
||||
# include <boost/detail/winapi/dll.hpp>
|
||||
# include <boost/winapi/dll.hpp>
|
||||
#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<boost::detail::winapi::HMODULE_>(mbi.AllocationBase);
|
||||
if (!boost::detail::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) {
|
||||
boost::winapi::HMODULE_ handle = reinterpret_cast<boost::winapi::HMODULE_>(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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
|
||||
#include <boost/detail/winapi/get_current_process.hpp>
|
||||
#include <boost/detail/winapi/file_management.hpp>
|
||||
#include <boost/detail/winapi/handles.hpp>
|
||||
#include <boost/detail/winapi/access_rights.hpp>
|
||||
#include <boost/winapi/get_current_process.hpp>
|
||||
#include <boost/winapi/file_management.hpp>
|
||||
#include <boost/winapi/handles.hpp>
|
||||
#include <boost/winapi/access_rights.hpp>
|
||||
|
||||
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::detail::winapi::DWORD_>(
|
||||
boost::winapi::DWORD_ written;
|
||||
const boost::winapi::DWORD_ bytes_to_write = static_cast<boost::winapi::DWORD_>(
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/detail/winapi/config.hpp>
|
||||
#include <boost/winapi/config.hpp>
|
||||
#include <boost/stacktrace/detail/push_options.h>
|
||||
|
||||
#ifdef BOOST_INTEL
|
||||
|
||||
Reference in New Issue
Block a user