📄 formsettingsunit.pas
字号:
unit formsettingsunit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,registry, Menus,ComCtrls,cefuncproc,ExtCtrls,tlhelp32
{$ifndef net}
,newkernelhandler,debugger,hotkeyhandler;
{$else}
,netapis;
{$endif}
type
TformSettings = class(TForm)
Button1: TButton;
defaultbuffer: TPopupMenu;
defaultmax: TPopupMenu;
Default1: TMenuItem;
Default2: TMenuItem;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
cbGH: TCheckBox;
cbCT3: TCheckBox;
cbCT2: TCheckBox;
cbCET: TCheckBox;
cbCT: TCheckBox;
cbShowUndo: TCheckBox;
cbShowAdvanced: TCheckBox;
TabSheet4: TTabSheet;
Label4: TLabel;
rbDebugRegisters: TRadioButton;
rdWriteExceptions: TRadioButton;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
cbCenterOnPopup: TCheckBox;
EditUpdateInterval: TEdit;
EditFreezeInterval: TEdit;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
GroupBox1: TGroupBox;
cbShowAsSigned: TCheckBox;
cbBinariesAsDecimal: TCheckBox;
TabSheet5: TTabSheet;
cbShowDisassembler: TCheckBox;
cbShowDebugoptions: TCheckBox;
replacewithnops: TCheckBox;
askforreplacewithnops: TCheckBox;
Label16: TLabel;
EditNetworkUpdateInterval: TEdit;
Label17: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
rbDebugAsBreakpoint: TRadioButton;
rbInt3AsBreakpoint: TRadioButton;
cbUpdatefoundList: TCheckBox;
Label18: TLabel;
editUpdatefoundInterval: TEdit;
Label19: TLabel;
Label20: TLabel;
cbBreakOnAttach: TCheckBox;
cbHideAllWindows: TCheckBox;
btnExcludeProcesses: TButton;
TabSheet2: TTabSheet;
Label2: TLabel;
Label3: TLabel;
Label1: TLabel;
Label5: TLabel;
Label15: TLabel;
Label21: TLabel;
checkThread: TCheckBox;
combothreadpriority: TComboBox;
cbFastscan: TCheckBox;
cbSkip_PAGE_NOCACHE: TCheckBox;
cbLowMemoryUsage: TCheckBox;
cbMemImage: TCheckBox;
cbMemMapped: TCheckBox;
cbMemPrivate: TCheckBox;
cbEnableHyperscanWhenPossible: TCheckBox;
TabSheet6: TTabSheet;
GroupBox3: TGroupBox;
cbKernelQueryMemoryRegion: TCheckBox;
cbKernelReadWriteProcessMemory: TCheckBox;
cbKernelOpenProcess: TCheckBox;
TauntOldOsUser: TLabel;
Button2: TButton;
Panel1: TPanel;
Label25: TLabel;
cbStealth: TCheckBox;
cbProtectMe: TCheckBox;
cbUndoMemoryChanges: TCheckBox;
cbForceUndo: TCheckBox;
EditMax: TEdit;
EditBufsize: TEdit;
Button3: TButton;
cbProcessWatcher: TCheckBox;
cbKdebug: TCheckBox;
btnMoreStealth: TButton;
cbHandleBreakpoints: TCheckBox;
btnUnrandomizerconfig: TButton;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
procedure Button1Click(Sender: TObject);
procedure checkThreadClick(Sender: TObject);
procedure EditMaxKeyPress(Sender: TObject; var Key: Char);
procedure EditBufSizeKeyPress(Sender: TObject; var Key: Char);
procedure Default1Click(Sender: TObject);
procedure Default2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cbShowDisassemblerClick(Sender: TObject);
procedure replacewithnopsClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure cbUpdatefoundListClick(Sender: TObject);
procedure Label20Click(Sender: TObject);
procedure cbHideAllWindowsClick(Sender: TObject);
procedure btnExcludeProcessesClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbKernelQueryMemoryRegionClick(Sender: TObject);
procedure cbUndoMemoryChangesClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button3Click(Sender: TObject);
procedure cbProtectMeClick(Sender: TObject);
procedure cbKdebugClick(Sender: TObject);
procedure cbProcessWatcherClick(Sender: TObject);
procedure btnMoreStealthClick(Sender: TObject);
procedure btnUnrandomizerconfigClick(Sender: TObject);
private
{ Private declarations }
tempstatePopupHide:word;
temppopupmodifier:dword;
tempstatePause:word;
tempPausemodifier:dword;
tempstateSpeedhack:word;
tempSpeedhackmodifier:dword;
systemcallretrieverexecuted:boolean;
systemcallretrieverhandle: thandle;
tempmodulelist: pchar;
tempmodulelistsize: integer;
tempdenylist: boolean;
tempdenylistglobal: boolean;
procedure SetAssociations;
procedure startsystemcallretrieverifneeded; overload;
procedure startsystemcallretrieverifneeded(why:string); overload;
public
{ Public declarations }
tempdonthidelist: array of string;
temphideall: boolean;
laststatePopupHide:word;
lastpopupmodifier:dword;
laststatePause:word;
lastPausemodifier:dword;
laststateSpeedhack:word;
lastSpeedhackmodifier:dword;
Loadingsettingsfromregistry: boolean;
clickedok:boolean;
unrandomizersettings: record
defaultreturn: integer;
incremental: boolean;
end;
end;
var
formSettings: TformSettings;
{$ifdef net}
IsDebuggerPresentLocation: integer=0;
{$endif}
implementation
uses
aboutunit,
{$ifdef net}
Unit2;
{$else}
MainUnit,
Mainunit2,
frmhotkeyconfigunit,
frmExcludeHideUnit,
MemoryBrowserFormUnit,
ModuleSafetyUnit,
frmProcessWatcherUnit,
ConfigUnrandomizerFrm;
{$endif}
{$R *.DFM}
procedure decimal(var key: char);
begin
case key of
chr(8) : ;
chr(16) : ;
'0'..'9' : ;
else key:=chr(0);
end;
end;
procedure TFormSettings.SetAssociations;
procedure Associate(ext: string);
var reg: TRegistry;
preCE: string;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
reg.LazyWrite := false;
reg.OpenKey(ext+'\shell\open\command',true);
preCE:=reg.ReadString('preCE');
if preCE='' then //no preCE item yet
preCE:=reg.ReadString('');
reg.writestring('preCE',preCE);
reg.WriteString('',application.ExeName+' "%1"');
reg.CloseKey;
reg.OpenKey(ext+'\DefaultIcon', true);
preCE:=reg.ReadString('preCE');
if preCE='' then //no preCE item yet
preCE:=reg.ReadString('');
reg.writestring('preCE',preCE);
reg.WriteString('',application.ExeName+',0');
reg.CloseKey;
reg.free;
end;
procedure UnAssociate(ext: string);
var reg: TRegistry;
delete: boolean;
preCE:string;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
reg.LazyWrite := false;
delete:=false;
try
reg.OpenKey(ext+'\shell\open\command',false);
preCE:=reg.ReadString('preCE');
if preCE='' then delete:=true else
begin
reg.writestring('',preCE);
reg.DeleteValue('preCE');
end;
reg.CloseKey;
except
delete:=true;
end;
try
reg.OpenKey(ext+'\DefaultIcon', false);
preCE:=reg.ReadString('preCE');
if preCE='' then delete:=true else
begin
reg.writestring('',preCE);
reg.DeleteValue('preCE');
end;
reg.closekey;
except
delete:=true;
end;
reg.DeleteKey(ext);
reg.free;
end;
begin
if cbCT.checked then Associate('.CT') else unassociate('.CT');
if cbCT2.checked then Associate('.CT2') else unassociate('.CT2');
if cbCT3.checked then Associate('.CT3') else unassociate('.CT3');
if cbCET.checked then Associate('.CET') else unassociate('.CET');
if cbGH.checked then Associate('.GH') else unassociate('.GH');
end;
procedure TformSettings.Button1Click(Sender: TObject);
resourcestring
strProcessWatcherWillPreventUnloader='Enabling the process watcher will prevent the unloader from working';
var processhandle2: Thandle;
reg: TRegistry;
bufsize: integer;
newmax: integer;
i,j,error: integer;
ec:dword;
found:boolean;
networkupdateinterval,updateinterval,freezeinterval,FoundInterval: integer;
begin
{$ifndef net}
if cbProcessWatcher.checked and (frmprocesswatcher=nil) then
begin
if messagedlg(strProcessWatcherWillPreventUnloader,mtwarning,[mbok,mbcancel],0)=mrcancel then
exit
else
begin
loaddbk32;
frmprocesswatcher:=tfrmprocesswatcher.Create(mainform); //start the process watcher
end;
end;
if systemcallretrieverexecuted then
begin
if GetExitCodeProcess(systemcallretrieverhandle,ec) then
begin
if ec=STILL_ACTIVE then
if messagedlg('It''s best to wait till the systemcall retriever is done. Continue anyhow?',mtconfirmation,[mbyes,mbno],0)=mrno then exit;
closehandle(systemcallretrieverhandle);
systemcallretrieverexecuted:=false;
end;
end;
{$endif}
if not ((cbMemPrivate.checked) or (cbMemImage.Checked) or (cbMemMapped.Checked)) then
if messagedlg('You haven''t selected any memory type. This will result in Cheat Engine finding NO memory! Are you stupid?',mtWarning,[mbyes,mbno],0)<>mryes then exit;
val(editUpdatefoundInterval.Text,foundinterval,error);
if (error<>0) or (foundinterval<=0) then raise exception.Create(editUpdatefoundInterval.Text+' is not a valid interval');
val(editupdateinterval.text,updateinterval,error);
if (error<>0) or (updateinterval<=0) then raise exception.Create(editupdateinterval.text+' is not a valid interval');
val(editnetworkupdateinterval.text,networkupdateinterval,error);
if (error<>0) or (networkupdateinterval<=0) then raise exception.Create(editnetworkupdateinterval.text+' is not a valid interval');
val(editfreezeinterval.text,freezeinterval,error);
if (error<>0) or (updateinterval<=0) then raise exception.Create(editfreezeinterval.text+' is not a valid interval');
try bufsize:=StrToInt(editbufsize.text); except bufsize:=512; end;
val(editmax.text,newmax,error);
if error<>0 then raise exception.Create(editmax.text+' is not a valid value');
if bufsize=0 then raise exception.create(editbufsize.text+' has to be greather than 0');
{$ifdef net}
mainform.buffersize:=bufsize*1024;
{$else}
buffersize:=bufsize*1024;
{$endif}
mainform.max:=newmax;
mainform.UndoScan.visible:={$ifdef net}false{$else}cbshowundo.checked{$endif};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -