diff options
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index 1ab9c7801..387051756 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <vector> | 14 | #include <vector> |
| 15 | 15 | ||
| 16 | #include "../shims/shims.h" | 16 | #include "../shims/shims.h" |
| 17 | #include "base_reservation.h" | ||
| 17 | 18 | ||
| 18 | namespace rt { | 19 | namespace rt { |
| 19 | 20 | ||
| @@ -506,8 +507,11 @@ Module& Loader::map_image(const std::filesystem::path& path) { | |||
| 506 | by_name_[lower(m->name)] = m; | 507 | by_name_[lower(m->name)] = m; |
| 507 | order_.push_back(m); | 508 | order_.push_back(m); |
| 508 | 509 | ||
| 509 | m->base = static_cast<uint8_t*>( | 510 | // Inside the range gta6rt reserved for this image before the process started (base_reservation.h), else as usual. |
| 510 | VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); | 511 | m->base = static_cast<uint8_t*>(base_reservation::commit_reserved(oh.ImageBase, oh.SizeOfImage)); |
| 512 | if (!m->base) | ||
| 513 | m->base = static_cast<uint8_t*>(VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage, | ||
| 514 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); | ||
| 511 | if (!m->base) { | 515 | if (!m->base) { |
| 512 | const auto relocs = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); | 516 | const auto relocs = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); |
| 513 | if (!relocs.Size) | 517 | if (!relocs.Size) |