File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ namespace hat::process {
4242 }
4343
4444 bool hat::process::is_readable (const std::span<const std::byte> region) {
45+ constexpr DWORD readFlags = PAGE_EXECUTE_READ
46+ | PAGE_EXECUTE_READWRITE
47+ | PAGE_EXECUTE_WRITECOPY
48+ | PAGE_READONLY
49+ | PAGE_READWRITE
50+ | PAGE_WRITECOPY ;
4551 for (auto * addr = region.data (); addr < region.data () + region.size ();) {
4652 MEMORY_BASIC_INFORMATION mbi{};
4753 if (!VirtualQuery (addr, &mbi, sizeof (mbi))) {
@@ -50,7 +56,7 @@ namespace hat::process {
5056 if (mbi.State != MEM_COMMIT ) {
5157 return false ;
5258 }
53- if (!(mbi.Protect & ( PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READONLY | PAGE_READWRITE ) )) {
59+ if (!(mbi.Protect & readFlags )) {
5460 return false ;
5561 }
5662 addr = static_cast <const std::byte*>(mbi.BaseAddress ) + mbi.RegionSize ;
You can’t perform that action at this time.
0 commit comments