-
Notifications
You must be signed in to change notification settings - Fork 4
/
Res.pas
147 lines (125 loc) · 4.1 KB
/
Res.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
unit Res;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, Menus, Unit_main;
type
Tresult = class(TForm)
resultlist: TListView;
Panel1: TPanel;
ListUpdater: TTimer;
procedure FormShow(Sender: TObject);
procedure resultlistChange(Sender: TObject; Item: TListItem;
Change: TItemChange);
procedure resultlistInsert(Sender: TObject; Item: TListItem);
procedure resultlistDeletion(Sender: TObject; Item: TListItem);
procedure ListUpdaterTimer(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure resultlistDblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
result: Tresult;
implementation
uses watcher;
{$R *.dfm}
procedure Tresult.FormShow(Sender: TObject);
begin
result.Top := main.top + main.Height div 2 - result.Height div 2;
result.Left := main.Left + main.Width + 25;
if resultlist.Items.Count <> 0
then result.Caption := 'Search Matches ['+ IntToStr(resultlist.Items.Count) +' Matches]'
else result.Caption := 'Search Matches';
ListUpdater.Enabled := true;
end;
procedure Tresult.resultlistChange(Sender: TObject; Item: TListItem;
Change: TItemChange);
begin
if resultlist.Items.Count <> 0
then result.Caption := 'Search Matches ['+ IntToStr(resultlist.Items.Count) +' Matches]'
else result.Caption := 'Search Matches';
end;
procedure Tresult.resultlistInsert(Sender: TObject; Item: TListItem);
begin
if resultlist.Items.Count <> 0
then result.Caption := 'Search Matches ['+ IntToStr(resultlist.Items.Count) +' Matches]'
else result.Caption := 'Search Matches';
end;
procedure Tresult.resultlistDeletion(Sender: TObject; Item: TListItem);
begin
if resultlist.Items.Count <> 0
then result.Caption := 'Search Matches ['+ IntToStr(resultlist.Items.Count) +' Matches]'
else result.Caption := 'Search Matches';
end;
procedure Tresult.ListUpdaterTimer(Sender: TObject);
var n, i: integer;
bytesread, addrs: cardinal;
intout: integer;
floatout: single;
doubleout: real;
begin
n := resultlist.Items.Count;
if (n > 0) and (n <= 1000) then
begin
for i:=n-1 downto 0 do
begin
if i >= 0 then
begin
addrs := StrToInt('$'+resultlist.Items.Item[i].Caption);
end
else begin
break;
end;
if restype = 1 then
begin
ReadprocessMemory(PHandle, Ptr(addrs), @intout, bytes, bytesread);
resultlist.Items.Item[i].SubItems.Strings[0] := IntToStr(intout);
end;
if (restype = 2) and (bytes = 4) then
begin
ReadprocessMemory(PHandle, Ptr(addrs), @floatout, bytes, bytesread);
resultlist.Items.Item[i].SubItems.Strings[0] := FormatFloat('0.###############', floatout);
end;
if (restype = 2) and (bytes = 8) then
begin
ReadprocessMemory(PHandle, Ptr(addrs), @doubleout, sizeof(doubleout), bytesread);
resultlist.Items.Item[i].SubItems.Strings[0] := FormatFloat('0.###############', doubleout);
end;
end;
end;
end;
procedure Tresult.FormHide(Sender: TObject);
begin
ListUpdater.Enabled := false;
end;
procedure Tresult.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ListUpdater.Enabled := false;
end;
procedure Tresult.resultlistDblClick(Sender: TObject);
var itm: TListitem;
begin
if resultlist.Items.Count > 0 then
begin
if resultlist.Selected.Caption <> '' then
begin
itm := memview.addresseslist.Items.Add;
itm.Caption := resultlist.Selected.Caption;
if restype = 1
then itm.SubItems.Add(IntToStr(bytes)+' Bytes');
if (restype = 2) and (bytes = 4)
then itm.SubItems.Add('Float');
if (restype = 2) and (bytes = 8)
then itm.SubItems.Add('Double');
if (restype = 3)
then itm.SubItems.Add('String['+IntToStr(bytes)+']');
itm.SubItems.Add(resultlist.Selected.SubItems.Strings[0]);
memview.Show;
end;
end;
end;
end.