Changeset 1008 for Daodan/src/Daodan_Patch.c
- Timestamp:
- Aug 26, 2014, 1:21:09 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan_Patch.c
r995 r1008 242 242 } 243 243 244 void* DDrPatch_ExecutableASM(char* from, char* nextInst, const unsigned char* code, int length) 245 { 246 char* newCode = malloc(length+5); 247 if (!DDrPatch_NOOP(newCode, length+5)) 248 return (void*)-1; 249 250 memcpy(newCode, code, length); 251 if (!DDrPatch_MakeJump(&newCode[length], nextInst)) 252 return (void*)-1; 253 254 DWORD oldp; 255 if (!VirtualProtect(newCode, length+5, PAGE_EXECUTE_READWRITE, &oldp)) { 256 STARTUPMESSAGE("ExecASM: Could not mark page for new code as executable: from address 0x%08x", from); 257 return (void*)-1; 258 } 259 260 if (!DDrPatch_MakeJump(from, newCode)) 261 return (void*)-1; 262 263 return newCode; 264 } 244 265 245 266 void DDrPatch_PrintDisasm(void* addr, int instLimit, int sizeLimit)
Note:
See TracChangeset
for help on using the changeset viewer.