Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool ConnectGame(string gameTitle)
- {
- IntPtr Hwnd = MyApi.FindWindow(null, gameTitle);//pencere isminden hwnd dediğimiz değeri bulduk
- int KoPid;
- MyApi.GetWindowThreadProcessId(Hwnd, out KoPid);//bu hwnd değeri ile pidini aldık kopid e attık
- MyHook.KoHandle = MyApi.OpenProcess(MyApi.ProcessAccessFlags.All, false, KoPid);//tam yetki ile kopid kullanarak oyuna bağlandık.
- //string mailSlot = @"\\.\mailslot\SUSAMURU" + MyHook.StringToHex(MyApi.GetTickCount().ToString());
- //MsHandle = MyApi.CreateMailslot(mailSlot, 0, 50, IntPtr.Zero);
- if (MyHook.KoHandle == IntPtr.Zero) // kontrol edelim.
- {
- System.Windows.Forms.MessageBox.Show("Oyuna Bağlanılamadı.");
- return false;
- }
- //oyunda 2 adet bellek açıcaz biri kodların çalışacağı yer diğeri paketleri yazacağımız yer.
- MyHook.KodAdresi = MyApi.VirtualAllocEx(MyHook.KoHandle, IntPtr.Zero, 1024, MyApi.AllocationType.Commit, MyApi.MemoryProtection.ExecuteReadWrite);
- MyHook.PaketAdresi = MyApi.VirtualAllocEx(MyHook.KoHandle, IntPtr.Zero, 1024, MyApi.AllocationType.Commit, MyApi.MemoryProtection.ReadWrite);
- //MyHook.RecvHook(mailSlot);
- //HookRecvPackets(mailSlot);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement