{$R *.dfm} procedure TIFEO_Form.ViewIfeo; const VL = 'Debugger'; key_ = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\'; var REG: TRegistry; Strs: TStringList; I: Byte; Path: string; begin REG:= TRegistry . Create; Strs:= TStringList . Create; try with REG do begin RootKey:= HKEY_LOCAL_MACHINE; if OpenKey( key_, False ) then begin GetKeyNames( Strs ); for I := 0 to Strs.Count - 1 do begin CloseKey; if OpenKey( key_ + Strs[I], False ) then begin Path:= ReadString( VL ); if FileExists( Path ) then begin with IFEO_LIST . Items . Add do begin Caption:= Strs[I]; SubItems . Add( Path ); end; end; end; end; end; end; finally REG . Free; Strs . Free; end; end; //---------- function SetOrDel ( AName, APath: string; SW_BOOL: Boolean ): Boolean; const VL = 'Debugger'; key_ = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\'; var REG: TRegistry; begin REG:= TRegistry . Create; try with REG do begin RootKey:= HKEY_LOCAL_MACHINE; if SW_BOOL then begin if CreateKey( key_ + AName ) then begin if OpenKey( key_ + AName, false ) then begin WriteString( VL, APath ); Result:= True; end; end; end else begin if OpenKey( key_, False ) then begin if DeleteKey( AName ) then Result:= True; end; end; end; finally REG . Free; end; end; //---------- procedure TIFEO_Form.Add_LAdd_NameClick(Sender: TObject); VAR Str: string; begin if Open_File . Execute() then begin Str:= ExtractFileName( Open_File . FileName ); AppName . Text:= Str; end; end;
procedure TIFEO_Form.Add_LAdd_PathClick(Sender: TObject); begin if Open_File . Execute() then begin AppPath . Text:= Open_File . FileName end; end;
procedure TIFEO_Form.Del_BtnClick(Sender: TObject); var Item: TListItem; begin Item:= IFEO_LIST . Selected; if SetOrDel( Item . Caption, '', False ) then begin Item . Destroy; MessageDlg('删除完成~!', mtInformation, [mbOK], 0); end; end;
procedure TIFEO_Form.FormShow(Sender: TObject); begin ViewIfeo; end;
procedure TIFEO_Form.IFEO_BtnClick(Sender: TObject); begin if (AppName . Text <> '')and ( FileExists( AppPath . Text ) ) then begin if SetOrDel( AppName . Text, AppPath . Text, True ) then begin with IFEO_LIST . Items . Add do begin Caption:= AppName . Text; SubItems . Add ( AppPath . Text ); end; MessageDlg('劫持成功~!', mtInformation, [mbOK], 0); end; end else MessageDlg('输入要劫持程序 + 替换执行程序路径~!', mtError, [mbOK], 0); end;
procedure TIFEO_Form.RE_BTNClick(Sender: TObject); begin IFEO_LIST . Clear; ViewIfeo; end;