Delphi 反外挂,反破解思想代码


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,TlHelp32, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function FindProcess(AFileName:string):boolean;
var
hSnapshot:THandle;
lppe:TProcessEntry32;
Found:Boolean;
begin
Result:=False;
hSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
lppe.dwSize:=SizeOf(TProcessEntry32);
Found:=Process32First(hSnapshot,lppe);
while Found do
    begin
      if((UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AFileName))   or   (UpperCase(lppe.szExeFile   )=UpperCase(AFileName))) then
        begin
        Result:=True;
        end;
      Found:=Process32Next(hSnapshot,lppe);
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
TITLES:tstringlist;
EXES:tstringlist;
DLLS:tstringlist;
  Hwnd:THandle;
  Buf: array[0..MAX_PATH] of char;
begin
TITLES:=tstringlist.Create;
TITLES.Add('窗口标题');

EXES:=tstringlist.Create;
EXES.Add('123.exe');

DLLS:=tstringlist.Create;
DLLS.Add('123.dll');

  //更具DLL判断外挂
  for I := 0 to DLLS.Count - 1 do
  begin
    if (LoadLibrary(PChar(DLLS.Strings[i]))>0) then
    begin
      WinExec('cmd.exe /c echo 发现非法外挂.错误代码:101! & pause',SW_SHOW);
      ExitProcess(0);
    end;
  end;



  //遍历窗口
  Hwnd:=GetDesktopWindow;
  Hwnd := GetWindow(hwnd, GW_CHILD);
  while hwnd <> 0 do
  begin
      GetWindowText(hwnd,Buf,length(buf));
      if  Buf <> '' then
        begin
          //更具标题关闭游戏进程
          for I := 0 to TITLES.Count - 1 do
          begin
            if (pos(TITLES.Strings[i],Buf) >0) then
            begin
              WinExec('cmd.exe /c echo 发现非法外挂.错误代码:102! & pause',SW_SHOW);
              ExitProcess(0);
            end;
          end;
        end;
        Hwnd := GetWindow(hwnd, GW_HWNDNEXT);
  end;



  //更具进程名杀进程
    for I := 0 to EXES.Count - 1 do
  begin
    if FindProcess(EXES.Strings[i]) then
    begin
      WinExec('cmd.exe /c echo 发现非法外挂.错误代码:103! & pause',SW_SHOW);
      ExitProcess(0);
    end;
  end;


end;

end.

相关阅读 >>

Delphi sql server 主从表例子

Delphi webbrowser控件实现对ie浏览器的各种控制

Delphi 进程隐藏的若干方法

Delphi 2010 复制整个文件夹(当然包括嵌套文件夹)

Delphi webservices传文件

使用串口模拟工具进行串口程序开发调试

Delphi 获取本地网络连接

Delphi memo 字符串换行

delhi 获取进程图片

Delphi idhttp.post超时导致整个线程停止问题解决

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...