mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-04-12 09:45:36 +08:00
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string_view>
|
|
|
|
namespace process {
|
|
bool attach(std::string_view process_name);
|
|
|
|
[[nodiscard]] std::optional<std::uintptr_t> find_pattern(std::string_view module_name, std::string_view pattern) noexcept;
|
|
|
|
[[nodiscard]] std::optional<std::uintptr_t> get_module_base(std::string_view module_name) noexcept;
|
|
|
|
[[nodiscard]] std::optional<std::uintptr_t> resolve_rip_relative_address(std::uintptr_t address) noexcept;
|
|
|
|
bool read_memory(std::uintptr_t address, void* buffer, std::size_t size) noexcept;
|
|
|
|
bool write_memory(std::uintptr_t address, const void* buffer, std::size_t size) noexcept;
|
|
|
|
std::string read_string(std::uintptr_t address, std::size_t length) noexcept;
|
|
|
|
template <typename T>
|
|
T read_memory(const std::uintptr_t address) noexcept {
|
|
T buffer = {};
|
|
|
|
read_memory(address, &buffer, sizeof(T));
|
|
|
|
return buffer;
|
|
}
|
|
|
|
template <typename T>
|
|
bool write_memory(const std::uintptr_t address, const T& buffer) noexcept {
|
|
return write_memory(address, &buffer, sizeof(T));
|
|
}
|
|
}
|