Changeset 309
- Timestamp:
- 01/15/10 14:01:12 (8 weeks ago)
- Location:
- Cheat Engine
- Files:
-
- 22 modified
-
CEFuncProc.pas (modified) (2 diffs)
-
CheatEngine.res (modified) (previous)
-
DBKKernel/DBKFunc.h (modified) (1 diff)
-
DBKKernel/amd64/debuggera.asm (modified) (1 diff)
-
DBKKernel/debugger.c (modified) (19 diffs)
-
DBKKernel/vmxoffload.c (modified) (3 diffs)
-
KernelDebugger.pas (modified) (7 diffs)
-
MainUnit.dfm (modified) (1 diff)
-
MainUnit.pas (modified) (1 diff)
-
MemoryBrowserFormUnit.dfm (modified) (28 diffs)
-
MemoryBrowserFormUnit.pas (modified) (11 diffs)
-
Release/Cheat Engine.iss (modified) (2 diffs)
-
Structuresfrm.pas (modified) (1 diff)
-
SynEdit/Source/SynHighlighterAA.pas (modified) (7 diffs)
-
cheatengine.dof (modified) (2 diffs)
-
dbk32/debug.pas (modified) (1 diff)
-
frmHeapsUnit.pas (modified) (1 diff)
-
frmMemoryAllocHandlerUnit.pas (modified) (2 diffs)
-
plugin.pas (modified) (3 diffs)
-
plugin/cepluginsdk.h (modified) (2 diffs)
-
plugin/cepluginsdk.pas (modified) (2 diffs)
-
pluginexports.pas (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Cheat Engine/CEFuncProc.pas
r307 r309 200 200 function freetypetostring(freetype: dword):string; 201 201 function isAddress(address: dword):boolean; 202 function isExecutableAddress(address: dword):boolean; 202 203 203 204 {$ifndef standalonetrainer} … … 3192 3193 end; 3193 3194 3195 function isExecutableAddress(address: dword):boolean; 3196 var mbi: TMemoryBasicInformation; 3197 begin 3198 result:=false; 3199 if VirtualQueryEx(processhandle, pointer(address), mbi, sizeof(mbi))>0 then 3200 result:=(mbi.State=MEM_COMMIT) and (((mbi.Protect and PAGE_EXECUTE)=PAGE_EXECUTE) or ((mbi.Protect and PAGE_EXECUTE_READ)=PAGE_EXECUTE_READ) or ((mbi.Protect and PAGE_EXECUTE_READWRITE)=PAGE_EXECUTE_READWRITE) or ((mbi.Protect and PAGE_EXECUTE_WRITECOPY)=PAGE_EXECUTE_WRITECOPY) ); 3201 end; 3202 3203 3204 3194 3205 3195 3206 -
Cheat Engine/DBKKernel/DBKFunc.h
r225 r309 84 84 typedef struct tagDebugReg7 85 85 { 86 unsigned L0 :1; // 87 unsigned G0 :1; // 88 unsigned L1 :1; // 89 unsigned G1 :1; // 90 unsigned L2 :1; // 91 unsigned G2 :1; // 92 unsigned L3 :1; // 93 unsigned G3 :1; // 94 unsigned GL :1; // 95 unsigned GE :1; // 96 unsigned undefined1 :3; // 001 97 unsigned GD :1; // 86 unsigned L0 :1; // 0 87 unsigned G0 :1; // 1 88 unsigned L1 :1; // 2 89 unsigned G1 :1; // 3 90 unsigned L2 :1; // 4 91 unsigned G2 :1; // 5 92 unsigned L3 :1; // 6 93 unsigned G3 :1; // 7 94 unsigned GL :1; // 8 95 unsigned GE :1; // 9 96 unsigned undefined1 :3; // 001 10 97 unsigned GD :1; // 11 98 98 unsigned undefined2 :2; // 00 99 99 unsigned RW0 :2; -
Cheat Engine/DBKKernel/amd64/debuggera.asm
r294 r309 45 45 interrupt1_asmentry: 46 46 ;save stack position 47 sub esp,4096 48 47 49 cld 48 50 push 0 ;push an errorcode on the stack so the stackindex enum type can stay the same relative to interrupts that do have an errorcode (int 14) -
Cheat Engine/DBKKernel/debugger.c
r298 r309 159 159 void debugger_touchDebugRegister(void) 160 160 { 161 DbgPrint("Touching debug register. inepilogue=\n", DebuggerState.FakedDebugRegisterState[cpunr()].inEpilogue); 162 163 161 164 debugger_dr0_setValue(debugger_dr0_getValue()); 165 162 166 } 163 167 … … 223 227 224 228 DbgPrint("Int 1 is hooked,%ssetting GD\n",(state ? "":"un")); 229 DbgPrint("oldEpilogueState=%d\n",oldEpilogueState); 225 230 //debugger_setInitialFakeState(); 226 231 … … 228 233 DebuggerState.globalDebug=state; 229 234 debugger_dr7_setGD(state); 230 //DebuggerState.FakedDebugRegisterState[cpunr()].inEpilogue=oldEpilogueState;231 235 236 DebuggerState.FakedDebugRegisterState[cpunr()].inEpilogue=oldEpilogueState; 232 237 233 238 234 239 DebuggerState.FakedDebugRegisterState[cpunr()].DR7=0x400; 235 240 debugger_dr7_setValueDword(0x400); 241 236 242 } 237 243 … … 511 517 while (r != STATUS_SUCCESS) 512 518 { 513 r=KeWaitForSingleObject(&debugger_event_CanBreak, UserRequest, KernelMode, TRUE, NULL);519 r=KeWaitForSingleObject(&debugger_event_CanBreak,Executive, KernelMode, FALSE, NULL); 514 520 //check r and handle specific events 521 522 DbgPrint("Woke up. r=%x\n",r); 515 523 516 524 } … … 543 551 544 552 //LARGE_INTEGER wt; 545 NTSTATUS s ;553 NTSTATUS s=STATUS_UNSUCCESSFUL; 546 554 547 555 //wt.QuadPart=-10000000LL; … … 550 558 DbgPrint("Waiting...\n"); 551 559 552 s=KeWaitForSingleObject(&debugger_event_WaitForContinue, UserRequest, KernelMode, TRUE, NULL); 553 554 DbgPrint("KeWaitForSingleObject=%x\n",s); 560 561 while (s != STATUS_SUCCESS) 562 { 563 s=KeWaitForSingleObject(&debugger_event_WaitForContinue, Executive, KernelMode, FALSE, NULL); 564 DbgPrint("KeWaitForSingleObject=%x\n",s); 565 } 566 567 555 568 556 569 if (s==STATUS_SUCCESS) … … 569 582 } 570 583 584 585 571 586 //i'm done, let other threads catch it 572 587 KeSetEvent(&debugger_event_CanBreak, 0, FALSE); … … 596 611 DebugReg7 _dr7=*(DebugReg7 *)¤tdebugregs[5]; 597 612 613 DbgPrint("interrupt1_handler\n"); 598 614 599 615 //check if this break should be handled or not … … 830 846 if (DebuggerState.isDebugging) 831 847 { 848 DbgPrint("DebuggerState.isDebugging\n"); 832 849 //check if this should break 833 850 if (CurrentProcessID==(HANDLE)(UINT_PTR)DebuggerState.debuggedProcessID) … … 835 852 UINT_PTR originaldebugregs[6]; 836 853 UINT64 oldDR7=getDR7(); 854 855 DbgPrint("CurrentProcessID==(HANDLE)(UINT_PTR)DebuggerState.debuggedProcessID\n"); 837 856 838 857 if (DebuggerState.globalDebug) … … 855 874 ((PEFLAGS)&stackpointer[si_eflags])->RF=1; 856 875 ((PEFLAGS)&stackpointer[si_eflags])->TF=1; //keep going until IF=1 876 DbgPrint("IF==0\n"); 857 877 return 1; //don't handle it but also don't tell windows 858 878 } … … 879 899 } 880 900 901 902 //save the current stack 903 /* 904 { 905 int *p; 906 p=ExAllocatePool(NonPagedPool,4096*2); 907 908 RtlZeroMemory(p,4096*2); 909 DbgPrint("p=%p\n",p); 910 911 RtlCopyMemory((PVOID)((UINT_PTR)p+4096), (PVOID)getRSP(), (UINT_PTR)(&stackpointer[si_ss])-(UINT_PTR)getRSP()); 912 913 __asm 914 { 915 mov eax,p 916 add eax,4096 917 918 sub ebp,esp 919 add ebp,eax 920 921 922 mov esp,eax 923 924 } 925 926 return 1; 927 928 929 } 930 */ 931 932 933 881 934 //start the windows taskswitching mode 935 882 936 enableInterrupts(); 883 937 { 884 938 int rs=1; 885 //DbgPrint("calling breakpointHandler_kernel\n");939 DbgPrint("calling breakpointHandler_kernel\n"); 886 940 887 941 rs=breakpointHandler_kernel(stackpointer, currentdebugregs); 888 //DbgPrint("After handler dr6=%x and before handling it was %x\n",debugger_dr6_getValue(), DebuggerState.FakedDebugRegisterState[cpunr()].DR6);942 DbgPrint("After handler\n"); 889 943 890 944 //DbgPrint("rs=%d\n",rs); … … 906 960 else 907 961 { 962 908 963 if (getDR7() != oldDR7) 909 964 { … … 919 974 debugger_dr3_setValue(currentdebugregs[3]); 920 975 debugger_dr6_setValue(currentdebugregs[4]); 921 debugger_dr7_setValue(*(DebugReg7 *)¤tdebugregs[5]); 976 977 if ((currentdebugregs[5] >> 11) & 1) 978 { 979 DbgPrint("WTF? GD is 1 in currentdebugregs[5]\n"); 980 } 981 else 982 debugger_dr7_setValue(*(DebugReg7 *)¤tdebugregs[5]); 983 922 984 } 923 985 … … 965 1027 int i; 966 1028 967 DbgPrint("interrupt1_centry :%d\n",cpunr());1029 DbgPrint("interrupt1_centry cpunr=%d esp=%x\n",cpunr(), getRSP()); 968 1030 969 1031 before=getRSP(); 1032 1033 for (i=-12; i<7; i++) 1034 { 1035 DbgPrint("stackpointer %d=%x\n",i, stackpointer[i]); 1036 } 970 1037 971 1038 … … 976 1043 //DbgPrint("current csr=%x\n", _mm_getcsr()); 977 1044 978 //DbgPrint("stackpointer RAX=%llx\n",stackpointer[si_eax]); 979 //DbgPrint("stackpointer RBX=%llx\n",stackpointer[si_ebx]); 980 //DbgPrint("stackpointer RCX=%llx\n",stackpointer[si_ecx]); 981 //DbgPrint("stackpointer RDX=%llx\n",stackpointer[si_edx]); 982 //DbgPrint("stackpointer cs:rip=%llx:%llx\n",stackpointer[si_cs], stackpointer[si_eip]); 983 //DbgPrint("stackpointer ss:rsp=%llx:%llx\n",stackpointer[si_ss], stackpointer[si_esp]); 1045 984 1046 985 1047 #endif … … 1212 1274 //not global debug, just clear all flags and be done with it 1213 1275 debugger_dr6_setValue(0xffff0ff0); 1214 1215 } 1216 1276 __nop(); 1277 1278 } 1279 1280 __nop(); 1281 __nop(); 1282 disableInterrupts(); 1283 disableInterrupts(); 1284 1285 __asm 1286 { 1287 cli 1288 } 1217 1289 1218 1290 if (handled == 2) 1219 1291 { 1292 __nop(); 1293 //DbgPrint("handled==2\n"); 1220 1294 handled = 1; //epilogue = 1 Dr handler 1295 __nop(); 1221 1296 } 1222 1297 else 1223 1298 { 1299 __nop(); 1224 1300 //not handled by the epilogue set DR0, so the actual epilogue 1225 DebuggerState.FakedDebugRegisterState[cpunr()].inEpilogue=0; 1226 debugger_dr7_setGD(DebuggerState.globalDebug); 1227 } 1228 1229 after=getRSP(); 1230 1231 DbgPrint("before=%llx after=%llx\n",before,after); 1301 //DbgPrint("handled==1\n"); 1302 1303 if (DebuggerState.globalDebug) 1304 { 1305 DebuggerState.FakedDebugRegisterState[cpunr()].inEpilogue=0; 1306 debugger_dr7_setGD(DebuggerState.globalDebug); //set it back to 1 1307 __nop(); 1308 __nop(); 1309 } 1310 __nop(); 1311 __nop(); 1312 } 1313 1314 __nop(); 1315 __nop(); 1316 1317 //after=getRSP(); 1318 1319 //DbgPrint("before=%llx after=%llx\n",before,after); 1232 1320 1233 1321 return handled; … … 1239 1327 { 1240 1328 __asm{ 1329 //change the start of the stack so that instructions like setthreadcontext do not affect the stack it when it's frozen and waiting for input 1330 //meaning the setting of debug registers will have to be done with the changestate call 1331 1332 //sub esp,4096 1333 //push [esp+4096+0+16] //optional ss 1334 //push [esp+4096+4+12] //optional esp 1335 //push [esp+4096+8+8] //eflags 1336 //push [esp+4096+12+4] //cs 1337 //push [esp+4096+16+0] //eip 1338 1339 1340 1341 1342 1343 1344 1241 1345 //save stack position 1242 1346 push 0 //push an errorcode on the stack so the stackindex can stay the same … … 1246 1350 //save state 1247 1351 pushad 1248 push ds 1249 push es 1250 push fs 1251 push gs 1252 1352 xor eax,eax 1353 mov ax,ds 1354 push eax 1355 1356 mov ax,es 1357 push eax 1358 1359 mov ax,fs 1360 push eax 1361 1362 mov ax,gs 1363 push eax 1364 1253 1365 mov ax,0x23 //0x10 should work too, but even windows itself is using 0x23 1254 1366 mov ds,ax -
Cheat Engine/DBKKernel/vmxoffload.c
r297 r309 203 203 NTSTATUS OpenedFile; 204 204 205 vmmPA= MmGetPhysicalAddress(vmm).QuadPart;205 vmmPA=(UINT_PTR)MmGetPhysicalAddress(vmm).QuadPart; 206 206 DbgPrint("Allocated memory at virtual address %p (physical address %llx)\n",vmm,MmGetPhysicalAddress(vmm)); 207 207 RtlZeroMemory(vmm,4*1024*1024); //initialize … … 743 743 xchg bx,bx 744 744 745 mov ebx,vmmPA 746 __emit 0x8b 747 __emit 0xeb //mov ebp,ebx 748 749 745 750 lea ebx,NewGDTDescriptor 746 751 mov ecx,pagedirptrbasePA … … 748 753 mov esi,enterVMM2PA 749 754 mov edi,originalstatePA 750 mov ebp,vmmPA755 751 756 call [enterVMM2] 752 757 -
Cheat Engine/KernelDebugger.pas
r305 r309 39 39 40 40 function getDebugReason: integer; 41 41 42 42 43 public … … 379 380 Debuggerthread.threadlistCS.Enter; 380 381 try 381 if not setthreadcontext(threadhandle, generaldebugregistercontext) then 382 OutputDebugString(format('Failed setting debug registers on thread %x with error %d',[threadhandle, GetLastError])); 382 if debuggerthread.stepping then 383 begin 384 OutputDebugString('debuggerthread.stepping is TRUE'); 385 debuggerthread.currentdebuggerstate.dr0:=generaldebugregistercontext.Dr0; 386 debuggerthread.currentdebuggerstate.dr1:=generaldebugregistercontext.Dr1; 387 debuggerthread.currentdebuggerstate.dr2:=generaldebugregistercontext.Dr2; 388 debuggerthread.currentdebuggerstate.dr3:=generaldebugregistercontext.Dr3; 389 debuggerthread.currentdebuggerstate.dr6:=generaldebugregistercontext.Dr6; 390 debuggerthread.currentdebuggerstate.dr7:=generaldebugregistercontext.Dr7; 391 end 392 else 393 begin 394 OutputDebugString('debuggerthread.stepping is FALSE'); 395 if not setthreadcontext(threadhandle, generaldebugregistercontext) then 396 OutputDebugString(format('Failed setting debug registers on thread %x with error %d',[threadhandle, GetLastError])); 397 end; 383 398 finally 384 399 Debuggerthread.threadlistCS.Leave; … … 559 574 stacktrace1.Enabled:=true; 560 575 Executetillreturn1.Enabled:=true; 561 caption:='Memory Viewer - Currently debugging thread'; 576 if stepping then 577 caption:='Memory Viewer - Currently debugging thread' 578 else 579 caption:='Memory Viewer - Running...'; 562 580 563 581 if frmstacktrace<>nil then … … 810 828 end; 811 829 end; 812 813 830 814 831 function TKDebuggerThread.getDebugReason: integer; … … 927 944 co_stepover: 928 945 begin 929 OutputDebugString('step over ');946 OutputDebugString('step over. Stepping='+booltostr(stepping,true)); 930 947 currentdebuggerstate.eflags:=eflags_setRF(currentdebuggerstate.eflags,1); //skip current instruction bp 931 948 currentdebuggerstate.eflags:=eflags_setTF(currentdebuggerstate.eflags,0); … … 944 961 currentdebuggerstate.eflags:=eflags_setRF(currentdebuggerstate.eflags,1); //skip current instruction bp 945 962 currentdebuggerstate.eflags:=eflags_setTF(currentdebuggerstate.eflags,0); 963 OutputDebugString('Setting breakpoint to '+inttohex(runtilladdress,8)); 946 964 KDebugger.SetBreakpoint(runtilladdress, bt_OnInstruction, 1, bo_Break, nil, currentdebuggerstate.threadid, true); 947 965 stepping:=false; … … 1096 1114 //delete if it belongs to this thread and it's a one time only break 1097 1115 if owner.breakpoint[breakreason].BreakOnce then 1116 begin 1117 stepping:=true; 1098 1118 KDebugger.DisableBreakpoint(breakreason); 1119 end; 1099 1120 end 1100 1121 else -
Cheat Engine/MainUnit.dfm
r307 r309 1460 1460 Height = 13 1461 1461 Caption = 'Launch DBVM' 1462 Visible = False 1462 1463 OnClick = Label59Click 1463 1464 end -
Cheat Engine/MainUnit.pas
r307 r309 10732 10732 procedure TMainForm.Label59Click(Sender: TObject); 10733 10733 var 10734 f: TfrmFloatingPointPanel; 10735 begin 10736 ZeroMemory(@c,sizeof(c)); 10737 c.ContextFlags:=CONTEXT_FLOATING_POINT or CONTEXT_EXTENDED_REGISTERS; 10738 if GetThreadContext(getcurrentthread, c) then 10739 begin 10740 f:=TfrmFloatingPointPanel.create(self); 10741 f.SetContextPointer(@c); 10742 memorybrowser.memoryaddress:=dword(@c); 10743 f.show; 10744 10745 showmessage(inttohex(dword(@c)+sizeof(c),8)) 10746 10747 end else showmessage('fuck'); 10734 i,j: integer; 10735 temp: thandle; 10736 found: boolean; 10737 c: Tcontext; 10738 begin 10739 found:=false; 10740 for i:=0 to length(frmprocesswatcher.processes)-1 do 10741 begin 10742 if frmprocesswatcher.processes[i].processid=processid then 10743 begin 10744 //open the threads 10745 for j:=0 to length(frmprocesswatcher.processes[i].threadlist)-1 do 10746 begin 10747 10748 temp:=Openthread(STANDARD_RIGHTS_REQUIRED or $3ff,true,frmprocesswatcher.processes[i].threadlist[j].threadid); 10749 if temp<>0 then 10750 begin 10751 c.ContextFlags:=CONTEXT_DEBUG_REGISTERS; 10752 GetThreadContext(temp,c); 10753 10754 c.ContextFlags:=CONTEXT_DEBUG_REGISTERS; 10755 c.Dr0:=$12345678; 10756 SetThreadContext(temp,c); 10757 10758 // setlength(threadlist,length(threadlist)+1); 10759 // threadlist[length(threadlist)-1]:=temp; 10760 end; 10761 end; 10762 10763 found:=true; 10764 showmessage('found'); 10765 break; 10766 10767 end; 10768 end; 10769 10770 if not found then showmessage('error'); 10748 10771 end; 10749 10772 -
Cheat Engine/MemoryBrowserFormUnit.dfm
r306 r309 77 77 OnResize = ScrollBox1Resize 78 78 object EAXLabel: TLabel 79 Left = 1079 Left = 8 80 80 Top = 19 81 81 Width = 96 … … 93 93 object EBXlabel: TLabel 94 94 Tag = 1 95 Left = 1096 Top = 3 295 Left = 8 96 Top = 35 97 97 Width = 96 98 98 Height = 13 … … 109 109 object ECXlabel: TLabel 110 110 Tag = 2 111 Left = 10112 Top = 45111 Left = 8 112 Top = 51 113 113 Width = 96 114 114 Height = 13 … … 125 125 object EDXlabel: TLabel 126 126 Tag = 3 127 Left = 10128 Top = 58127 Left = 8 128 Top = 67 129 129 Width = 96 130 130 Height = 13 … … 141 141 object ESIlabel: TLabel 142 142 Tag = 4 143 Left = 10144 Top = 70143 Left = 8 144 Top = 83 145 145 Width = 96 146 146 Height = 13 … … 157 157 object EDIlabel: TLabel 158 158 Tag = 5 159 Left = 10160 Top = 83159 Left = 8 160 Top = 99 161 161 Width = 96 162 162 Height = 13 … … 173 173 object EBPlabel: TLabel 174 174 Tag = 6 175 Left = 10176 Top = 96175 Left = 8 176 Top = 115 177 177 Width = 96 178 Height = 1 3178 Height = 14 179 179 Cursor = crHandPoint 180 180 Caption = 'EBP 00000000' … … 189 189 object ESPlabel: TLabel 190 190 Tag = 7 191 Left = 10192 Top = 1 09191 Left = 8 192 Top = 131 193 193 Width = 96 194 Height = 1 3194 Height = 14 195 195 Cursor = crHandPoint 196 196 Caption = 'ESP 00000000' … … 205 205 object EIPlabel: TLabel 206 206 Tag = 8 207 Left = 10208 Top = 1 21207 Left = 8 208 Top = 147 209 209 Width = 96 210 Height = 1 3210 Height = 15 211 211 Cursor = crHandPoint 212 212 Caption = 'EIP 00000000' … … 221 221 object CSLabel: TLabel 222 222 Tag = 9 223 Left = 10224 Top = 1 53223 Left = 8 224 Top = 184 225 225 Width = 56 226 226 Height = 13 … … 237 237 object DSLabel: TLabel 238 238 Tag = 11 239 Left = 10240 Top = 176239 Left = 8 240 Top = 216 241 241 Width = 56 242 242 Height = 13 … … 253 253 object SSlabel: TLabel 254 254 Tag = 10 255 Left = 10256 Top = 164255 Left = 8 256 Top = 200 257 257 Width = 56 258 258 Height = 13 … … 269 269 object ESlabel: TLabel 270 270 Tag = 12 271 Left = 10272 Top = 188271 Left = 8 272 Top = 232 273 273 Width = 56 274 274 Height = 13 … … 285 285 object FSlabel: TLabel 286 286 Tag = 13 287 Left = 10288 Top = 199287 Left = 8 288 Top = 248 289 289 Width = 56 290 290 Height = 13 … … 301 301 object GSlabel: TLabel 302 302 Tag = 14 303 Left = 10304 Top = 2 11303 Left = 8 304 Top = 264 305 305 Width = 56 306 306 Height = 13 … … 317 317 object cflabel: TLabel 318 318 Tag = 20 319 Left = 1 43320 Top = 2 0319 Left = 136 320 Top = 24 321 321 Width = 32 322 322 Height = 13 … … 332 332 object pflabel: TLabel 333 333 Tag = 21 334 Left = 1 43335 Top = 31334 Left = 136 335 Top = 40 336 336 Width = 32 337 337 Height = 13 … … 347 347 object aflabel: TLabel 348 348 Tag = 22 349 Left = 1 43350 Top = 43349 Left = 136 350 Top = 56 351 351 Width = 32 352 352 Height = 13 … … 362 362 object zflabel: TLabel 363 363 Tag = 23 364 Left = 1 43365 Top = 55364 Left = 136 365 Top = 72 366 366 Width = 32 367 367 Height = 13 … … 377 377 object sflabel: TLabel 378 378 Tag = 24 379 Left = 1 43380 Top = 66379 Left = 136 380 Top = 88 381 381 Width = 32 382 382 Height = 13 … … 392 392 object oflabel: TLabel 393 393 Tag = 26 394 Left = 1 43395 Top = 90394 Left = 136 395 Top = 120 396 396 Width = 32 397 397 Height = 13 … … 420 420 end 421 421 object Label15: TLabel 422 Left = 1 43422 Left = 139 423 423 Top = 0 424 424 Width = 34 … … 427 427 end 428 428 object Shape2: TShape 429 Left = 1 42429 Left = 138 430 430 Top = 16 431 431 Width = 35 … … 435 435 object Label16: TLabel 436 436 Left = 7 437 Top = 1 34437 Top = 162 438 438 Width = 115 439 439 Height = 16 … … 442 442 object Shape3: TShape 443 443 Left = 7 444 Top = 1 50444 Top = 178 445 445 Width = 111 446 446 Height = 3 … … 449 449 object dflabel: TLabel 450 450 Tag = 25 451 Left = 1 43452 Top = 78451 Left = 136 452 Top = 104 453 453 Width = 32 454 454 Height = 13 … … 463 463 end 464 464 object sbShowFloats: TSpeedButton 465 Left = 15 7466 Top = 1 35465 Left = 153 466 Top = 159 467 467 Width = 21 468 468 Height = 31 … … 635 635 ViewStyle = vsReport 636 636 OnData = lvStacktraceDataData 637 OnDblClick = lvStacktraceDataDblClick 637 638 end 638 639 end -
Cheat Engine/MemoryBrowserFormUnit.pas
r308 r309 313 313 procedure Executetillreturn1Click(Sender: TObject); 314 314 procedure lvStacktraceDataData(Sender: TObject; Item: TListItem); 315 procedure lvStacktraceDataDblClick(Sender: TObject); 315 316 private 316 317 { Private declarations } … … 1841 1842 debuggerthread.continuehow:=wdco_run; //note: I could also have the debuggerthread suspend itself, and resume it here 1842 1843 debuggerthread.continueprocess:=true; 1843 caption:='Memory Viewer - Running';1844 end;1844 end; 1845 caption:='Memory Viewer - Running'; 1845 1846 {$endif} 1846 1847 end; … … 1858 1859 debuggerthread.continuehow:=wdco_stepinto; //single step 1859 1860 debuggerthread.continueprocess:=true; 1860 caption:='Memory Viewer - Running';1861 end; 1862 1861 end; 1862 1863 caption:='Memory Viewer - Running'; 1863 1864 {$endif} 1864 1865 end; … … 1870 1871 int3: byte; 1871 1872 original,a,written:dword; 1872 1873 begin 1874 {$ifndef net} 1873 begin 1875 1874 int3:=$cc; 1876 1875 //place a invisble for the user breakpoint on the following upcode … … 1937 1936 1938 1937 debuggerthread.continueprocess:=true; 1939 caption:='Memory Viewer - Running'; 1940 end; 1941 {$endif}1938 1939 end; 1940 caption:='Memory Viewer - Running'; 1942 1941 end; 1943 1942 … … 1955 1954 if kdebugger.isactive then 1956 1955 begin 1957 kdebugger.continue(co_runtill );1956 kdebugger.continue(co_runtill, disassemblerview.SelectedAddress); 1958 1957 end 1959 1958 else … … 1999 1998 2000 1999 debuggerthread.continueprocess:=true; 2001 caption:='Memory Viewer - Running'; 2002 end; 2000 2001 end; 2002 caption:='Memory Viewer - Running'; 2003 2003 2004 2004 {$endif} … … 3998 3998 c:=lvstacktracedata.Columns.Add; 3999 3999 c.Caption:='Return Address'; 4000 c.Width:=120; 4000 c.Width:=lvstacktracedata.Canvas.TextWidth('DDDDDDDD'); 4001 c.AutoSize:=true; 4002 4001 4003 4002 4004 c:=lvstacktracedata.Columns.Add; … … 4158 4160 4159 4161 function TMemoryBrowser.GetReturnaddress: dword; 4160 var haserror: boolean; 4162 var 4163 haserror: boolean; 4164 stack: array [0..1023] of dword; 4165 x: dword; 4166 i: integer; 4161 4167 begin 4162 4168 result:=0; … … 4172 4178 end; 4173 4179 4180 if result=0 then 4181 begin 4182 4183 //go through the stack and find a entry that falls in executable memory 4184 ReadProcessMemory(processhandle, pointer(lastdebugcontext.Esp), @stack[0], 4096, x); 4185 for i:=0 to (x div 4) do 4186 begin 4187 if symhandler.inModule(stack[i]) and isExecutableAddress(stack[i]) then 4188 begin 4189 result:=stack[i]; //best guess, it's an address specifier, it falls inside a module, and it's executable 4190 exit; 4191 end; 4192 end; 4193 end; 4174 4194 end; 4175 4195 … … 4244 4264 end; 4245 4265 4266 procedure TMemoryBrowser.lvStacktraceDataDblClick(Sender: TObject); 4267 var 4268 hasError: boolean; 4269 x: dword; 4270 4271 column : integer; 4272 cursorpos: tpoint; 4273 tvrect: trect; 4274 i: integer; 4275 4276 currentleft: integer; 4277 s: string; 4278 begin 4279 if stacktrace2.checked then 4280 begin 4281 //go to the selected address 4282 x:=symhandler.getAddressFromName(lvStacktraceData.Selected.Caption,false,haserror); 4283 if not haserror then 4284 disassemblerview.SelectedAddress:=x; 4285 end 4286 else 4287 begin 4288 //depending on what column is selected go to the disassembler/hexview part 4289 cursorpos:=mouse.CursorPos; 4290 GetWindowRect(lvStacktraceData.Handle, tvrect); 4291 4292 //get the relative position 4293 cursorpos.X:=cursorpos.X-tvrect.Left; 4294 cursorpos.Y:=cursorpos.Y-tvrect.Top; 4295 4296 column:=0; 4297 4298 currentleft:=0; 4299 for i:=0 to lvStacktraceData.Columns.count-1 do 4300 begin 4301 if (cursorpos.X>currentleft) and (cursorpos.X<(currentleft+lvStacktraceData.Columns[i].width)) then 4302 begin 4303 column:=i; 4304 break; 4305 end; 4306 inc(currentleft, lvStacktraceData.Columns[i].width); 4307 end; 4308 4309 if column=0 then 4310 s:=lvStacktraceData.Selected.Caption 4311 else 4312 s:=lvStacktraceData.Selected.SubItems[column-1]; 4313 4314 x:=symhandler.getAddressFromName(lvStacktraceData.Selected.Caption,false,haserror); 4315 if not haserror then 4316 begin 4317 if isExecutableAddress(x) then 4318 disassemblerview.SelectedAddress:=x 4319 else 4320 begin 4321 memoryaddress:=x; 4322 RefreshMB; 4323 end; 4324 end; 4325 4326 end; 4327 end; 4328 4246 4329 end. -
Cheat Engine/Release/Cheat Engine.iss
r308 r309 3 3 4 4 [Setup] 5 AppName=Cheat Engine 5.6 BETA 46 AppVerName=Cheat Engine 5.6 BETA 45 AppName=Cheat Engine 5.6 BETA 5 6 AppVerName=Cheat Engine 5.6 BETA 5 7 7 AppPublisher=Dark Byte 8 8 AppPublisherURL=http://www.cheatengine.org/ 9 9 AppSupportURL=http://www.cheatengine.org/ 10 10 AppUpdatesURL=http://www.cheatengine.org/ 11 DefaultDirName={pf}\Cheat Engine Beta 412 DefaultGroupName=Cheat Engine 5.6 BETA 411 DefaultDirName={pf}\Cheat Engine Beta5 12 DefaultGroupName=Cheat Engine 5.6 BETA 5 13 13 AllowNoIcons=yes 14 14 LicenseFile=..\Release\License.txt 15 15 InfoAfterFile=..\Release\readme.txt 16 OutputBaseFilename=CheatEngine56Beta 416 OutputBaseFilename=CheatEngine56Beta5 17 17 PrivilegesRequired=admin 18 18 ChangesAssociations=yes … … 248 248 249 249 [Run] 250 Filename: "{app}\Cheat Engine.exe"; Description: "Launch Cheat Engine 5.6 "; Flags: nowait postinstall skipifsilent runascurrentuser250 Filename: "{app}\Cheat Engine.exe"; Description: "Launch Cheat Engine 5.6 Beta 5"; Flags: nowait postinstall skipifsilent runascurrentuser -
Cheat Engine/Structuresfrm.pas
r308 r309 1181 1181 Memorybrowsethisaddress1.Visible:=false; 1182 1182 1183 if (s .basestructure<0) then1183 if (s<>nil) and (s.basestructure<0) then 1184 1184 begin 1185 1185 Addelement1.Visible:=false; -
Cheat Engine/SynEdit/Source/SynHighlighterAA.pas
r121 r309 139 139 function Func59: TtkTokenKind; //readmem 140 140 function Func68: TtkTokenKind; //include 141 function Func82: TtkTokenKind; //assert 141 142 function Func92: TtkTokenKind; //globalalloc 142 143 function Func101: TtkTokenKind; //fullaccess/loadbinary … … 226 227 end; 227 228 229 procedure aa_AddExtraCommand(command:pchar); 230 procedure aa_RemoveExtraCommand(command:pchar); 231 function isExtraCommand(token:string): boolean; 232 233 228 234 implementation 229 235 … … 238 244 Identifiers: array[#0..#255] of ByteBool; 239 245 mHashTable: array[#0..#255] of Integer; 246 247 extraCommands: Tstringlist; 248 249 procedure aa_AddExtraCommand(command:pchar); 250 begin 251 if extraCommands=nil then 252 begin 253 extraCommands:=tstringlist.create; 254 extraCommands.Duplicates:=dupIgnore; 255 extracommands.CaseSensitive:=false; 256 end; 257 258 extraCommands.Add(command); 259 end; 260 261 procedure aa_RemoveExtraCommand(command:pchar); 262 begin 263 if extracommands<>nil then 264 begin 265 extracommands.Delete(extracommands.IndexOf(command)); 266 if extracommands.Count=0 then 267 freeandnil(extracommands); 268 end; 269 end; 270 271 function isExtraCommand(token: string): boolean; 272 begin 273 result:=false; 274 if extracommands<>nil then 275 result:=extracommands.IndexOf(token)<>-1; 276 end; 277 240 278 241 279 procedure MakeIdentTable; … … 293 331 fIdentFuncTable[59] := Func59; 294 332 fIdentFuncTable[68] := Func68; 333 fIdentFuncTable[82] := Func82; 295 334 fIdentFuncTable[92] := Func92; 296 335 fIdentFuncTable[101] := Func101; … … 500 539 end; 501 540 541 function TSynAASyn.Func82: TtkTokenKind; //include 542 begin 543 if KeyComp('assert') then Result := tkKey else 544 Result := tkIdentifier; 545 end; 546 502 547 function TSynAASyn.Func92: TtkTokenKind; //globalalloc 503 548 begin … … 548 593 for i:=1 to length(s) do 549 594 begin 550 if (s[i]=' ') or (s[i]=#9) or (s[i]=',') or (s[i]=#10) or (s[i]=#13) then595 if (s[i]='(') or (s[i]=' ') or (s[i]=#9) or (s[i]=',') or (s[i]=#10) or (s[i]=#13) then 551 596 begin 552 597 result:=copy(s,1,i-1); … … 566 611 567 612 568 if (result=tkIdentifier) and (GetOpcodesIndex(getfirsttoken(maybe))<>-1) then 569 result:=tkKey; 613 if (result=tkIdentifier) then 614 begin 615 if GetOpcodesIndex(getfirsttoken(maybe))<>-1 then 616 result:=tkKey 617 else 618 if isExtraCommand(getfirsttoken(maybe)) then 619 result:=tkKey; 620 end; 621 622 570 623 end; 571 624 -
Cheat Engine/cheatengine.dof
r307 r309 189 189 MinorVer=6 190 190 Release=0 191 Build= 48191 Build=53 192 192 Debug=0 193 193 PreRelease=1 … … 200 200 CompanyName= 201 201 FileDescription=Cheat Engine 5.6 202 FileVersion=5.6.0. 48202 FileVersion=5.6.0.53 203 203 InternalName=CheatEngine 204 204 LegalCopyright=none -
Cheat Engine/dbk32/debug.pas
r294 r309 115 115 //just make sure to disable the breakpoint before removing the handler 116 116 begin 117 OutputDebugString('DBKDebug_TouchDebugRegister'); 117 118 foreachcpu(internal_touchdebugregister,nil); 118 119 end; -
Cheat Engine/frmHeapsUnit.pas
r281 r309 126 126 procedure TfrmHeaps.FormCreate(Sender: TObject); 127 127 begin 128 frmMemoryAllocHandler:=TfrmMemoryAllocHandler.Create(self); //just not show 128 if frmMemoryAllocHandler=nil then 129 frmMemoryAllocHandler:=TfrmMemoryAllocHandler.Create(self); //just not show 130 129 131 frmMemoryAllocHandler.WaitForInitializationToFinish; 130 132 -
Cheat Engine/frmMemoryAllocHandlerUnit.pas
r285 r309 566 566 var injectionscript: TStringlist; 567 567 var x,y,z: THandle; 568 mi: tmoduleinfo; 568 569 begin 569 570 memrecCS:=TCriticalSection.Create; … … 572 573 try 573 574 //inject allochook.dll 574 injectdll(CheatEngineDir+'allochook.dll'); 575 symhandler.reinitialize; 575 if not symhandler.getmodulebyname('allochook.dll',mi) then 576 begin 577 injectdll(CheatEngineDir+'allochook.dll'); 578 symhandler.reinitialize; 579 end; 580 581 576 582 577 583 -
Cheat Engine/plugin.pas
r305 r309 117 117 disassembleEx : pointer; 118 118 loadModule : pointer; 119 aa_AddExtraCommand: pointer; 120 aa_RemoveExtraCommand: pointer; 119 121 end; 120 122 type PExportedFunctions3 = ^TExportedFunctions3; … … 495 497 implementation 496 498 497 uses mainunit,memorybrowserformunit,formsettingsunit, pluginexports ;499 uses mainunit,memorybrowserformunit,formsettingsunit, pluginexports, SynHighlighterAA; 498 500 499 501 function TPluginHandler.GetDLLFilePath(pluginid: integer):string; … … 1327 1329 exportedfunctions.disassembleEx:=@ce_disassemble; 1328 1330 exportedfunctions.loadModule:=@ce_loadModule; 1331 1332 exportedfunctions.aa_AddExtraCommand:=@aa_AddExtraCommand; 1333 exportedfunctions.aa_RemoveExtraCommand:=@aa_RemoveExtraCommand; 1334 1329 1335 end; 1330 1336 -
Cheat Engine/plugin/cepluginsdk.h
r307 r309 148 148 typedef BOOL (__stdcall *CEP_LOADMODULE)(char *modulepath, char *exportlist, int *maxsize); 149 149 typedef BOOL (__stdcall *CEP_DISASSEMBLEEX)(ULONG address, char *output, int maxsize); 150 typedef VOID (__stdcall *CEP_AA_ADDCOMMAND)(void); 151 typedef VOID (__stdcall *CEP_AA_DELCOMMAND)(void); 150 152 151 153 typedef struct _ExportedFunctions … … 255 257 CEP_DISASSEMBLEEX disassembleEx; 256 258 CEP_LOADMODULE loadModule; 259 CEP_AA_ADDCOMMAND aa_AddExtraCommand; 260 CEP_AA_DELCOMMAND aa_RemoveExtraCommand; 257 261 258 262 -
Cheat Engine/plugin/cepluginsdk.pas
r307 r309 125 125 type TloadModule=function(modulepath: pchar; exportlist: pchar; maxsize: pinteger): BOOL; stdcall; 126 126 type TDisassembleEx=function(address: pdword; output: pchar; maxsize: integer): BOOL; stdcall; 127 type Taa_AddExtraCommand=procedure(command:pchar); 128 type Taa_RemoveExtraCommand=procedure(command:pchar); 127 129 128 130 type TPluginVersion =record … … 237 239 disassembleEx : TDisassembleEx; 238 240 loadModule : TloadModule; 241 242 aa_AddExtraCommand: Taa_AddExtraCommand; 243 aa_RemoveExtraCommand:Taa_RemoveExtraCommand; 244 239 245 end; 240 246 -
Cheat Engine/pluginexports.pas
r303 r309 37 37 38 38 function ce_loadModule(modulepath: pchar; exportlist: pchar; maxsize: pinteger): BOOL; stdcall; 39 39 40 40 41
