diff --git a/vnrhook/CMakeLists.txt b/vnrhook/CMakeLists.txt index 1ad5f9d..842b371 100644 --- a/vnrhook/CMakeLists.txt +++ b/vnrhook/CMakeLists.txt @@ -7,6 +7,7 @@ set(vnrhook_src engine/match64.cc engine/native/pchooks.cc util/ithsys/ithsys.cc + util/util.cc ) else() set(vnrhook_src diff --git a/vnrhook/util/util.cc b/vnrhook/util/util.cc index 1ec0166..7911359 100644 --- a/vnrhook/util/util.cc +++ b/vnrhook/util/util.cc @@ -304,13 +304,15 @@ bool SearchResourceString(LPCWSTR str) std::vector SearchMemory(const void* bytes, short length, DWORD protect) { + SYSTEM_INFO systemInfo; + GetNativeSystemInfo(&systemInfo); std::vector> validMemory; - for (BYTE* probe = NULL; (uint64_t)probe < 0x80000000;) // end of user memory space + for (BYTE* probe = NULL; probe < systemInfo.lpMaximumApplicationAddress;) { MEMORY_BASIC_INFORMATION info = {}; if (!VirtualQuery(probe, &info, sizeof(info))) { - probe += 0x1000; // page size + probe += systemInfo.dwPageSize; continue; } else