1
0
mirror of synced 2025-01-29 19:17:28 +01:00

Fix saving files (#382)

This commit is contained in:
qxxxb 2021-12-22 07:36:26 -05:00 committed by GitHub
parent c1bb407b34
commit 28e51309cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -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
}
}
}

View File

@ -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 {
}
}
}