MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / TryReadProcessMemory

Function TryReadProcessMemory

src/OSTPlatform/Windows/Process.cpp:58–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58bool TryReadProcessMemory(HANDLE process, const void* address, void* buffer, size_t size, size_t* bytesRead = nullptr) {
59 SIZE_T read = 0;
60 const bool ok = ::ReadProcessMemory(process, address, buffer, size, &read) != FALSE;
61 if (!ok) {
62 OSTP_LOG_TRACE("ReadProcessMemory(addr={:#x}, size={}) failed (read={}, error={})",
63 reinterpret_cast<uintptr_t>(address), size, static_cast<size_t>(read), GetLastError());
64 }
65 if (bytesRead) *bytesRead = static_cast<size_t>(read);
66 return ok;
67}
68
69template <typename T>
70std::optional<T> ReadRemoteValue(HANDLE process, const void* address) {

Callers 2

ReadRemoteValueFunction · 0.85
ReadEnvironmentAtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected