diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index df3ca13c5..02a266004 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -244,7 +244,7 @@ namespace hex::plugin::builtin::prv { this->m_fileSize = this->m_fileStats.st_size; - this->m_mappedFile = ::mmap(nullptr, this->m_fileSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, this->m_file, 0); + this->m_mappedFile = ::mmap(nullptr, this->m_fileSize, PROT_READ | PROT_WRITE, MAP_SHARED, this->m_file, 0); if (this->m_mappedFile == nullptr) { ::close(this->m_file); this->m_file = -1; @@ -270,4 +270,4 @@ namespace hex::plugin::builtin::prv { #endif } -} \ No newline at end of file +} diff --git a/plugins/libimhex/source/providers/provider.cpp b/plugins/libimhex/source/providers/provider.cpp index 95953411f..10e709a49 100644 --- a/plugins/libimhex/source/providers/provider.cpp +++ b/plugins/libimhex/source/providers/provider.cpp @@ -58,8 +58,9 @@ namespace hex::prv { } void Provider::applyPatches() { - for (auto &[patchAddress, patch] : getPatches()) - this->writeRaw( - this->getBaseAddress(), &patch, 1); + for (auto &[patchAddress, patch] : getPatches()) { + this->writeRaw(patchAddress - this->getBaseAddress(), &patch, 1); + } } @@ -163,4 +164,4 @@ namespace hex::prv { } -} \ No newline at end of file +}