mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 13:57:05 +02:00
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
#pragma once
|
|
#include <Windows.h>
|
|
#include <array>
|
|
#include <string>
|
|
|
|
namespace dingosdk::backtrace {
|
|
inline constexpr DWORD protocol_version = 2;
|
|
inline constexpr DWORD capture_timeout_ms = 15000;
|
|
struct SharedReport {
|
|
DWORD version{protocol_version};
|
|
DWORD thread_id{};
|
|
EXCEPTION_POINTERS* exception{}; // Address in the parent; MiniDumpWriteDump uses ClientPointers=TRUE.
|
|
std::array<wchar_t, 4096> url{};
|
|
std::array<wchar_t, 32768> directory{};
|
|
std::array<wchar_t, 260> application{};
|
|
std::array<wchar_t, 32768> native_directory{};
|
|
};
|
|
// Explicitly inherited unnamed handles; no token or paths on the command line.
|
|
enum HandleIndex : std::size_t { mapping, requested, captured, stopping, ready, parent, handle_count };
|
|
struct Handle {
|
|
HANDLE value{};
|
|
Handle() = default;
|
|
explicit Handle(HANDLE handle) : value(handle) {}
|
|
~Handle() { if (value && value != INVALID_HANDLE_VALUE) CloseHandle(value); }
|
|
Handle(const Handle&) = delete;
|
|
Handle& operator=(const Handle&) = delete;
|
|
HANDLE release() { const auto result = value; value = nullptr; return result; }
|
|
};
|
|
inline std::wstring environment(const wchar_t* name) {
|
|
std::array<wchar_t, 32768> buffer{};
|
|
const auto size = GetEnvironmentVariableW(name, buffer.data(), static_cast<DWORD>(buffer.size()));
|
|
return size && size < buffer.size() ? std::wstring(buffer.data(), size) : std::wstring{};
|
|
}
|
|
}
|