Beispiel #1
0
        public static void WriteMemoryValue(string name, IntPtr baseadress, long value)
        {
            IntPtr hprocess = OpenProcess(0x1F0FFF, false, ECHelper.GetPIDByProcessName(name));

            WriteProcessMemory(hprocess, baseadress, new long [] { value }, 4, IntPtr.Zero);
            CloseHandle(hprocess);
        }
Beispiel #2
0
 public static int ReadMemoryValue(string name, IntPtr baseadress)
 {
     try
     {
         byte[] buffer       = new byte[4];
         IntPtr bufferadress = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
         IntPtr hprocess     = OpenProcess(0x1F0FFF, false, ECHelper.GetPIDByProcessName(name));
         ReadProcessMemory(hprocess, baseadress, bufferadress, 4, IntPtr.Zero);
         CloseHandle(hprocess);
         return(Marshal.ReadInt32(bufferadress));
     }
     catch
     {
         return(0);
     }
 }
Beispiel #3
0
 private void btnGame_Click(object sender, EventArgs e)
 {
     if (ECHelper.GetPIDByProcessName(name) == 0)
     {
         MessageBox.Show("在这之前总要启动游戏吧~~~~");
     }
     else
     {
         btnBlood.Enabled   = true;
         btnBoom.Enabled    = true;
         btnDefence.Enabled = true;
         btnMoney.Enabled   = true;
         btnShoot.Enabled   = true;
         btnGame.Text       = "已启动";
     }
 }