| 241 |
|
return false; |
| 242 |
|
} |
| 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 |
+ |
} |
| 265 |
|
|
| 266 |
|
void DDrPatch_PrintDisasm(void* addr, int instLimit, int sizeLimit) |
| 267 |
|
{ |