unit UnitGetkeyDll;<br><br>interface<br><br>uses<br> windows,<br> messages,dialogs,forms,<br> sysutils,UnitConst, AutoPoison, Registry, AutoAttack, AutoCircle, AutoCamera;<br><br> procedure InstallGetkey; stdcall;<br> procedure RemoveGetkey; stdcall;<br><br>implementation<br><br><br>var<br> MemFile: THandle;<br> pShMem: PGetkeyMem;<br> HHCallWndProc,HHGetMsgProc: HHook;<br> num, fTimerID, fTimerID1, ZTimerID, Circle : Cardinal;<br> switch_Auto_poison, switch_Auto_Circle, invincibility, Skill, CameraNum, BusyKey : Integer;<br> MyAutoPoison:Tauto_poison; //自动药水线程<br> MyAutoAttack : TAutoAttack; //自动攻击线程<br> MyAutoCircle : TAuotCircle;<br> MyAutoCamera : TAutoCamera;<br> lSAddress:Cardinal;<br> lEAddress:Cardinal;<br>// My20AutoPoison:Tauto_poison; //魔灵自动药水线程<br><br>function MyHotKey(vKeyCode:Integer):Boolean;<br>begin<br> if GetAsyncKeyState(vKeyCode)<>0 then<br> result := True<br> else<br> result := False<br>end;<br><br>procedure SaveInfo(str: string); stdcall;<br>var<br> f: textfile;<br>begin<br> {保存为文件信息}<br> assignfile(f, FileName);<br> if fileexists(FileName) = false then rewrite(f)<br> else append(f);<br> if strcomp(pchar(str), pchar('#13#10')) = 0 then writeln(f, '')<br> else write(f, str);<br> closefile(f);<br>end;<br><br>//魔的无敌<br>procedure MyTimerTimer1(Sender:TObject);<br>var<br> p : ^Cardinal;<br>begin<br> p:=ptr($453453);<br> p^:= 150;<br>end;<br>//练熟练度<br>procedure MyTimerTimer(Sender:TObject);<br>var<br> p : ^Cardinal;<br>begin<br> p:=ptr($15DDDD8);<br> p^:= 255;<br>end;<br><br>procedure MyTimer(Sender:TObject);<br>var<br> p : ^Cardinal;<br> q : ^Byte;<br>begin<br>//无敌<br> BusyKey := BusyKey + 1;<br> If BusyKey >= 50 Then BusyKey := 40;<br>// if (wParam = vk_F1) then<br> if MyHotKey(vk_F1) then begin<br> If BusyKey >= 30 Then begin<br> case invincibility of<br> 1:begin<br> fTimerID := SetTimer(0, 0, 100, @MyTimerTimer1);<br> invincibility:= 0;<br> end;<br> 0:begin<br> KillTimer(0, fTimerID);<br> invincibility := 1;<br> p:=ptr($70BD70);<br> p^:= 0;<br> end;<br> end;<br> BusyKey := 0;<br> end;<br> end;<br>//刷水<br> if MyHotKey(vk_F4) then begin<br> q:=ptr($345345);<br> if q^=1 then begin<br> if switch_Auto_poison = 0 then begin<br> MyAutoPoison.Terminate;<br> MyAutoAttack.Terminate;<br> switch_Auto_poison:=1;<br> end;<br> q:=ptr($345345);<br> p:=ptr($34534);<br> p^:= num;<br> case q^ of<br> 1:begin<br> p:=ptr($34535);<br> p^:= num;<br> end;<br> 2:begin<br> p:=ptr($5656);<br> p^:= num;<br> end;<br> 3:begin<br> p:=ptr($675675);<br> p^:= num;<br> end;<br> 4:begin<br> p:=ptr($5756);<br> p^:= num;<br> end;<br> end;<br> end;<br> end;<br>//任意装备变鬼回<br> if MyHotKey(vk_F3) then begin<br> p:=ptr($567567);<br> p^:=2;<br> p:=ptr($567567);<br> p^:=1;<br> p:=ptr($567567);<br> p^:=6;<br> end;<br>//任意装备变里回<br> if (GetKeyState(vk_Control) < 0) and MyHotKey(vk_F3) then begin<br> p:=ptr($5675675);<br> p^:=1;<br> p:=ptr($5675675);<br> p^:=1;<br> p:=ptr($567567B);<br> p^:=6;<br> end;<br>//任意装备变菲回<br> if (getkeystate(vk_menu)< 0) and MyHotKey(vk_F3) then begin<br> p:=ptr($567576);<br> p:=ptr($5675A);<br> p^:=1;<br> p:=ptr($567576AB);<br> p^:=6;<br> end;<br>//开店<br> if MyHotKey(vk_F5) then begin<br> p:=ptr($5675670);<br> if(not IsBadWritePtr(p,1)) then<br> p^:=1;<br> end;<br>//自动加水,攻击<br> if MyHotKey(vk_F2) then begin<br> If BusyKey >= 30 Then begin<br> case switch_Auto_poison of<br> 1:begin<br> try<br> MyAutoPoison:=Tauto_poison.Create(3);<br> except<br> MyAutoPoison:=Tauto_poison.Create(4);<br> end;<br> MyAutoAttack := TAutoAttack.Create();<br> switch_Auto_poison:=0;<br> end;<br> 0:begin<br> MyAutoPoison.Terminate;<br> MyAutoAttack.Terminate;<br> switch_Auto_poison:=1;<br> end;<br> end;<br> BusyKey := 0;<br> end;<br> end;<br>//属性优化<br> if MyHotKey(vk_F11) then<br> If BusyKey >= 30 Then begin<br> case Skill of<br> 1:begin<br> fTimerID := SetTimer(0, 0, 100, @MyTimerTimer);<br> Skill:= 0;<br> end;<br> 0:begin<br> KillTimer(0, fTimerID1);<br> Skill := 1;<br> end;<br> end;<br> BusyKey := 0;<br> end;<br><br>//原子弹<br> if MyHotKey(vk_F12) then begin<br> p:=ptr($15DE26A);<br> p^:=6;<br> p:=ptr($15DE26B);<br> p^:=1;<br> p:=ptr($15DE436);<br> p^:=6;<br> p:=ptr($15DE437);<br> p^:=1;<br> p:=ptr($15E42C0); //加攻<br> p^:=3;<br> p:=ptr($15E42C2);<br> p^:=2;<br> p:=ptr($15E42C3);<br> p^:=1;<br> p:=ptr($15E42E4);<br> p^:=1;<br> p:=ptr($15E42FC);<br> p^:=10000;<br> p:=ptr($15E4324);<br> p^:=200;<br> end;<br>//挂机<br> if MyHotKey(vk_F10) then begin<br> If BusyKey >= 30 Then begin<br> case switch_Auto_Circle of<br> 1:begin<br> MyAutoCircle:=TAuotCircle.Create(50,50);<br> switch_Auto_Circle:=0;<br> end;<br> 0:begin<br> MyAutoCircle.Terminate;<br> switch_Auto_Circle:=1;<br> end;<br> end;<br> BusyKey := 0;<br> end;<br> end;<br>//拍照<br> if MyHotKey(VK_MULTIPLY) then begin<br> If BusyKey >= 30 Then begin<br>// SaveInfo(Inttostr(lSAddress));<br>// SaveInfo(Inttostr(lEAddress));<br> MyAutoCamera :=TAutoCamera.Create(CameraNum,lSAddress,lEAddress);<br> CameraNum:=CameraNum+1;<br> BusyKey :=0;<br> end;<br> end;<br>end;<br><br>procedure HookProc1(code: integer; wParam: WPARAM; lParam: LPARAM); stdcall;<br>const _KeyPressMask = $80000000;<br>var<br> p : ^Cardinal;<br> q : ^Byte;<br>begin<br> if (code>=0) and ((lParam and _KeyPressMask) = 0) then begin<br>//原子弹<br> if (wParam = vk_F12) then begin<br> p:=ptr($15DE26A);<br> p^:=6;<br> p:=ptr($15DE26B);<br> p^:=1;<br> p:=ptr($15DE436);<br> p^:=6;<br> p:=ptr($15DE437);<br> p^:=1;<br> p:=ptr($15E42C0); //加攻<br> p^:=3;<br> p:=ptr($15E42C2);<br> p^:=2;<br> p:=ptr($15E42C3);<br> p^:=1;<br> p:=ptr($15E42E4);<br> p^:=1;<br> p:=ptr($15E42FC);<br> p^:=10000;<br> p:=ptr($15E4324);<br> p^:=200;<br> end;<br>//挂机<br> if (wParam = vk_F10) then begin<br> case switch_Auto_Circle of<br> 1:begin<br> MyAutoCircle:=TAuotCircle.Create(30,30);<br> switch_Auto_Circle:=0;<br> end;<br> 0:begin<br> MyAutoCircle.Terminate;<br> switch_Auto_Circle:=1;<br> end;<br> end;<br> end;<br>//拍照<br> if (wParam = VK_MULTIPLY) then begin<br>// SaveInfo(Inttostr(lSAddress));<br>// SaveInfo(Inttostr(lEAddress));<br> MyAutoCamera :=TAutoCamera.Create(CameraNum,lSAddress,lEAddress);<br> CameraNum:=CameraNum+1;<br> end;<br> end;<br>end;<br><br>{<br>// 侦测 Ctrl + Alt + F12 组合键<br> if ((lParam and _KeyPressMask) = 0) //按下时生效<br> and (GetKeyState(vk_Control) < 0)<br> and (getkeystate(vk_menu)< 0) and (wParam = vk_F12) then<br>}<br><br>function GetMsgProc(nCode: integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;<br>begin<br>// pcs := PMSG(lParam);<br> if (nCode >= 0) then begin<br> HookProc1(nCode, wParam, lParam)<br> end;<br> Result := CallNextHookEx(HHGetMsgProc, nCode, wParam, lParam);<br>end;<br><br>procedure Intro;<br>//var<br>// reg:TRegistry;<br>// s:String;<br>begin<br>{ reg:=TRegistry.Create;<br> try<br> reg.RootKey:=HKEY_LOCAL_MACHINE; //指定需要操作的注册表的主键<br> if reg.OpenKey('Software/Triglow Pictures/PristonTale',false) then //如果打开成功则进行以下操作<br> begin<br> s:=reg.ReadString('ServerName'); //从注册表中读取对应字符串的值<br> reg.CloseKey; //关闭注册表<br> version := s;<br> end;<br> finally<br> reg.Free; //释放变量所占内存<br> end;<br>}<br> MemFile := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TGetKeyMem), MemNameGetkey);<br> pShMem := MapViewOfFile(MemFile, FILE_MAP_WRITE or FILE_MAP_READ, 0, 0, 0);<br>end;<br><br>procedure Extro;<br>begin<br> if pShMem<>nil then<br> begin<br> UnmapViewOfFile(pShMem);<br> pShMem:=nil;<br> end;<br> if memfile<>0 then<br> begin<br> CloseHandle(MemFile);<br> MemFile:=0;<br> end;<br> if invincibility =0 then<br> KillTimer(0, fTimerID);<br> if Skill =0 then<br> KillTimer(0, fTimerID1);<br>end;<br><br>procedure RemoveGetkey;<br>begin<br> if HHGetMsgProc <> 0 then UnhookWindowsHookEx(HHGetMsgProc);<br> HHGetMsgProc := 0;<br> if HHCallWndProc <> 0 then UnhookWindowsHookEx(HHCallWndProc);<br> HHCallWndProc := 0;<br>end;<br><br>procedure InstallGetKey; stdcall;<br>var<br> p: PInstallMem;<br> h: THandle;<br>begin<br> pShMem^.Count:=0;<br> pShMem^.LibHandle:=hInstance;<br>// ZTimerID := SetTimer(0, 0, 120, @MyTimer);<br> if HHGetMsgProc = 0 then<br> HHGetMsgProc := SetWindowsHookEx(WH_KEYBOARD, GetMsgProc, hinstance, 0);<br> h:=OpenFileMapping(FILE_MAP_WRITE or FILE_MAP_READ, false, MemNameInstall);<br> if h<>0 then<br> begin<br> p:=MapViewOfFile(h,FILE_MAP_READ,0,0,0);<br> if p<>nil then<br> begin<br> num := p^.num;<br> lSAddress := p^.lSAddress;<br> lEAddress := p^.lEAddress;<br> postmessage(p^.MainFormHandle, wm_user, 1, 1);<br> UnmapViewofFile(p);<br> invincibility := 1;<br> switch_Auto_poison:=1;<br> switch_Auto_Circle :=1;<br> Skill := 1;<br> Circle := 1;<br> CameraNum := 1;<br> end;<br> closeHandle(h);<br> end;<br> pShMem^.ExitIt:=false;<br> while not pShMem^.ExitIt do application.ProcessMessages;<br> ExitThread(0);<br>end;<br><br>initialization<br> Intro;<br>finalization<br> Extro;<br><br>end.<br><br>键盘HOOK