Fix protected data segment bug

This commit is contained in:
momo5502 2016-03-09 20:38:13 +01:00
parent 91922e83ea
commit aee6d1d356

View File

@ -120,7 +120,12 @@ namespace Utils
void Hook::SetString(void* place, const char* string, size_t length) void Hook::SetString(void* place, const char* string, size_t length)
{ {
DWORD oldProtect;
VirtualProtect(place, length + 1, PAGE_EXECUTE_READWRITE, &oldProtect);
strncpy(static_cast<char*>(place), string, length); strncpy(static_cast<char*>(place), string, length);
VirtualProtect(place, length + 1, oldProtect, &oldProtect);
} }
void Hook::SetString(DWORD place, const char* string, size_t length) void Hook::SetString(DWORD place, const char* string, size_t length)