⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formsettingsunit.pas.svn-base

📁 这是一段游戏修改工具的源代码.ring3功能由dephi开发,驱动是C开发.希望对大家有帮助
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
unit formsettingsunit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,registry, Menus,ComCtrls,cefuncproc,ExtCtrls,tlhelp32,CheckLst
  {$ifndef net}
  ,plugin,newkernelhandler,debugger,hotkeyhandler;
  {$else}
  ,netapis;

  {$endif}

type Tpathspecifier=class(TObject)
  public
    path: string;
end;

type
  TformSettings = class(TForm)
    Button1: TButton;
    defaultbuffer: TPopupMenu;
    Default1: 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;
    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;
    EditBufsize: TEdit;
    Button3: TButton;
    cbProcessWatcher: TCheckBox;
    cbKdebug: TCheckBox;
    btnMoreStealth: TButton;
    cbHandleBreakpoints: TCheckBox;
    btnUnrandomizerconfig: TButton;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    TabSheet7: TTabSheet;
    Button4: TButton;
    Button5: TButton;
    Label22: TLabel;
    clbPlugins: TCheckListBox;
    OpenDialog1: TOpenDialog;
    TabSheet8: TTabSheet;
    Label5: TLabel;
    lamersversion: TLabel;
    cbsimplecopypaste: TCheckBox;
    Label23: TLabel;
    EditAutoAttach: TEdit;
    Label24: TLabel;
    cbAlwaysAutoAttach: TCheckBox;
    cbGlobalDebug: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure checkThreadClick(Sender: TObject);
    procedure EditBufSizeKeyPress(Sender: TObject; var Key: Char);
    procedure Default1Click(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);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(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;

    deletedmodules: tstringlist;

    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;

    dllpath: Tpathspecifier;
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:=1024; end;

  if bufsize=0 then raise exception.create('The scanbuffer size has to be greater than 0');

  {$ifdef net}
  mainform.buffersize:=bufsize*1024;
  {$else}
  buffersize:=bufsize*1024;
  {$endif}

  mainform.UndoScan.visible:={$ifdef net}false{$else}cbshowundo.checked{$endif};
  mainform.advancedbutton.Visible:=cbShowAdvanced.checked;


  //save to the registry
  reg:=Tregistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\Cheat Engine',true) then
    begin
      //write the settings
      reg.WriteBool('Undo',cbshowundo.checked);
      reg.WriteBool('Advanced',cbShowAdvanced.checked);
      reg.WriteBool('SeperateThread',checkThread.checked);
      reg.WriteInteger('ScanThreadpriority',combothreadpriority.itemindex);
      case combothreadpriority.itemindex of
        0: scanpriority:=tpIdle;
        1: scanpriority:=tpLowest;
        2: scanpriority:=tpLower;
        3: scanpriority:=tpLower;
        4: scanpriority:=tpNormal;
        5: scanpriority:=tpHigher;
        6: scanpriority:=tpHighest;
        7: scanpriority:=tpTimeCritical;
      end;


      reg.WriteInteger('Buffersize',bufsize);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -