Skip to content

Commit 1cb8db8

Browse files
authored
Merge pull request #1 from Northn/patch-1
Plugin::InstallPatchAddHospitalRestartPoint(): Unprotect before patching
2 parents b69b561 + 91c6b0d commit 1cb8db8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Plugin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,10 @@ void Plugin::AddChatMessage(std::uint32_t dwColor, std::string sFmrMessage, ...)
9595
*/
9696
void Plugin::InstallPatchAddHospitalRestartPoint()
9797
{
98-
memset(reinterpret_cast<void*>(0x460773), 0x90, 0x7);
98+
auto address = reinterpret_cast<void*>(0x460773);
99+
auto size = 0x7;
100+
DWORD oldProtection = PAGE_EXECUTE_READWRITE;
101+
VirtualProtect(address, size, oldProtection, &oldProtection);
102+
memset(address, 0x90, size);
103+
VirtualProtect(address, size, oldProtection, &oldProtection);
99104
}

0 commit comments

Comments
 (0)