| 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) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 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 |  | } |