Skip to content

Commit

Permalink
vs format lol
Browse files Browse the repository at this point in the history
  • Loading branch information
clauadv committed Dec 10, 2024
1 parent d8a1b20 commit cbc4298
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions usermode/src/utils/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ class c_memory
}

bool setup();
std::optional<uint32_t> get_process_id(const std::string_view &process_name);
std::optional<void *> hijack_handle();
std::optional<c_address> find_pattern(const std::string_view &module_name, const std::string_view &pattern);
std::pair<std::optional<uintptr_t>, std::optional<uintptr_t>> get_module_info(const std::string_view &module_name);
std::optional<uint32_t> get_process_id(const std::string_view& process_name);
std::optional<void*> hijack_handle();
std::optional<c_address> find_pattern(const std::string_view& module_name, const std::string_view& pattern);
std::pair<std::optional<uintptr_t>, std::optional<uintptr_t>> get_module_info(const std::string_view& module_name);
bool is_anticheat_running();

bool read_t(const uintptr_t address, void *buffer, uintptr_t size)
bool read_t(const uintptr_t address, void* buffer, uintptr_t size)
{
this->read_memory(reinterpret_cast<void *>(address), buffer, size);
this->read_memory(reinterpret_cast<void*>(address), buffer, size);
return true;
}

template <typename t>
t read_t(void *address)
t read_t(void* address)
{
t value{0};
t value{ 0 };
this->read_memory(address, &value, sizeof(t));
return value;
}
Expand All @@ -52,7 +52,7 @@ class c_memory
T read_t(const uintptr_t address) noexcept
{
T buffer{};
this->read_memory(reinterpret_cast<void *>(address), &buffer, sizeof(T));
this->read_memory(reinterpret_cast<void*>(address), &buffer, sizeof(T));
return buffer;
}

Expand All @@ -62,9 +62,9 @@ class c_memory
static const int length = 64;
std::vector<char> buffer(length);

this->read_memory(reinterpret_cast<void *>(address), buffer.data(), length);
this->read_memory(reinterpret_cast<void*>(address), buffer.data(), length);

const auto &it = find(buffer.begin(), buffer.end(), '\0');
const auto& it = find(buffer.begin(), buffer.end(), '\0');

if (it != buffer.end())
buffer.resize(distance(buffer.begin(), it));
Expand All @@ -74,12 +74,12 @@ class c_memory

private:
bool m_initialized = false;
void *m_handle = nullptr;
void* m_handle = nullptr;
uint32_t m_id = 0;

bool read_memory(void *address, void *buffer, const size_t size)
bool read_memory(void* address, void* buffer, const size_t size)
{
return ReadProcessMemory(this->m_handle, reinterpret_cast<void *>(address), buffer, size, nullptr);
return ReadProcessMemory(this->m_handle, reinterpret_cast<void*>(address), buffer, size, nullptr);
}
};

Expand Down

0 comments on commit cbc4298

Please sign in to comment.