Make the disassembler show some more data in the comment field

Adding some extra safety checks to the structure dissect
Fix the structure settings from closing after giving invalid input
(last commit meant physical of course)
This commit is contained in:
cheatengine@gmail.com 2013-11-18 18:30:54 +00:00
parent d9d050de3b
commit a2e94d5418
4 changed files with 57 additions and 39 deletions

View File

@ -2881,10 +2881,13 @@ var
startindex: integer;
begin
tvStructureView.OnExpanded:=nil;
tvStructureView.OnExpanding:=nil;
tvStructureView.OnCollapsed:=nil;
tvStructureView.OnCollapsing:=nil;
tvStructureView.BeginUpdate;
currentnode.DeleteChildren;
if currentnode.haschildren then
currentnode.DeleteChildren;
struct:=TDissectedStruct(currentnode.data);
@ -2904,14 +2907,16 @@ begin
setupNodeWithElement(newnode, struct[i]);
end;
currentnode.HasChildren:=true;
currentnode.Expand(false);
if currentnode.haschildren then
currentnode.Expand(false);
end;
tvStructureView.EndUpdate;
tvStructureView.OnExpanded:=tvStructureViewExpanded;
tvStructureView.OnExpanding:=tvStructureViewExpanding;
tvStructureView.OnCollapsed:=tvStructureViewCollapsed;
tvStructureView.OnCollapsing:=tvStructureViewCollapsing;
end;
@ -2919,49 +2924,50 @@ procedure TfrmStructures2.tvStructureViewCollapsed(Sender: TObject; Node: TTreeN
var struct, childstruct: TDissectedStruct;
begin
tvStructureView.BeginUpdate;
node.DeleteChildren; //delete the children when collapsed
try
if node.HasChildren then
node.DeleteChildren; //delete the children when collapsed
if node.parent<>nil then //almost always, and then it IS a child
begin
//get the structure this node belongs to
struct:=getStructFromNode(node);
//now get the element this node represents and check if it is a pointer
node.HasChildren:=struct[node.Index].isPointer;
if miAutoDestroyLocal.checked then //delete autocreated local structs when closed
if node.parent<>nil then //almost always, and then it IS a child
begin
childstruct:=TDissectedStruct(node.data);
if childstruct<>nil then
begin
if not childstruct.isInGlobalStructList then
begin
//delete this local struct
childstruct.free;
//get the structure this node belongs to
{$ifdef DEBUG}
assert(node.data=nil);
{$endif}
node.data:=nil; //not necesary
struct:=getStructFromNode(node);
//now get the element this node represents and check if it is a pointer
node.HasChildren:=struct[node.Index].isPointer;
if miAutoDestroyLocal.checked then //delete autocreated local structs when closed
begin
childstruct:=TDissectedStruct(node.data);
if childstruct<>nil then
begin
if not childstruct.isInGlobalStructList then
begin
//delete this local struct
childstruct.free;
{$ifdef DEBUG}
assert(node.data=nil);
{$endif}
node.data:=nil; //not necesary
end;
end;
end;
end
else //root node (mainstruct)
if node.data<>nil then //weird if not...
begin
node.HasChildren:=true;
node.Expand(false); //causes the expand the fill in the nodes
end;
end
else //root node (mainstruct)
if node.data<>nil then //weird if not...
begin
node.HasChildren:=true;
node.Expand(false); //causes the expand the fill in the nodes
finally
tvStructureView.EndUpdate;
end;
tvStructureView.EndUpdate;
end;
procedure TfrmStructures2.tvStructureViewCollapsing(Sender: TObject;
@ -3414,9 +3420,11 @@ begin
end;
end;
free;
end;
ei.free;
end;
procedure TfrmStructures2.addFromNode(n: TTreenode; asChild: boolean=false);

View File

@ -10875,6 +10875,15 @@ begin
result:=pwidechar(@buffer[0]);
end;
vtPointer:
begin
if processhandler.is64Bit then
result:=inttohex(PQWord(@buffer[0])^,8)
else
result:=inttohex(PDWord(@buffer[0])^,8);
end;
end;
// result:=VariableTypeToString(vtype);
if a and (result<>'') then

View File

@ -260,7 +260,6 @@ object frmStructuresConfig: TfrmStructuresConfig
Width = 75
Caption = 'OK'
Default = True
ModalResult = 1
OnClick = Button1Click
TabOrder = 0
end

View File

@ -308,6 +308,8 @@ begin
reg.free;
end;
modalresult:=mrok;
end;