mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Merge PR #5087: FIX(client): Use ReadProcessMemory() instead of Toolhelp32ReadProcessMemory()
This commit is contained in:
commit
9d5feb54e6
@ -11,14 +11,18 @@
|
||||
#include <tlhelp32.h>
|
||||
|
||||
HostWindows::HostWindows(const procid_t pid) : m_pid(pid) {
|
||||
m_handle = OpenProcess(PROCESS_VM_READ, false, m_pid);
|
||||
}
|
||||
|
||||
HostWindows::~HostWindows() {
|
||||
if (m_handle) {
|
||||
CloseHandle(m_handle);
|
||||
}
|
||||
}
|
||||
|
||||
bool HostWindows::peek(const procptr_t address, void *dst, const size_t size) const {
|
||||
SIZE_T read;
|
||||
const auto ok = Toolhelp32ReadProcessMemory(m_pid, reinterpret_cast< void * >(address), dst, size, &read);
|
||||
const auto ok = ReadProcessMemory(m_handle, reinterpret_cast< void * >(address), dst, size, &read);
|
||||
return (ok && read == size);
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ typedef uint32_t procid_t;
|
||||
class HostWindows {
|
||||
protected:
|
||||
procid_t m_pid;
|
||||
void *m_handle;
|
||||
|
||||
public:
|
||||
bool peek(const procptr_t address, void *dst, const size_t size) const;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user