| 1 |
|
#include "Daodan_Patch.h" |
| 2 |
|
#include <windows.h> |
| 3 |
+ |
#include <stdlib.h> |
| 4 |
+ |
#include <string.h> |
| 5 |
|
|
| 6 |
|
bool DDrPatch_MakeJump(void* from, void* to) |
| 7 |
|
{ |
| 86 |
|
return true; |
| 87 |
|
} |
| 88 |
|
else |
| 89 |
+ |
return false; |
| 90 |
+ |
} |
| 91 |
+ |
|
| 92 |
+ |
bool DDrPatch_StrDup(int* dest, const char* value) |
| 93 |
+ |
{ |
| 94 |
+ |
DWORD oldp; |
| 95 |
+ |
|
| 96 |
+ |
if (VirtualProtect(dest, 4, PAGE_EXECUTE_READWRITE, &oldp)) |
| 97 |
+ |
{ |
| 98 |
+ |
*dest = (int)strdup(value); |
| 99 |
+ |
VirtualProtect(dest, 4, oldp, &oldp); |
| 100 |
+ |
return true; |
| 101 |
+ |
} |
| 102 |
+ |
else |
| 103 |
+ |
return false; |
| 104 |
+ |
} |
| 105 |
+ |
|
| 106 |
+ |
bool DDrPatch_NOOP(char* dest, unsigned int length) |
| 107 |
+ |
{ |
| 108 |
+ |
DWORD oldp; |
| 109 |
+ |
|
| 110 |
+ |
if (VirtualProtect(dest, length, PAGE_EXECUTE_READWRITE, &oldp)) |
| 111 |
+ |
{ |
| 112 |
+ |
memset(dest, 0x90, length); |
| 113 |
+ |
VirtualProtect(dest, length, oldp, &oldp); |
| 114 |
+ |
return true; |
| 115 |
+ |
} |
| 116 |
+ |
else |
| 117 |
|
return false; |
| 118 |
|
} |