📄 mainunit.pas
字号:
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;
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[i].pointers) then result:=false else
begin
for j:=0 to length(oldmemrec[i].pointers)-1 do
begin
if oldmemrec[i].pointers[j].Address<>memrec[i].pointers[j].Address then result:=false;
if oldmemrec[i].pointers[j].offset<>memrec[i].pointers[j].Offset then result:=false;
end;
end;
if oldmemrec[i].Group<>memrec[i].Group then result:=false;
inc(i);
end;
end else result:=false;
if not (oldcomments=comments.memo1.Text) then result:=false;
if result=false then
begin
help:=messagedlg(strAskToSave,mtConfirmation,mbYesNoCancel,0);
case help of
mrCancel : result:=false;
mrYes : begin
result:=true;
SaveButton.click;
end;
else result:=true;
end;
end;
end;
procedure TMainForm.UpdateScanType;
var OldText: String;
OldIndex: Integer;
hexvis: boolean;
floatvis: boolean;
oldwidth: integer;
resourcestring
strScantextcaptiontotext='Text:';
strScantextcaptiontoValue='Value:';
strsearchForText='Search for text';
strSearchForArray='Search for this array';
begin
OldIndex:=Scantype.itemindex;
OldText:=Scantype.text;
hexvis:=true;
floatvis:=false;
ScanType.Items.Clear;
ScanText.Caption:=strScantextcaptiontoValue;
case varType.ItemIndex of
0 : begin
ScanType.Items.Add(strExact);
ScanType.DropDownCount:=1;
end;
1,2,3,4,5,6:begin //byte-word-dword--8bytes-float-double
if vartype.itemindex in [5,6] then
begin
if oldindex=0 then
floatvis:=true;
hexvis:=false;
end;
ScanType.Items.Add(strExactValue);
ScanType.Items.Add(strBiggerThan);
ScanType.Items.Add(strsmallerThan);
ScanType.Items.Add(strValueBetween);
if NextScanbutton.Enabled then
begin
scantype.Items.Add(strIncreasedValue);
Scantype.Items.Add(strIncreasedValueBy);
ScanType.Items.Add(strDecreasedValue);
ScanType.Items.Add(strDecreasedValueBy);
ScanType.Items.add(strChangedValue);
ScanType.Items.Add(strUnchangedValue);
Scantype.DropDownCount:=10;
end else
begin
ScanType.Items.Add(strUnknownInitialValue);
ScanType.DropDownCount:=5;
end;
end;
7: begin //text
ScanText.caption:=strScanTextCaptionToText;
ScanType.Items.Add(strSearchForText);
//perhaps also a changed value and unchanged value scan
ScanType.DropDownCount:=1;
hexvis:=false;
end;
8: begin //array of bytes
ScanText.caption:=vartype.Items[8];
ScanType.Items.Add(strSearchforarray);
ScanType.DropDownCount:=1;
end;
end;
if (oldtext=strUnknownInitialValue) and (NextScanButton.enabled) then scantype.itemindex:=0 else scantype.itemindex:=oldindex;
if (scantype.text=strIncreasedValueBy) or (scantype.text=strDecreasedValueBy) then
begin
cbpercentage:=tcheckbox.create(self);
cbpercentage.Left:=scantype.Left+scantype.Width+5;
cbpercentage.Top:=scantype.Top+2;
cbpercentage.Caption:='at least xx%';
cbpercentage.Width:=80;
cbpercentage.Parent:=scantype.Parent;
end
else
begin
if cbpercentage<>nil then
freeandnil(cbpercentage);
end;
if scantype.Text=strValueBetween then
begin
if scanvalue2=nil then
begin
//decrease the width of the scanvalue editbox
oldwidth:=scanvalue.width;
scanvalue.Width:=(scanvalue.Width div 2)-20;
//create a 2nd editbox
scanvalue2:=tedit.create(self);
//scanvalue2.onkeydown:=scanvalueKeyDown;
scanvalue2.OnKeyPress:=ScanvalueoldKeyPress;
scanvalue2.PopupMenu:=ccpmenu;
scanvalue2.Left:=scanvalue.left+scanvalue.Width+20;
scanvalue2.Width:=oldwidth-scanvalue.width-20;
scanvalue2.Top:=scanvalue.top;
scanvalue2.Parent:=scanvalue.Parent;
scanvalue2.Anchors:=scanvalue.Anchors;
scantext2:=tlabel.create(self);
scantext2.caption:=scantext.caption;
scantext2.Left:=scanvalue2.Left;
scantext2.Top:=scantext.top;
scantext2.Parent:=scantext.parent;
andlabel:=tlabel.Create(self);
andlabel.Caption:='and';
andlabel.Left:=scanvalue2.Left-20;
andlabel.Top:=scanvalue2.Top+2;
andlabel.Parent:=scanvalue2.Parent;
end
end else
begin
if scanvalue2<>nil then
begin
scanvalue.Width:=scanvalue.width+20+scanvalue2.width;
freeandnil(scanvalue2);
freeandnil(scantext2);
freeandnil(andlabel);
end;
end;
if (scantype.Text=strIncreasedValue) or
(scantype.text=strDecreasedValue) or
(scantype.Text=strChangedValue) or
(scantype.Text=strUnchangedValue) or
(scantype.Text=strUnknownInitialValue) then
begin
Scantext.Visible:=false;
Scanvalue.visible:=false;
HexadecimalCheckbox.visible:=false;
end else
begin
Scantext.Visible:=true;
Scanvalue.visible:=true;
HexadecimalCheckbox.visible:=hexvis;
end;
pnlfloat.Visible:=floatvis;
end;
procedure TMainForm.UpdateList2;
var i,j,k: Integer;
read1: byte;
read2: word;
read3: dword;
read4: single;
read5: double;
read6: Int64;
read7: pchar;
read72: pwidechar;
read8: array of byte;
read9: pbyte;
count: dword;
rec: Integer;
temp,temp2,temp3: string;
nrofbytes: integer;
realaddress,realaddress2: dword;
lastvisible: dword;
begin
//
count:=0;
if foundlist2.TopItem=nil then exit;
// lastvisible:=foundlist2.TopItem.Index+foundlist2.VisibleRowCount;
//if lastvisible>foundlist2.Items.Count-1 then lastvisible:=foundlist2.Items.Count-1;
for i:=0 to length(ShownAddresses)-1 do
begin
realaddress:=ShownAddresses[i].address;
case GetVarType of
0:
begin //byte
readprocessmemory(processhandle,pointer(realaddress),addr(read1),1,count);
if count=0 then temp3:='??' else
begin
if formsettings.cbShowAsSigned.checked then
temp3:=IntToStr(ShortInt(read1))
else
temp3:=IntToStr(read1);
if lastwashex then IntToHex(read1,2);
end;
end;
1:
begin //word
readprocessmemory(processhandle,pointer(realaddress),addr(read2),2,count);
if count=0 then temp3:='??' else
begin
if formsettings.cbShowAsSigned.checked then temp3:=IntToStr(SmallInt(read2))
else temp3:=IntToStr(read2);
if lastwashex then temp3:=IntToHex(read2,4);
end;
end;
2:
begin //dword
readprocessmemory(processhandle,pointer(realaddress),addr(read3),4,count);
if count=0 then temp3:='??' else
begin
if formsettings.cbShowAsSigned.checked then temp3:=IntToStr(Longint(read3))
else temp3:=IntToStr(read3);
if lastwashex then temp3:=IntToHex(read3,8);
end;
end;
3:
begin //float
readprocessmemory(processhandle,pointer(realaddress),addr(read4),4,count);
if count=0 then temp3:='??' else
temp3:=FloatToStr(read4);
end;
4:
begin //double
readprocessmemory(processhandle,pointer(realaddress),addr(read5),8,count);
if count=0 then temp3:='??' else
temp3:=FloatToStr(read5);
end;
5:
begin //binary
//read the bytes
nrofbytes:=1+((shownaddresses[i].startbit+shownaddresses[i].bitlength) div 8);
setlength(read8,nrofbytes);
readprocessmemory(processhandle,pointer(realaddress),addr(read8[0]),nrofbytes,count);
if count=0 then temp3:='??' else
begin
//convert what i need to a string of bits
temp:='';
j:=shownaddresses[i].startbit;
read9:=@read8[0];
for k:=1 to shownaddresses[i].bitlength do
begin
temp:=temp+Int
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -