📄 mainunit.pas.svn-base
字号:
else
begin
set4bytebreak;
continue;
end;
end;
if size>=2 then
begin
if (address mod 2)>0 then
begin
set1bytebreak; //watch on a byte
continue;
end
else
begin
set2bytebreak;
continue;
end;
end;
if size=1 then
set1bytebreak;
end;
// ct.dr7:=$D0303;
if formsettings.cbKdebug.Checked and (debuggerthread=nil) then
begin
if DebuggerThread2<>nil then
begin
debuggerthread2.Terminate;
debuggerthread2.WaitFor;
freeandnil(debuggerthread2);
end;
DebuggerThread2:=TDebugEvents.Create(true);
debuggerthread2.debugregs:=ct;
for i:=0 to length(debuggerthread2.threadlist)-1 do
begin
suspendthread(debuggerthread2.threadlist[i]);
SetThreadContext(debuggerthread2.threadlist[i],debuggerthread2.debugregs);
resumethread(debuggerthread2.threadlist[i]);
end;
debuggerthread2.Resume;
end
else
begin
debuggerthread.DRRegs:=ct;
debuggerthread.Suspend;
for i:=0 to length(debuggerthread.threadlist)-1 do
begin
suspendthread(debuggerthread.threadlist[i][1]);
SetThreadContext(debuggerthread.threadlist[i][1],debuggerthread.DRRegs);
resumethread(debuggerthread.threadlist[i][1]);
end;
debuggerthread.FindWriter2:=true;
debuggerthread.Resume;
end;
end
else
begin
foundcodedialog.useexceptions:=true;
virtualqueryEx(processhandle,pointer(olda),mbi,sizeof(mbi));
debugger.DebuggerThread.readonly.pagebase:=dword(mbi.BaseAddress);
debugger.DebuggerThread.readonly.pagesize:=dword(mbi.RegionSize);
debugger.DebuggerThread.readonly.Address:=olda;
debugger.DebuggerThread.readonly.size:=olds;
DebuggerThread.readonlyset:=true;
VirtualProtectEx(processhandle,pointer(olda),olds,PAGE_EXECUTE_READ,debugger.DebuggerThread.readonly.originalprotection);
end;
foundcodedialog.show;
end;
procedure TMainform.Deletegroups(groups: grouptype);
var i: integer;
begin
for i:=0 to numberofrecords-1 do
begin
if groups[1] and (memrec[i].Group=1) then selected[i]:=true else
if groups[2] and (memrec[i].Group=2) then selected[i]:=true else
if groups[3] and (memrec[i].Group=3) then selected[i]:=true else
if groups[4] and (memrec[i].Group=4) then selected[i]:=true else
if groups[5] and (memrec[i].Group=5) then selected[i]:=true else
if groups[6] and (memrec[i].Group=6) then selected[i]:=true else
selected[i]:=false;
end;
deleterecords;
end;
procedure TMainForm.DeleteRecords;
var i,j: Integer;
begin
if editingscript then exit; //don't do it when editing a script
i:=0;
while i<numberofrecords do
begin
if selected[i] then
begin
unregisterhotkey(handle,hotkeys[i]);
hotkeys[i]:=-1;
setlength(frozenbytes[i],0);
for j:=i to numberofrecords-2 do
begin
memrec[j]:=memrec[j+1];
frozenfvalue[j]:=frozenfvalue[j+1];
frozenstrings[j]:=frozenstrings[j+1];
frozenbytes[j]:=frozenbytes[j+1];
selected[j]:=selected[j+1];
hotkeystrings[j]:=hotkeystrings[j+1];
hotkeys[j]:=hotkeys[j+1];
end;
dec(numberofrecords);
dec(i);
reservemem;
if firstshiftselected>numberofrecords-1 then firstshiftselected:=-1;
end;
inc(i);
end;
If lastselected>numberofrecords-1 then lastselected:=numberofrecords-1;
if lastselected>-1 then selected[lastselected]:=true;
Updatescreen;
Updatelist;
end;
Procedure TMainForm.UpdateScreen;
var rec,i,j: Integer;
temp:string;
col: tcolor;
realaddress,realaddress2,count:dword;
error: boolean;
check: boolean;
resourcestring
strAllowNegative='Allow negative changes';
strAllowPositive='Allow positive changes';
strNormalFreeze='Don''t allow any change';
begin
if numberofrecords>=numberoflines then
begin
if not scrollbar1.Enabled then
scrollbar1.enabled:=true;
if scrollbar1.max<>numberofrecords-1 then
scrollbar1.max:=numberofrecords-1;
if scrollbar1.PageSize<>numberoflines-1 then
scrollbar1.pagesize:=numberoflines-1;
if scrollbar1.LargeChange<>numberoflines-1 then
scrollbar1.LargeChange:=numberoflines-1;
end else
begin
if scrollbar1.Enabled then
scrollbar1.enabled:=false;
if scrollbar1.Position<>0 then
scrollbar1.position:=0;
end;
for i:=0 to numberoflines-1 do
begin
rec:=scrollbar1.Position+i;
if rec<numberofrecords then
begin
if ((memrec[rec].Frozen) or (hotkeys[rec]<>-1)) and (memrec[rec].VarType in [0,1,2,3,4,6]) then
begin
case memrec[rec].Frozendirection of
0:
begin
col:=clBlue;
temp:='=';
end;
1:
begin
temp:='-';
col:=clRed;
end;
2:
begin
temp:='+';
col:=clGreen;
end;
end;
if selected[rec] then col:=ClWhite;
if freezedirection[i].Font.Color<>col then
freezedirection[i].Font.Color:=col;
if temp<>freezedirection[i].Caption then
begin
freezedirection[i].Caption:=temp;
if temp='-' then freezedirection[i].Hint:=strAllowNegative;//'Allow negative changes';
if temp='+' then freezedirection[i].Hint:=strAllowPositive;//'Allow positive changes';
if temp='=' then freezedirection[i].Hint:=strNormalFreeze; //'Don''t allow any change';
freezedirection[i].ShowHint:=true;
end;
freezedirection[i].visible:=true;
end
else
begin
freezedirection[i].visible:=false;
end;
frozenbox[i].checked:=memrec[rec].Frozen;
if hotkeys[rec]<>-1 then
frozenbox[i].Enabled:=false
else
frozenbox[i].Enabled:=true;
description[i].Caption:=memrec[rec].Description;
if memrec[rec].IsPointer then
begin
error:=false;
//find the real address
realaddress2:=memrec[rec].pointers[length(memrec[rec].pointers)-1].Address;
for j:=length(memrec[rec].pointers)-1 downto 0 do
begin
check:=(readprocessmemory(processhandle,pointer(realaddress2),@realaddress,4,count));
if check and (count=4) then
realaddress2:=realaddress+memrec[rec].pointers[j].offset
else
begin
error:=true;
break;
end;
end;
realaddress:=realaddress2;
if not error then
address[i].Caption:='P->'+IntToHex(realaddress,8)
else
address[i].Caption:='P->????????';
end
else
address[i].caption:=IntTohex(memrec[rec].address,8);
// if not frozenbox[i].visible then //if it's not yet visible, make it visible
begin
frozenbox[i].visible:=true;
description[i].visible:=true;
if memrec[rec].VarType<>255 then
begin
address[i].visible:=true;
valtype[i].visible:=true;
value[i].visible:=true;
end
else
begin
address[i].visible:=false;
valtype[i].visible:=false;
value[i].visible:=false;
end;
end;
case memrec[rec].vartype of
0 : valtype[i].Caption:=vartype.Items[1]; //byte
1 : valtype[i].Caption:=vartype.Items[2];
2 : valtype[i].Caption:=vartype.Items[3];
3 : valtype[i].caption:=vartype.Items[5];
4 : valtype[i].caption:=vartype.Items[6];
5 : begin
valtype[i].Caption:=vartype.Items[0]+'['+IntToStr(memrec[rec].Bitlength)+']';
address[i].caption:=address[i].caption+'^'+IntToStr(memrec[rec].Bit);
end;
6 : valtype[i].caption:=vartype.Items[4];
7 :
begin
if memrec[rec].unicode then
valtype[i].Caption:='U'+vartype.Items[7]+'['+inttostr(memrec[rec].Bit)+']'
else
valtype[i].Caption:=vartype.Items[7]+'['+inttostr(memrec[rec].Bit)+']';
end;
8 : valtype[i].Caption:=vartype.Items[8]+'['+inttostr(memrec[rec].Bit)+']';
255 : valtype[i].Caption:=strAutoAssemble;
else valtype[i].caption:=strBUG;
end;
if selected[rec] then
begin
if lastselected=rec then
begin
select[i].Color:=clActiveCaption;
select[i].Font.Color:=clActiveCaption;
Frozenbox[i].Color:=clActiveCaption;
end
else
begin
select[i].Color:=clGradientActiveCaption;
select[i].Font.Color:=clGradientActiveCaption;
Frozenbox[i].Color:=clGradientActiveCaption;
end;
description[i].Font.Color:=clHighlightText;
address[i].Font.Color:=clHighlightText;
valtype[i].Font.Color:=clHighlightText;
value[i].Font.Color:=clHighlightText;
end
else
begin
case memrec[rec].Group of
0 : begin
description[i].Font.Color:=clWindowText;
address[i].Font.Color:=clWindowText;
valtype[i].Font.Color:=clWindowText;
value[i].Font.Color:=clWindowText;
end;
1 : begin
description[i].Font.Color:=clRed;
address[i].Font.Color:=clRed;
valtype[i].Font.Color:=clRed;
value[i].Font.Color:=clRed;
end;
2 : begin
description[i].Font.Color:=clBlue;
address[i].Font.Color:=clBlue;
valtype[i].Font.Color:=clBlue;
value[i].Font.Color:=clBlue;
end;
3 : begin
description[i].Font.Color:=clYellow;
address[i].Font.Color:=clYellow;
valtype[i].Font.Color:=clYellow;
value[i].Font.Color:=clYellow;
end;
4 : begin
description[i].Font.Color:=clGreen;
address[i].Font.Color:=clGreen;
valtype[i].Font.Color:=clGreen;
value[i].Font.Color:=clGreen;
end;
5 : begin
description[i].Font.Color:=clPurple;
address[i].Font.Color:=clPurple;
valtype[i].Font.Color:=clPurple;
value[i].Font.Color:=clPurple;
end;
6 : begin
description[i].Font.Color:=clWhite;
address[i].Font.Color:=clWhite;
valtype[i].Font.Color:=clWhite;
value[i].Font.Color:=clWhite;
end;
else begin
description[i].Font.Color:=clWindowText;
address[i].Font.Color:=clWindowText;
valtype[i].Font.Color:=clWindowText;
value[i].Font.Color:=clWindowText;
end;
end;
select[i].Color:=clBtnFace;
select[i].Font.Color:=clBtnFace;
Frozenbox[i].Color:=clBtnFace;
end;
end else
begin
description[i].Font.Color:=clBtnFace;
select[i].Color:=clBtnFace;
select[i].Font.Color:=clBtnFace;
description[i].Font.Color:=clBtnFace;
Frozenbox[i].Color:=clBtnFace;
address[i].Font.Color:=clBtnFace;
valtype[i].Font.Color:=clBtnFace;
value[i].Font.Color:=clBtnFace;
if frozenbox[i].visible then
begin
frozenbox[i].visible:=false;
description[i].visible:=false;
address[i].visible:=false;
valtype[i].visible:=false;
value[i].visible:=false;
freezedirection[i].Visible:=false;
end;
end;
end;
end;
function TMainForm.CheckIfSaved: boolean;
resourcestring strAskToSave='You haven''t saved your last changes yet. Save Now?';
var help :word;
i,j: Integer;
begin
//result:=true;
result:=not editedsincelastsave;
if advancedoptions.codelist.Count=oldcodelistcount then
begin
end else result:=false;
if (OldNumberOfRecords=NumberOfRecords) then
begin
i:=0;
while (result) and (i<numberofrecords) do
begin
if oldmemrec[i].Description<>memrec[i].Description then result:=false;
if oldmemrec[i].Address<>memrec[i].Address then result:=false;
if oldmemrec[i].VarType<>memrec[i].VarType then result:=false;
if oldmemrec[i].Bit<>memrec[i].Bit then result:=false;
if oldmemrec[i].bitlength<>memrec[i].bitlength then result:=false;
if length(oldmemrec[i].pointers)<>length(memrec
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -