针对天网防火墙 2.76 1026版本
程序下载地址:
http://forum.wrsky.com/viewthread.php?tid=2929&fpage=1
源代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShellAPI, Buttons, ComCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
SpeedButton1: TSpeedButton;
CheckBox1: TCheckBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ProgressBar1: TProgressBar;
Label7: TLabel;
Edit2: TEdit;
SpeedButton2: TSpeedButton;
OpenDialog1: TOpenDialog;
OpenDialog2: TOpenDialog;
LblMsg: TLabel;
procedure Label4Click(Sender: TObject);
procedure Label5Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
procedure Crack(fname1,fname2:string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetFileSize(FName:string):longint;
var
f:file of byte;
size:longint;
begin
assignfile(f,FName);
reset(f);
size:=filesize(f);
closefile(f);
Result :=size;
end;
procedure TForm1.Crack(fname1,fname2:string);
const
MainPFW:array[0..4] of byte=($90,$90,$90,$90,$90);
PFWLiveUpdate:array[0..10] of byte=($E9,$91,$00,$00,$00,$90,$A0,$14,$60,$41,$00);
var
hFile:THandle;
FHandle:integer;
{ a、主程序PFW.exe破解方法:(用UltraEdit-32查找替换的方法也行)
000028BB<-地址
E838430000<-原代码(UltraEdit-32查找的目标代码)
9090909090<-修改成(UltraEdit-32替换的目标代码)
b、升级程序PFWLiveUpdate.exe破解方法:
00005502<-地址
0F8590000000A014604100<-原代码(UltraEdit-32查找的目标代码)
E99100000090A014604100<-修改成(UltraEdit-32替换的目标代码) }
begin
hFile :=CreateFile(PChar(fname1),GENERIC_READ or GENERIC_WRITE,
0,nil,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hFile=INVALID_HANDLE_VALUE then
begin
Messagebox(Handle, '要修补的主程序文件不存在或访问被拒绝!', '错误', MB_OK + MB_ICONSTOP);
CloseHandle(hFile);
exit;
end;
CloseHandle(hFile);
hFile :=CreateFile(PChar(fname2),GENERIC_READ or GENERIC_WRITE,
0,nil,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hFile=INVALID_HANDLE_VALUE then
begin
Messagebox(Handle, '要修补的升级程序文件不存在或访问被拒绝!', '错误', MB_OK + MB_ICONSTOP);
CloseHandle(hFile);
exit;
end;
CloseHandle(hFile);
if GetFileSize(fname1)<>2788352 then
begin
Messagebox(Handle, '要修补的主程序文件大小不正确,无法进行修补!', '错误', MB_OK + MB_ICONSTOP);
exit;
end;
if GetFileSize(fname2)<>176128 then
begin
Messagebox(Handle, '要修补的升级程序文件大小不正确,无法进行修补!', '错误', MB_OK + MB_ICONSTOP);
exit;
end;
if CheckBox1.Checked then
begin
CopyFile(PChar(fname1),PChar(fname1+'.bak'),false);
CopyFile(PChar(fname2),PChar(fname2+'.bak'),false);
end;
//修补主文件
LblMsg.Visible :=True;
ProgressBar1.Position :=0;
ProgressBar1.Max :=100;
try
LblMsg.Caption :='开始修补主程序文件...';
FHandle :=FileOpen(fname1,fmOpenReadWrite);
if FHandle<>0 then
begin
FileSeek(FHandle,$000028BB, 0);
ProgressBar1.Position :=25;
FileWrite(FHandle,MainPFW[0],sizeof(MainPFW[0])*5);
FileClose(FHandle);
end;
LblMsg.Caption :='主程序文件修补结束...';
ProgressBar1.Position :=50;
//修补升级程序文件
LblMsg.Caption :='开始修补升级程序文件...';
FHandle :=FileOpen(fname2,fmOpenReadWrite);
if FHandle<>0 then
begin
FileSeek(FHandle,$00005502, 0);
ProgressBar1.Position :=75;
FileWrite(FHandle,PFWLiveUpdate[0],sizeof(PFWLiveUpdate[0])*11);
FileClose(FHandle);
end;
LblMsg.Caption :='升级程序文件修补结束...';
ProgressBar1.Position :=100;
LblMsg.Visible :=False;
Messagebox(Handle, '修补结束!', '提示', MB_OK + MB_ICONINFORMATION);
except
Messagebox(Handle, '修补过程出错,操作终止!', '错误', MB_OK + MB_ICONSTOP);
FileClose(FHandle);
ProgressBar1.Position :=100;
LblMsg.Visible :=False;
exit;
end;
end;
procedure TForm1.Label4Click(Sender: TObject);
begin
ShellExecute(Handle, 'open','http://blog.csdn.net/hnxyy/', '', '', SW_SHOWNORMAL);
end;
procedure TForm1.Label5Click(Sender: TObject);
begin
ShellExecute(Handle, 'open','http://forum.wrsky.com', '', '', SW_SHOWNORMAL);
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if (trim(Edit1.Text)='') or (trim(edit2.Text)='') then
begin
Messagebox(Handle, '请选择要修补的文件!', '错误', MB_OK + MB_ICONSTOP);
Exit;
end;
Crack(trim(edit1.Text),trim(edit2.Text));
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
OpenDialog1.Filter :='PFW.exe|PFW.exe';
OpenDialog1.InitialDir :=ExtractFileDir(Application.ExeName);
if OpenDialog1.Execute then edit1.Text :=OpenDialog1.FileName;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
OpenDialog2.Filter :='PFWLiveUpdate.exe|PFWLiveUpdate.exe';
OpenDialog2.InitialDir :=ExtractFileDir(Application.ExeName);
if OpenDialog2.Execute then edit2.Text :=OpenDialog2.FileName;
end;
end.