Changeset 994 for Daodan/src/Daodan_Patch.c
- Timestamp:
- Apr 7, 2014, 12:33:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan_Patch.c
r993 r994 1 1 #include "Daodan_Patch.h" 2 #include " Daodan_Utility.h"2 #include "Patches/Utility.h" 3 3 #include <beaengine/BeaEngine.h> 4 4 … … 280 280 } 281 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 else293 return false;294 }295 296 282 bool DDrPatch_NOOP(char* dest, unsigned int length) 297 283 { … … 307 293 return false; 308 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
Note:
See TracChangeset
for help on using the changeset viewer.