View Single Post
spumer
Senior Member
Join Date: Aug 2011
Old 06-16-2019 , 04:08   Re: [L4D2] Ladder Rambos -- Shoot from ladders!
Reply With Quote #12

Quote:
Originally Posted by epzminion View Post
This would also crash in this case because it isn't taking into account the offset when it calls ProtectMemory in ApplyPatch.

You would need this change also to make the page(s) at the patch location writable:
Code:
inline void ApplyPatch(void *address, int offset, const patch_t *patch, patch_t *restore)
{
	unsigned char *addr = (unsigned char *)address + offset;
	ProtectMemory((void *)addr, 20, PAGE_EXECUTE_READWRITE);
It's not important in this case, cause patch size is 1 byte. 1 is lower than 20.

https://github.com/Attano/LadderRamb..._patch.cpp#L75
__________________
spumer is offline