| 1 |
|
#include "Daodan_Patch.h" |
| 2 |
< |
#include "Daodan_Utility.h" |
| 2 |
> |
#include "Patches/Utility.h" |
| 3 |
|
#include <beaengine/BeaEngine.h> |
| 4 |
|
|
| 5 |
|
#include <windows.h> |
| 279 |
|
return false; |
| 280 |
|
} |
| 281 |
|
|
| 282 |
– |
bool DDrPatch__strdup(int* dest, const char* value) |
| 283 |
– |
{ |
| 284 |
– |
DWORD oldp; |
| 285 |
– |
|
| 286 |
– |
if (VirtualProtect(dest, 4, PAGE_EXECUTE_READWRITE, &oldp)) |
| 287 |
– |
{ |
| 288 |
– |
*dest = (int)_strdup(value); |
| 289 |
– |
VirtualProtect(dest, 4, oldp, &oldp); |
| 290 |
– |
return true; |
| 291 |
– |
} |
| 292 |
– |
else |
| 293 |
– |
return false; |
| 294 |
– |
} |
| 295 |
– |
|
| 282 |
|
bool DDrPatch_NOOP(char* dest, unsigned int length) |
| 283 |
|
{ |
| 284 |
|
DWORD oldp; |
| 292 |
|
else |
| 293 |
|
return false; |
| 294 |
|
} |
| 295 |
+ |
|
| 296 |
+ |
|
| 297 |
+ |
void DDrPatch_PrintDisasm(void* addr, int instLimit, int sizeLimit) |
| 298 |
+ |
{ |
| 299 |
+ |
DISASM MyDisasm; |
| 300 |
+ |
int len = 0; |
| 301 |
+ |
int size = 0; |
| 302 |
+ |
int i = 0; |
| 303 |
+ |
|
| 304 |
+ |
memset(&MyDisasm, 0, sizeof(DISASM)); |
| 305 |
+ |
|
| 306 |
+ |
MyDisasm.EIP = (UIntPtr) addr; |
| 307 |
+ |
|
| 308 |
+ |
STARTUPMESSAGE("", 0); |
| 309 |
+ |
STARTUPMESSAGE("Disassembly @ 0x%06x", addr); |
| 310 |
+ |
|
| 311 |
+ |
if (sizeLimit <= 0) |
| 312 |
+ |
sizeLimit = 20 * instLimit; |
| 313 |
+ |
|
| 314 |
+ |
while ((i < instLimit) && (size < sizeLimit)) { |
| 315 |
+ |
len = Disasm(&MyDisasm); |
| 316 |
+ |
if (len != UNKNOWN_OPCODE) { |
| 317 |
+ |
size += len; |
| 318 |
+ |
STARTUPMESSAGE(" %s, Opcode: 0x%x, len: %d, branch: %d, to: 0x%06x", MyDisasm.CompleteInstr, MyDisasm.Instruction.Opcode, len, MyDisasm.Instruction.BranchType, MyDisasm.Instruction.AddrValue); |
| 319 |
+ |
STARTUPMESSAGE(" Cat: 0x%04x, prefix count: %d", MyDisasm.Instruction.Category & 0xffff, MyDisasm.Prefix.Number ); |
| 320 |
+ |
|
| 321 |
+ |
MyDisasm.EIP += (UIntPtr)len; |
| 322 |
+ |
i++; |
| 323 |
+ |
} |
| 324 |
+ |
}; |
| 325 |
+ |
|
| 326 |
+ |
STARTUPMESSAGE("", 0); |
| 327 |
+ |
} |
| 328 |
+ |
|