var Form1: TForm1; Inifile:TInifile; FilePath:String;
implementation
{$R *.dfm} {$R Loader.RES} //补丁模块以资源文件的形式保存
procedure TForm1.ExitClick(Sender: TObject); begin Application.Terminate; end;
procedure TForm1.lookClick(Sender: TObject); //浏览按钮 Var i,j:Integer; begin if OpenDialog1.Execute then begin NameTxt.Text:=OpenDialog1.FileName; end; FilePath:=NameTxt.Text; j:=Length(FilePath); for i:=0 to j do if Copy(FilePath,i,1)='\' then begin NameTxt.Text:=Copy(FilePath,i+1,j-i); //获取程序名 end; end;
procedure TForm1.AddClick(Sender: TObject); //填加按钮 var tempItem:TListItem; i,j:Integer; S,S1:String; begin S1:=Data.Text;
if Addr.text='' then begin Addr.SetFocus; end else begin if Data.Text='' then begin Addr.SetFocus; end else begin if Length(Addr.Text)=6 then begin Addr.Text:='00' + Addr.Text; end; j:= Length(Addr.Text); S:= Addr.Text; Addr.Text:=''; for i:=0 to j do begin Addr.Text:=Addr.Text + UpperCase(Copy(S,i+1,1)); end; tempItem:=DataList.Items.Add; tempItem.Caption:='$' + Addr.text;
j:=Length(S1); S:=''; for i:=0 to j do //数据转换成大写 begin S:=S + UpperCase(Copy(Data.Text,i+1,1)); end; S1:=S;
S:=IntToStr(StrToInt('$' + Addr.Text)+1); Addr.Text:=Format('%x',[StrToInt(S)]); if Length(Addr.Text)=6 then begin Addr.Text:='00' + Addr.Text; end; end; end; end;
procedure TForm1.DelClick(Sender: TObject); //删除按钮 var tempItem:TListItem; begin tempItem:=DataList.Selected; if (assigned(tempItem)) or (tempItem<>nil) then begin tempItem.Delete; end; end;
procedure TForm1.DataListDblClick(Sender: TObject); //数据双击事件 begin if DataList.Selected<>nil then begin Addr.Text:=Copy(DataList.Selected.Caption,2,8); Data.Text:=Copy(DataList.Selected.SubItems[0],2,2); DataList.Selected.Delete; end else DataList.SetFocus; end;
procedure TForm1.ModifyClick(Sender: TObject); //修改按钮 var tempItem:TListItem; begin tempItem:=DataList.Items.Add; tempItem.Caption:='$' + Addr.text; tempItem.SubItems.Add('$' + Data.Text); Addr.Clear; Data.Clear; end;
if SaveDialog1.Execute then begin eXeFileName := SaveDialog1.FileName;
if (AppzName = '') or (TitleName = '') then begin NameTxt.SetFocus; end else begin ExtractRes('exefile','myexe',eXeFileName); //释放资源 IniFile:=TIniFile.Create(ExtractFilePath(paramstr(0))+'Config.ini'); //生成配置INI文件
for i:=0 to j do //逐个填加 begin IniFile.WriteString('Data','Address' + IntToStr(i),DataList.Items.Item.Caption); IniFile.WriteString('Data','NewData' + IntToStr(i),DataList.Items.Item.SubItems[0]); end; IniFile.Free; Files:=ExtractFileDir(Application.ExeName)+'\Config.ini'; File1:=TFileStream.Create(SaveDialog1.FileName,fmOpenWrite); File2:=TFilestream.Create(Files,fmOpenRead);
function TForm1.ExtractRes(ResType, Resname,ResNewName: string): boolean; //资源释放函数 var res:TresourceStream; begin try Res:=Tresourcestream.Create(Hinstance,Resname,Pchar(ResType)); try Res.SaveToFile(Resnewname); Result:=True; except Result:=False; end Finally Res.Free; end; end;
procedure TForm1.DataListDragDrop(Sender, Source: TObject; X, Y: Integer); //数据位置交换拖曳事件 var TargetIndex: integer; begin DragItem := DataList.Selected; TargetIndex := DataList.DropTarget.Index; if TargetIndex>DragItem.Index then TargetItem:=DataList.Items.Insert(TargetIndex+1) else TargetItem:=DataList.Items.Insert(TargetIndex); TargetItem.Assign(DragItem); DragItem.Delete; end;
procedure TForm1.DataListDragOver(Sender, Source: TObject; X, Y: Integer; //数据位置交换拖曳事件 State: TDragState; var Accept: Boolean); begin if Source=DataList then accept :=true; end;
procedure TForm1.AboutClick(Sender: TObject); //调用关于窗口 begin Form2.ShowModal; end;
procedure TForm1.ViewClick(Sender: TObject); //查看按钮 var hCurrentWindow: HWnd; szText: array[0..254] of char; begin
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST); while hCurrentWindow <> 0 do begin if GetWindowText(hCurrentWindow, @szText, 255)>0 then mmo1.Lines.Add(StrPas(szText)); hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT); end; end;
procedure TForm1.SaveClick(Sender: TObject); //保存按钮 var i,j,aPos:Integer; AppzName,TitleName,MyInfo,LeftName :string; begin AppzName :=NameTxt.Text; //取目标名 TitleName :=TitileTxt.Text; //取标题,查找窗口 MyInfo:=InfoMemo.Text; //获取个人信息
aPos:=Pos('.',AppzName); LeftName:=Copy(AppzName,1,aPos-1); dlgSave1.FileName:=LeftName + '-' + 'Project.oοО'; if dlgSave1.Execute then begin IniFile:=TIniFile.Create(dlgSave1.FileName);
for i:=0 to j do begin IniFile.WriteString('Data','Address' + IntToStr(i),DataList.Items.Item.Caption); IniFile.WriteString('Data','NewData' + IntToStr(i),DataList.Items.Item.SubItems[0]); end; IniFile.Free;
end; end;
procedure TForm1.OpenClick(Sender: TObject); //打开按钮 var TempItem:TListItem; Inifile:Tinifile; i,j:Integer; begin if dlgOpen1.Execute then begin IniFile:=TIniFile.Create(dlgOpen1.FileName);
for i:=0 to j do begin TempItem:=DataList.Items.Add; //每次添加必须调用一次的 TempItem.Caption:=Inifile.ReadString('Data','Address' + IntToStr(i),''); TempItem.SubItems.Add(Inifile.ReadString('Data','NewData' + IntToStr(i),'')); end; IniFile.Free; end; end;
procedure Tform1.WMDropFiles(var Msg: TWMDropFiles); var CFileName: array[0..MAX_PATH] of Char; aPos,k,l,m,n:Integer; TempItem:TListItem; Inifile:Tinifile; begin try if DragQueryFile(Msg.Drop, 0, CFileName, MAX_PATH) > 0 then begin // CheckFileSave; NameTxt.text:=CFileName; FilePath:=CFileName;
//开始判断是exe还是oοО文件了 aPos:=Pos('.',NameTxt.text); //定位.的位置 if Copy(CFileName,aPos,4)='.exe' then //规定exe begin l:=Length(FilePath); for k:=0 to l do if Copy(FilePath,k,1)='\' then begin NameTxt.Text:=Copy(FilePath,k+1,l-k); Msg.Result := 0; end else begin Msg.Result := 1; end; end else begin if Copy(CFileName,aPos,6)='.oοО' then //规定ini才可以 begin IniFile:=TIniFile.Create(CFileName); FilePath:=Inifile.ReadString('Appz','FilePath',''); NameTxt.Text:=PChar(Inifile.ReadString('Appz','AppzName','')); TitileTxt.text:= Inifile.ReadString('Appz','TitleName',''); InfoMemo.Lines.Add(Inifile.ReadString('Info','MyInfo','')); n:=StrToInt(Inifile.ReadString('Nume','Number','')); for m:=0 to n do begin TempItem:=DataList.Items.Add; //每次添加必须调用一次的 TempItem.Caption:=Inifile.ReadString('Data','Address' + IntToStr(m),''); TempItem.SubItems.Add(Inifile.ReadString('Data','NewData' + IntToStr(m),'')); end; Msg.Result := 0; IniFile.Free; end; end; end; finally DragFinish(Msg.Drop); end; end;
procedure TForm1.GetClick(Sender: TObject); //调用FindWindow单元,捕捉窗体按钮,要用到枚举 var PI:TProcessInformation; SI:TStartUpInfo; MyHandle:THandle; TitleInfo: String; begin if NameTxt.Text='' then begin NameTxt.SetFocus; end else begin ZeroMemory(@SI, SizeOf(SI)); ZeroMemory(@PI, SizeOf(PI)); SI.cb := SizeOf(SI); if CreateProcess(nil,PChar(FilePath), nil, nil, FALSE, 0 ,nil,nil, SI, PI) then begin //注意! WaitForInputIdle(PI.hProcess, INFINITE); MyHandle := FindMainWindow(PI.dwProcessID); if MyHandle > 0 then begin SetLength(TitleInfo, 255); GetWindowText(MyHandle, PChar(TitleInfo), 255); SetLength(TitleInfo, StrLen(PChar(TitleInfo))); TitileTxt.Text:=TitleInfo; end; TerminateProcess(PI.hProcess,0); TerminateProcess(PI.hThread,0); CloseHandle(PI.hProcess); CloseHandle(PI.hThread); end; end; end;
procedure TForm1.CnWaterImage1MouseDown(Sender: TObject; //无标题栏拖曳事件 Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.MacMouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.InfoGroupMouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.GroupBox2MouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.GroupBox1MouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
procedure TForm1.grp1MouseDown(Sender: TObject; Button: TMouseButton; //无标题栏拖曳事件 Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin ReleaseCapture(); SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION, 0); end; end;
end.
//Loader by wynney
program loader;
uses ShellApi,Windows,Inifiles,SysUtils,Messages,Variants,Classes,Graphics, Controls,ExtCtrls,StdCtrls,Dialogs,Forms,Kill in 'Kill.pas';
for Buf1:=0 to 999999 do //多次查找 begin WindowName := FindWindow(nil,WindowTitle); if WindowName = 0 then begin WindowName := FindWindow(nil,WindowTitle); if Buf1 = 999999 then begin ShowMessage('程序异常,请重启!'); Exit; //退出补丁 KillTask(Appz); //杀死目标进程 end; end else begin ThreadId := GetWindowThreadProcessId(WindowName,@ProcessID); HandleWindow := OpenProcess(Process_All_Access,False,ProcessId);
for i:=0 to j do begin Address :=StrToInt(Inifile.ReadString('Data','Address' + IntToStr(i),'')); //读取数据 PokeValue:=StrToInt(Inifile.ReadString('Data','NewData' + IntToStr(i),'')); //读取数据