Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. public static bool ConnectGame(string gameTitle)
  2. {
  3. IntPtr Hwnd = MyApi.FindWindow(null, gameTitle);//pencere isminden hwnd dediğimiz değeri bulduk
  4. int KoPid;
  5. MyApi.GetWindowThreadProcessId(Hwnd, out KoPid);//bu hwnd değeri ile pidini aldık kopid e attık
  6. MyHook.KoHandle = MyApi.OpenProcess(MyApi.ProcessAccessFlags.All, false, KoPid);//tam yetki ile kopid kullanarak oyuna bağlandık.
  7. //string mailSlot = @"\\.\mailslot\SUSAMURU" + MyHook.StringToHex(MyApi.GetTickCount().ToString());
  8. //MsHandle = MyApi.CreateMailslot(mailSlot, 0, 50, IntPtr.Zero);
  9. if (MyHook.KoHandle == IntPtr.Zero) // kontrol edelim.
  10. {
  11. System.Windows.Forms.MessageBox.Show("Oyuna Bağlanılamadı.");
  12. return false;
  13. }
  14.  
  15.  
  16.  
  17. //oyunda 2 adet bellek açıcaz biri kodların çalışacağı yer diğeri paketleri yazacağımız yer.
  18. MyHook.KodAdresi = MyApi.VirtualAllocEx(MyHook.KoHandle, IntPtr.Zero, 1024, MyApi.AllocationType.Commit, MyApi.MemoryProtection.ExecuteReadWrite);
  19. MyHook.PaketAdresi = MyApi.VirtualAllocEx(MyHook.KoHandle, IntPtr.Zero, 1024, MyApi.AllocationType.Commit, MyApi.MemoryProtection.ReadWrite);
  20. //MyHook.RecvHook(mailSlot);
  21. //HookRecvPackets(mailSlot);
  22. return true;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement