-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainUnit.pas
More file actions
1955 lines (1738 loc) · 57.5 KB
/
MainUnit.pas
File metadata and controls
1955 lines (1738 loc) · 57.5 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
name:(1999.12.1 -jhx1)
江湖行 II jhx2
2002.10.13 renamed to 'GamePaladin II'
CopyRight:XuGanQuan gqxunet#163.com
Description:A game cheat tool
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.
}
unit MainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, ImgList, ExtCtrls, Buttons, StdCtrls, Menus,
Gauges, Grids, XPMan,mmsystem, OleCtrls, shlobj,comobj,activex,shellapi,SHDocVw,Registry;
resourcestring
String_notask='没有内存搜索任务;请新建加入;';
String_Addtask='没有内存搜索任务;现在就创建加入吗?';
String_Addtasktitle='没有任务信息';
String_noresult='搜索次数: 0 , 找到数目:0 ';
String_NoResultAgain='抱歉,找不到任何匹配的地址,是否再次搜索?';
String_NoResultAgainTitle='无结果信息';
String_TypeNoMatch='输入的类型不匹配上次类型(高阶/低阶),'+
'你想进行新类型的搜索吗? ';
String_TypeNoMatchTitle='输入的类型不匹配信息';
String_ScanResult='搜索次数:%d , 找到数目:%d ';
String_ByteType='Byte Type';
String_WordType='Word Type';
String_DWordType='DWord Type';
String_Int64Type='Int64 Type';
String_SingleType='Single Type';
String_DoubleType='Double Type';
String_StringType='Text Type';
String_applying='有效';
String_noapplying='不可用';
String_invalidSave='不能载入该文件,请检查是否为江湖行II(Game Paladin II)的存档文件';
String_AskRepeatInitLowLevel='已经进行了初始化内存的低阶搜索,'#13#10+
'是否再次初始化?';
String_AskRepeatInitLowLevelTitle='内存低阶搜索重复初始化信息';
String_InScan='当前的任务正在进行,请等待.';
String_InScanTitle='任务进行信息';
String_Taskinvalid='对应的进程/应用程序已经关闭. ';
String_Maxtask='最多加入 %d 个任务,请删除部分无用的任务;';
String_NeedSeletedtask='请选择一个已有的任务.';
String_NotSethotkey1='主窗口弹出热键不合法或者该热键已经被另一程序占用;请重新设置.';
String_NotSethotkey2='抓图热键不合法或者该热键已经被另一程序占用.请重新设置';
string_setok='成功应用新的选项.';
String_selectdir='请选择一个目录:';
type
TMainForm = class(TForm)
MainImageList: TImageList;
MainPageControl: TPageControl;
MyFavorites_TS: TTabSheet;
MemoryScan_TS: TTabSheet;
archiveEdit_TS: TTabSheet;
CapPic_TS: TTabSheet;
Main_cb: TCoolBar;
Main_TB: TToolBar;
MemEdit_TB: TToolButton;
archiveEdit_TB: TToolButton;
CapPic_TB: TToolButton;
SetOptions_TB: TToolButton;
Help_TB: TToolButton;
MyFavorite_TB: TToolButton;
GameRecord_TB: TToolButton;
GameRecord_TS: TTabSheet;
SET_TS: TTabSheet;
help_TS: TTabSheet;
temp_Panel1: TPanel;
Panel1: TPanel;
Splitter1: TSplitter;
MiddleImageList: TImageList;
taskListPopupMenu: TPopupMenu;
delTasks_Menu: TMenuItem;
N2: TMenuItem;
ClearAlltasks_menu: TMenuItem;
FoundPopMenu: TPopupMenu;
FoundMem_Memu: TMenuItem;
FoundAdd_memu: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
EditLock_Memu: TMenuItem;
Panel4: TPanel;
LockPopMenu: TPopupMenu;
LockMod_memu: TMenuItem;
LockAddress_menu: TMenuItem;
N7: TMenuItem;
LockRemove_menu: TMenuItem;
N9: TMenuItem;
Panel5: TPanel;
AddNew: TPopupMenu;
New1_menu: TMenuItem;
N3: TMenuItem;
new2_menu: TMenuItem;
Lock_Clear: TMenuItem;
openLockRecordDialog: TOpenDialog;
SaveLockRecordDialog: TSaveDialog;
Lockcopy_memu: TMenuItem;
Lockpaste_menu: TMenuItem;
N6: TMenuItem;
ImageList1: TImageList;
DisplayProcess: TTimer;
XPManifest1: TXPManifest;
Options_TreeView: TTreeView;
Option_ImageList: TImageList;
Options_PageControl: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Set_1_RB1: TRadioButton;
Set_1_RB2: TRadioButton;
Set_1_RB3: TRadioButton;
Set_1_RB4: TRadioButton;
set_FromEdit: TEdit;
Set_toEdit: TEdit;
GroupBox2: TGroupBox;
Label5: TLabel;
Lock_Frequency_LB: TLabel;
Lock_TrackBar: TTrackBar;
TabSheet3: TTabSheet;
Set_1_OK: TButton;
Label4: TLabel;
Main_HotKey: THotKey;
Capture_HotKey: THotKey;
SaveWay_RG: TGroupBox;
SaveMode1: TRadioButton;
SaveMode2: TRadioButton;
CaptureSavepath_Edit: TEdit;
SaveMode3: TRadioButton;
Label8: TLabel;
Set_2_ok: TButton;
Help_popMenu: TPopupMenu;
Content1: TMenuItem;
Homepage1: TMenuItem;
N1: TMenuItem;
About1: TMenuItem;
GroupBox3: TGroupBox;
EnabledAlphaBlend_cb: TCheckBox;
Alphablend_TrackBar: TTrackBar;
set_autoRun: TCheckBox;
Support1: TMenuItem;
Makeappshortcut: TButton;
Label6: TLabel;
Label7: TLabel;
Label9: TLabel;
path_bn: TButton;
ToolBar1: TToolBar;
newtask_TB: TToolButton;
deltask_tb: TToolButton;
MainPanel2: TPanel;
Scan_bn: TSpeedButton;
InputHelp_SB: TSpeedButton;
backtogame_bn: TSpeedButton;
Value_Edit: TEdit;
VarType_CB: TComboBox;
Panel3: TPanel;
StaticText1: TStaticText;
Task_info_Name_LB: TStaticText;
Task_Info_SearchResult_LB: TStaticText;
Scan_Gauge: TGauge;
Found_LV: TListView;
Panel6: TPanel;
ToolBar4: TToolBar;
SelMemEdit_TB: TToolButton;
AddToLock_Tb: TToolButton;
EditAddress_tb: TToolButton;
lockRemove_TB: TToolButton;
OpenLockRecord_TB: TToolButton;
SaveLockRecord_TB: TToolButton;
Splitter2: TSplitter;
Lock_LV: TListView;
Panel2: TPanel;
tasks_LV: TListView;
procedure FormCreate(Sender: TObject);
procedure deltask_tbClick(Sender: TObject);
procedure newtask_TBClick(Sender: TObject);
procedure Scan_bnClick(Sender: TObject);
procedure InputHelp_SBClick(Sender: TObject);
procedure VarType_CBChange(Sender: TObject);
procedure tasks_LVClick(Sender: TObject);
procedure Value_EditKeyPress(Sender: TObject; var Key: Char);
procedure SelMemEdit_TBClick(Sender: TObject);
procedure tasks_LVEdited(Sender: TObject; Item: TListItem;
var S: String);
procedure ClearAlltasks_menuClick(Sender: TObject);
procedure EditAddress_tbClick(Sender: TObject);
procedure FoundMem_MemuClick(Sender: TObject);
procedure Found_LVDblClick(Sender: TObject);
procedure EditLock_MemuClick(Sender: TObject);
procedure New1_menuClick(Sender: TObject);
procedure Lock_LVDblClick(Sender: TObject);
procedure Found_LVMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure LockRemove_menuClick(Sender: TObject);
procedure FoundAdd_memuClick(Sender: TObject);
procedure Lock_ClearClick(Sender: TObject);
procedure LockAddress_menuClick(Sender: TObject);
procedure Lock_LVEdited(Sender: TObject; Item: TListItem;
var S: String);
procedure Lock_LVMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure SaveLockRecord_TBClick(Sender: TObject);
procedure OpenLockRecord_TBClick(Sender: TObject);
procedure Lockcopy_memuClick(Sender: TObject);
procedure Lockpaste_menuClick(Sender: TObject);
procedure Set_1_RB1Click(Sender: TObject);
procedure Set_1_RB2Click(Sender: TObject);
procedure Set_1_RB3Click(Sender: TObject);
procedure Set_1_RB4Click(Sender: TObject);
procedure Lock_TrackBarChange(Sender: TObject);
procedure MyFavorite_TBClick(Sender: TObject);
procedure MemEdit_TBClick(Sender: TObject);
procedure archiveEdit_TBClick(Sender: TObject);
procedure CapPic_TBClick(Sender: TObject);
procedure SetOptions_TBClick(Sender: TObject);
procedure Help_TBClick(Sender: TObject);
procedure backtogame_bnClick(Sender: TObject);
procedure tray_minClick(Sender: TObject);
procedure DisplayProcessTimer(Sender: TObject);
procedure GameRecord_TBClick(Sender: TObject);
procedure Options_TreeViewClick(Sender: TObject);
procedure Set_1_OKClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Set_2_okClick(Sender: TObject);
procedure EnabledAlphaBlend_cbClick(Sender: TObject);
procedure Alphablend_TrackBarChange(Sender: TObject);
procedure set_autoRunClick(Sender: TObject);
procedure MakeappshortcutClick(Sender: TObject);
procedure About1Click(Sender: TObject);
procedure path_bnClick(Sender: TObject);
procedure Homepage1Click(Sender: TObject);
procedure Support1Click(Sender: TObject);
private
//FSaveEditForm:TSaveEditForm;
{ Private declarations }
public
function NameToCode(RegName:String;out RegString:String):Boolean;
function SelectDir(ParentHWnd: HWnd; const Root: WideString; out Directory: string): Boolean;
function HotKeyToShortCut(mode,value:UINT):TShortCut;
function ShortCutToHotKey_Mode(Value: TShortCut):UINT;
function ShortCutToHotKey_Value(Value: TShortCut):UINT;
procedure WMhotkeyhandle(var msg:Tmessage); message wm_hotkey;
Procedure UpdateTaskInfo(theIndex:integer);
Procedure AddTasktoList(theIndex:integer);
Procedure AddFoundToListView(theIndex:integer);
Procedure UpdateLockInfo(theIndex,theListIndex:integer);
Function CheckForScan:boolean;
procedure RaiseInputError;
procedure SaveOptions;
{ Public declarations }
end;
type
MyOption=record
WhichPage:Byte;
AlphaBlend:byte;
AlphaBlendValue:byte;
MainHotKey_mode:UINT;
MainHotKey_value:UINT;
ScanAddressMode:byte;
DefaultFromAddress:Dword;
DefaultToAddress:Dword;
CaptureSaveMode:byte;
CaptureSavePath:String[255];
CaptureHotKey_mode:UINT;
CaptureHotKey_value:UINT;
setActivePage:Byte;
Lock_Interval:Word;
FormWidth:WORD;
FormHeigth:WORD;
end;
type
TTimerThread=class(TThread)
private
procedure ProcessLock;
protected
procedure Execute; override;
public
constructor Create;
end;
var MainForm: TMainForm;
ErrorInputNum:Byte;
Apppath:String;
String_GPSAVE:string[$30];
GPOptions:MyOption;
Lock_Enable:Boolean;
HotKeyID_Main:Integer;
HotKeyID_Capture:Integer;
implementation
uses GetProcessIDUnit,GPKernel, InputhelpUnit, MemEditUnit, MemRecordUnit,
MyCalcUnit,CapturePicUnit, GameRecordUnit,MyfavoritesUnit,
ArchiveEditUnit, HelpWebBrowserUnit, RegisterUnit;
{$R *.dfm}
function TmainForm.NameToCode(RegName:String;out RegString:String):Boolean;
var i,index,strlen:Integer;
TempNum:BYTE;
EncryptArray:array[1..20] of BYTE;
const EncryptString:array[0..20] of String[21]=
('GreatXGQGamePaladinII',
'asdasda$%^&*24tsgd6gf',
'AAGUYXLKjljhda^*(dfs9',
')(*&^*()__jnMfcdlsaDJ',
'&jldffggdfg****dasdff',
'345874fBNNKhdfll;~1!2',
'>>.,f....,cwe%TGhj3rf',
'^&&(*ncfg0nldskf4tl$$',
'fgvfdsg fgfdgdg fa!',
'HOw fdo you trun this',
'What do you want fwgg',
'MUYN c~3490&68xn7DT8O',
'GBEKEGm )(845+_F_FGHH',
'6C35CBV6BN88UCF3C346V',
'165CVCBNM09FVN,O6/.,B',
'7U6HFR6YHLO9@~L`~~ ',
'T5VBNMynmCFMVM4Clku^#',
'TBNBVCXVBVCVBN9CTOVVB',
'ytiuB,Uuyg,/*&%TYJ;LK',
'FHVUIJ5098CK;;3C905OP',
'CV436-40J60VCCKLMZ%^&'
);
const Validstring='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
begin
Result:=false;
RegString:='';
strlen:=Length(RegName);
if strlen<4 then exit;
/////key change//////////
TempNum:=0;
for i:=1 to strlen do TempNum:=TempNum+Ord(RegName[i]);
tempNUm:=abs(tempNum);
index:=TempNum mod 21;
///////fix length//////
if strlen<10 then RegName:=RegName+Copy(Validstring,1,10-strlen) else
RegName:=Copy(RegName,1,10);
TempNum:=1;
for i:=1 to 10 do
begin
TempNum:=TempNum*((Ord(RegName[i]) mod 21)+1);
end;
DEC(TempNum,strLen);
tempNUm:=abs(tempNum);
inc(index,TempNum);
index:=index mod 21;
for i:=1 to 10 do EncryptArray[i]:=Ord(EncryptString[index][i]);
for i:=1 to 10 do
begin
if i=6 then RegString:=RegString+'-';
TempNum:=Ord(RegName[i]) xor EncryptArray[i];
if (Pos(chr(TempNum),Validstring)>0) then RegString:=RegString+chr(TempNum) else
begin
TempNum:=TempNUm mod 36; ///36 letter mod :=0.. 35
RegString:=RegString+Validstring[TempNum+1];
end;
end;
Result:=True;
end;
function TmainForm.SelectDir(ParentHWnd: HWnd; const Root: WideString;
out Directory: string): Boolean;
var
BrowseInfo: TBrowseInfo;
Buffer: PChar;
//RootItemIDList: PItemIDList;
ItemIDList: PItemIDList;
ShellMalloc: IMalloc;
//IDesktopFolder: IShellFolder;
//Eaten, Flags: LongWord;
begin
Result := False;
Directory := '';
FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
//SHGetDesktopFolder(IDesktopFolder);
//IDesktopFolder.ParseDisplayName(Application.Handle, nil, POleStr(Root), Eaten, RootItemIDList, Flags);
with BrowseInfo do
begin
hwndOwner := ParentHWnd;
//pidlRoot := RootItemIDList;
pszDisplayName := Buffer;
lpszTitle := PChar(String_selectdir);
ulFlags := BIF_RETURNONLYFSDIRS;
end;
ItemIDList := ShBrowseForFolder(BrowseInfo);
Result := ItemIDList <> nil;
if Result then
begin
ShGetPathFromIDList(ItemIDList, Buffer);
ShellMalloc.Free(ItemIDList);
Directory := Buffer;
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;
constructor TTimerThread.Create;
begin
FreeOnTerminate:=True;
inherited Create(False);
end;
Procedure TTimerThread.ProcessLock;
var i,theIndex:integer;
Ecode:integer;
TempByte:Byte;
TempWord:Word;
TempDword:Dword;
Tempint64:int64;
TempSingle:Single;
TempDouble:Double;
TempString:String[16];
theStatus:boolean;
begin
if (LockNum=0) then exit;
for i:=1 to lockNum do
begin ///for
theindex:=ListToLockIndex[i];
MemLockRecord[theindex].Frozen:=MainForm.Lock_Lv.Items.Item[i-1].Checked;
if MainForm.Lock_Lv.Items.Item[i-1].Checked then
try
begin
with MemLockRecord[theindex] do
begin
case VarType of
Byte_value: begin
val(valueStr,tempByte,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempByte,Byte_value,1);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
Word_value: begin
val(valueStr,tempWord,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempWord,Word_value,2);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
Dword_value: begin
val(valueStr,tempDWord,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempDWord,Dword_value,4);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
Int64_value: begin
val(valueStr,tempInt64,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempInt64,Int64_value,8);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
Single_value: begin
val(valueStr,tempSingle,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempSingle,Single_value,4);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
Double_value: begin
val(valueStr,tempDouble,Ecode);
theStatus:=WriteMemory(ProcessID,Address,@tempDouble,Double_value,8);
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i].SubItems[4]:=String_noapplying;
end ;
String_value: begin
tempString:=valueStr;
theStatus:=WriteMemory(ProcessID,Address,@tempString[1],String_value,Length(tempString));
if theStatus then MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_applying else
MainForm.Lock_Lv.Items.Item[i-1].SubItems[4]:=String_noapplying;
end ;
end; ///case
end; ///with
end;//try end;
except
Continue;
end;
end; ///for
end;
Procedure TTimerThread.Execute;
begin
while (Lock_Enable)do
begin
Synchronize(ProcessLock);
sleep(GPOptions.Lock_Interval);
end;
end;
procedure TMainForm.Wmhotkeyhandle(var msg:Tmessage);
begin
if (msg.LParamHi=GPOptions.MainHotKey_value) and (msg.lparamLo=GPOptions.MainHotKey_mode) then
begin
msg.Result:=1; //该消息已经处理
SetActiveWindow(MainForm.Handle);
DefWindowProc(MainForm.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(MainForm.Handle);
application.BringToFront;
end;
end;
Procedure TmainForm.RaiseInputError;
begin
with theTask[CurrenttaskIndex] do
begin
inc(ErrorInputNum);
Value_Edit.SetFocus;
if ErrorInputNum>3 then
begin
Messagebeep(0);
ErrorInputNum:=0;
InputHelp_sb.click;
end;
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
var TheOptionStream:TMemoryStream;
OptionsFileName:String;
Reg:TRegistry;
// ReadRegName:string;
// ReadRegCode:string;
// TrueRegCode:string;
// RegDate:Integer;
begin
Reg:=Tregistry.Create;
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
////////////////////////
{
if Reg.OpenKey('SOFTWARE\XGQsoft\GamePaladin\',true) then
begin
if not reg.ValueExists('Registration Date') then
begin
RegDate:=Trunc(now) xor 790726;
Reg.WriteString('Registration Date',inttoStr(RegDate));
end;
Reg.CloseKey;
end;
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
if Reg.OpenKey('SOFTWARE\XGQsoft\GamePaladin\',true) then
begin
ReadRegName:=Reg.ReadString('Registration Name');
ReadRegCode:=Reg.ReadString('Registration Code');
Reg.CloseKey;
end;
if (not Nametocode(ReadRegName,TrueRegCode) ) or
(ReadRegCode<>TrueRegCode) then
begin
RegisterForm:=TregisterForm.Create(self);
RegisterForm.ShowModal;
FreeandNil(RegisterForm);
end;
}
////////////////////////
String_GPSAVE:='XuGanQuan Software of Game Paladin II';
apppath:=ExtractFilePath(Application.ExeName);
if not DirectoryExists(apppath+'temp') then CreateDirectory(pchar(apppath+'temp'),nil);
MyFavoritesForm:=TMyFavoritesForm.Create(Application,Myfavorites_TS);
MyFavoritesForm.show;
ArchiveEditForm:=TArchiveEditForm.Create(Application,ArchiveEdit_TS);
ArchiveEditForm.Show;
CapturePicForm:=TCapturePicForm.Create(Application,CapPic_TS);
CapturePicForm.Show;
GameRecordForm:=TGameRecordForm.Create(Application,GameRecord_TS);
GameRecordForm.Show;
TTimerThread.Create;
hotkeyid_Main:=GlobalAddAtom(pchar('XGQ_GamePaladin_HotKey01'))-$C000;
hotkeyid_Capture:=GlobalAddAtom(pchar('XGQ_GamePaladin_HotKey02'))-$C000;
TheOptionStream:=TMemoryStream.Create;
TheOptionStream.SetSize(0);
OptionsFileName:=Apppath+'GPOptions.dat';
if FileExists(OptionsFileName) then TheOptionStream.LoadFromFile(Apppath+'GPOptions.dat');
///读取或者还原默认值
try
if TheOptionStream.size<>sizeof(GPOptions) then
begin
with GpOptions do
begin
WhichPage:=1;
AlphaBlend:=0;
AlphaBlendValue:=120;
MainHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
MainHotKey_value:=$77; ////F8
ScanAddressMode:=1;
DefaultFromAddress:=$0001000;
DefaultToAddress:=$86500000;
CaptureSaveMode:=1;
CaptureSavePath:=apppath+'capture\';
CaptureHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
CaptureHotKey_value:=$78; ///F9
setActivePage:=1;
Lock_Interval:=500;
FormWidth:=650;
FormHeigth:=460;
end;
SaveOptions;
end else TheOptionStream.ReadBuffer(GPOptions,sizeof(GPOptions));
finally
freeandNil(TheOptionStream);
end;
////////校正/////////////////////////
with GpOptions do
begin
if WhichPage>7 then WhichPage:=1;
if AlphaBlend>1 then AlphaBlend:=0;
if AlphaBlendValue<=80 then AlphaBlendValue:=200;
//MainHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
// MainHotKey_value:=$77; ////F8
if ScanAddressMode>4 then ScanAddressMode:=1;
if DefaultFromAddress>=DefaultToAddress then
begin
DefaultFromAddress:=$0001000;
DefaultToAddress:=$86500000;
end;
if CaptureSaveMode>3 then CaptureSaveMode:=1;
//CaptureSavePath:=apppath+'capture\';
//CaptureHotKey_mode:=MOD_SHIFT or MOD_CONTROL;
// CaptureHotKey_value:=$78; ///F9
if setActivePage>3 then setActivePage:=1;
if Lock_Interval>5000 then Lock_Interval:=500;
end;
/////////////显示////////////////////////////////////////////
with GpOptions do
begin
MainForm.Width:=FormWidth;
MainForm.Height:=FormHeigth;
if AlphaBlend=0 then
begin
MainForm.AlphaBlend:=false;
EnabledAlphaBlend_cb.State:=cbUnChecked;
end
else
begin
EnabledAlphaBlend_cb.State:=cbChecked;
MainForm.AlphaBlend:=true;
end;
Alphablend_TrackBar.Position:=AlphaBlendValue;
case WhichPage of
1:begin MyFavorite_TB.Down:=true;MyFavorite_TB.Click; end;
2:begin MemEdit_TB.Down:=true; MemEdit_TB.Click; end;
3:begin archiveEdit_TB.Down:=true; archiveEdit_TB.Click; end;
4:begin CapPic_tb.Down:=true; CapPic_tb.Click; end;
5:begin GameRecord_Tb.Down:=true; GameRecord_Tb.Click; end;
6:begin SetOptions_tb.Down:=true; SetOptions_tb.Click; end;
7:begin Help_Tb.Down:=true; Help_Tb.Click; end;
end;
case ScanAddressMode of
1:Set_1_Rb1.Checked:=true;
2:Set_1_Rb2.Checked:=true;
3:Set_1_Rb3.Checked:=true;
4:Set_1_Rb4.Checked:=true;
end;
Options_PageControl.ActivePageIndex:=setActivePage-1;
set_FromEdit.Text:=inttoHex(DefaultFromAddress,8);
set_ToEdit.Text:=inttoHex(DefaultToAddress,8);
Lock_TrackBar.Position:=Lock_Interval div 100;
Main_HotKey.HotKey:=HotKeyToShortCut(MainHotKey_mode,MainHotKey_value);
UnRegisterhotkey(MainForm.handle,hotkeyid_Main);
if not RegisterHotkey(MainForm.handle,hotkeyid_Main,MainHotKey_mode,MainHotKey_value)then
begin
SetOptions_tb.Down:=true;
SetOptions_tb.Click;
Options_PageControl.ActivePageIndex:=0;
showmessage(String_NotSethotkey1);
end;
if CaptureSaveMode=1 then SaveMode1.Checked:=true else
if CaptureSaveMode=2 then SaveMode2.Checked:=true else
if CaptureSaveMode=3 then SaveMode3.Checked:=true;
CaptureSavepath_Edit.Text:=CaptureSavePath;
UnRegisterhotkey(CapturePicForm.handle,hotkeyid_Capture);
if not RegisterHotkey(CapturePicForm.handle,hotkeyid_Capture,CaptureHotKey_mode,CaptureHotKey_value)then
begin
SetOptions_tb.Down:=true;
SetOptions_tb.Click;
Options_PageControl.ActivePageIndex:=1;
showmessage(String_NotSethotkey2);
end;
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
if reg.ReadString('GamePaladin')=application.exename then Set_autoRun.state:=cbchecked else
Set_autoRun.state:=cbUNchecked;
reg.CloseKey;
Reg.Free;
end; ////with end;
Lock_Enable:=true;
TTimerThread.Create;
end;
///////////////任务相关////////////////////////////////////////////////////////////////////////
Procedure TmainForm.AddTasktoList(theIndex:integer);
begin
with Tasks_LV.Items.Add do
begin
Caption:=theTask[theIndex].Name;
// SubItems.Add(intToStr(theTask[theIndex].Index));
// SubItems.Add(intToStr(theTask[theIndex].ProcessID))
end;
end;
Procedure TmainForm.UpdateTaskInfo(theIndex:integer);
begin
if taskNum=0 then
begin
Task_info_Name_LB.Caption:=String_notask;
Task_Info_SearchResult_LB.Caption:=String_noresult;
Found_lv.Clear;
end else
begin
With theTask[theIndex] do
begin
Task_info_Name_LB.Caption:=Name;
Task_Info_SearchResult_LB.Caption:=Format(String_ScanResult,[SearchTimes,AttachedNum]);
end;
end;
end;
////////将搜索到的数值加入列表////////////////////
Procedure TmainForm.AddFoundToListView(theIndex:integer);
var BufSize:Int64;
AddressBuf:Dword;
i,j:Integer;
TempByte:Byte;
TempWord:Word;
TempDword:Dword;
Tempint64:int64;
TempSingle:Single;
TempDouble:Double;
TempStringBYTE:Array[1..16] of BYTE;
Tempstring:string;
begin
Found_LV.Items.BeginUpdate;///防止闪烁
Found_LV.Items.Clear;
with thetask[theIndex] do
begin
AddressmemStream.Seek(0,soFrombeginning); ////低阶搜索BufSize=0;
BufSize:= AddressMemStream.Size;
if (BufSize>0) and ( not thetask[theIndex].InSearchProcess) then
begin
BufSize:=BufSize shr 2;
if BufSize>200 then BufSize:=200; ///只显示前面200个值
For i:=1 to BufSize do
begin
try
AddressMemStream.ReadBuffer(AddressBuf,Sizeof(AddressBuf));
GPKernel.Readmemory(ProcessID,AddressBuf,@TempByte,Byte_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempWord,Word_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempDword,Dword_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempInt64,Int64_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempSingle,Single_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempDouble,Double_value);
GPKernel.Readmemory(ProcessID,AddressBuf,@TempStringBYTE,String_value);
Tempstring:='';
for j:=1 to 16 do
Tempstring:=Tempstring+chr(TempstringBYTE[j]);
with Found_LV.Items.Add do
begin
Caption:=intTohex(AddressBuf,8);
SubItems.Add(intToStr(TempByte));
SubItems.Add(intToStr(TempWord));
SubItems.Add(intToStr(TempDword));
SubItems.Add(intToStr(TempInt64));
SubItems.Add(FloatToStr(TempSingle));
SubItems.Add(FloatToStr(TempDouble));
SubItems.Add(TempString);
end;
except
Continue; //float ofent make error
end;
end;//for end
end; //if end
end;///with end
Found_lv.Items.EndUpdate;
end;
Procedure TMainForm.UpdateLockInfo(theIndex,theListIndex:integer);
var TypeStr:String;
begin
if memLockRecord[theIndex].Applyed then
begin
case memLockRecord[theIndex].VarType of
Byte_value:TypeStr:=String_ByteType;
Word_value:TypeStr:=String_WordType;
Dword_value:TypeStr:=String_DWordType;
Int64_value:TypeStr:=String_Int64Type;
Single_value:TypeStr:=String_SingleType;
Double_value:TypeStr:=String_DoubleType;
String_value:TypeStr:=String_StringType;
else
TypeStr:=String_WordType;
end;
With Lock_LV.Items.item[theListIndex] do
begin
Caption:=memLockRecord[theIndex].Description;
Subitems[0]:=(intToHex(memLockRecord[theIndex].Address,8));
Subitems[1]:=(memLockRecord[theIndex].valueStr);
Subitems[2]:=(TypeStr);
Subitems[3]:=(intToStr(memLockRecord[theIndex].ProcessID));
Subitems[4]:=(String_applying);
if memLockRecord[theIndex].Frozen then Checked:=True else Checked:=False;
end;
end;
end;
procedure TMainForm.Deltask_tbClick(Sender: TObject);
var i,SelListIndex,theIndex:integer;
begin
if tasknum=0 then Exit;
if Tasks_LV.Selected<>nil then
begin
SelListIndex:=Tasks_LV.Selected.Index+1;
theIndex:=ListToTaskIndex[SelListIndex];
if theTask[theindex].InSearchProcess then
begin
MessageBox(Application.Handle,pchar(String_InScan),pchar(String_InScanTitle),
MB_OK or MB_ICONINFORMATION);
exit;
end;
theTask[theindex].Applyed:=False;
theTask[theIndex].AddressMemStream.Clear;
theTask[theIndex].AdvancedAddressMemStream.Clear;
Dec(taskNUm);
for i:=SelListIndex to TaskNum do
begin
ListToTaskIndex[i]:=ListToTaskIndex[i+1];
end;
Tasks_lv.selected.Delete;
DeleteFile(theTask[theIndex].MemoryFileName);
DeleteFile(theTask[theIndex].MemoryFileNameNew);
UpdateTaskInfo(theTask[theIndex].Index);
end;
end;
procedure TMainForm.newtask_TBClick(Sender: TObject);
begin
ProcessListForm.Refresh_BN.Click;
ProcessListForm.Show;
end;
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////任务辅助/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
function Tmainform.CheckForScan:boolean;
begin
Result:=false;
with thetask[CurrentTaskIndex] do begin
case AnalyseScan(CurrentTaskIndex) of
0: begin
Raise Exception.Create(String_Taskinvalid);
end;
1: begin
if MessageBox(Application.Handle,pchar(String_AskRepeatInitLowLevel),
pchar(String_AskRepeatInitLowLevelTitle),
MB_YESNO or MB_ICONINFORMATION)=IDYES then
begin
TotalProcess:=0;
SearchTimes:=0;
AttachedNum:=0;
AdvancedAddressMemStream.Clear;
AddressMemStream.Clear;
Result:=True;
Exit;
end else exit;
end;
2: begin
if MessageBox(Application.Handle,pchar(String_TypeNoMatch),
pchar(String_TypeNoMatchTitle),
MB_YESNO or MB_ICONINFORMATION)=IDYES then
begin
TotalProcess:=0;
SearchTimes:=0;
AttachedNum:=0;
AdvancedAddressMemStream.Clear;
AddressMemStream.Clear;
Result:=True;
exit;
end else Exit;
end;
3: begin
if MessageBox(Application.Handle,pchar(String_NoResultAgain),
pchar(String_NoResultAgainTitle),
MB_YESNO or MB_ICONINFORMATION)=IDYES then
begin
TotalProcess:=0;
SearchTimes:=0;
AttachedNum:=0;
AdvancedAddressMemStream.Clear;
AddressMemStream.Clear;
Result:=True;
Exit;
end else Exit;
end;
4: Result:=True;
end; ///case end
end;///with edn
end;
///////////////////////////////////////////////////////////////////////
procedure TMainForm.Scan_bnClick(Sender: TObject);
begin
if TaskNum=0 then
begin
if MessageBox(Application.Handle,pchar(String_Addtask),pchar(String_Addtasktitle),
MB_YESNO or MB_ICONINFORMATION)=IDYES then
NewTask_TB.Click;
Exit;
end;
with theTask[CurrenttaskIndex] do
begin
if InSearchProcess then