Exemplo n.º 1
0
        public static void WriteOnMemory(int pointerOffset, uint bytesToWrite)
        {
            try
            {
                int bytesReadOut = 0;

                byte[] memoryRead = mReader.ReadMemory((IntPtr)(Pointer), bytesToWrite, out bytesReadOut);
                var    offset     = BitConverter.ToUInt32(memoryRead, 0);

                if (pointerOffset < 0)
                {
                    offset -= (uint)(Math.Abs(pointerOffset));
                }
                else
                {
                    offset += (uint)pointerOffset;
                }

                mReader.WriteMemory((IntPtr)offset, BitConverter.GetBytes(bytesToWrite), out bytesReadOut);
                if (Settings.Debug)
                {
                    Settings.DebugText += "\n WriteOnMemory: " + bytesReadOut + ", " + offset;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MemoryManager: WriteOnMemory: error " + ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btn_set_Click(object sender, EventArgs e)
        {
            int melee_min = 0;
            int melee_max = 0;
            int magic_min = 0;
            int magic_max = 0;
            int nx        = 0;

            toolz.GetInt(txt_n_min, ref melee_min);
            toolz.GetInt(txt_n_max, ref melee_max);
            toolz.GetInt(txt_s_min, ref magic_min);
            toolz.GetInt(txt_s_max, ref magic_max);
            toolz.GetInt(txt_i_times, ref nx);
            melee_min *= nx;
            melee_max *= nx;
            magic_min *= nx;
            magic_max *= nx;
            byte[] n_min = new byte[2];
            byte[] n_max = new byte[2];
            byte[] s_min = new byte[2];
            byte[] s_max = new byte[2];
            n_min = BitConverter.GetBytes((short)melee_min);
            n_max = BitConverter.GetBytes((short)melee_max);
            s_min = BitConverter.GetBytes((short)magic_min);
            s_max = BitConverter.GetBytes((short)magic_max);
            int pat_len = n_min.Length + n_max.Length + s_min.Length + s_max.Length;

            byte[] pat = new byte[pat_len];

            int x = 0;

            for (int i = 0; i < n_min.Length; i++)
            {
                pat[x] = n_min[i];
                x++;
            }
            for (int i = 0; i < n_max.Length; i++)
            {
                pat[x] = n_max[i];
                x++;
            }
            for (int i = 0; i < s_min.Length; i++)
            {
                pat[x] = s_min[i];
                x++;
            }
            for (int i = 0; i < s_max.Length; i++)
            {
                pat[x] = s_max[i];
                x++;
            }
            foreach (uint ad in item_adds)
            {
                int br = 0;
                khan.WriteMemory((IntPtr)ad, pat, out br);
            }
            this.Close();
        }
Exemplo n.º 3
0
 private void WriteData(uint[] path, dynamic data)
 {
     //InitProcess();
     if (CheckGame())
     {
         IntPtr addr = GetMemoryAddr(game, path);
         mem.WriteMemory(addr, ((data.GetType() == typeof(byte[]))?data:BitConverter.GetBytes(data)), out bytesIn);
     }
     else
     {
         throw new Exception("Game process not assigned.");
     }
 }
Exemplo n.º 4
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            Process process = Process.GetProcessesByName("War3").ToList().FirstOrDefault();

            if (process != null)
            {
                mreader.ReadProcess = process;
                mreader.OpenProcess();

                offset = BitConverter.ToUInt32(mreader.ReadMemory((IntPtr)(ViewAddress + (uint)process.Modules[43].BaseAddress), 4, out bytesOut), 0);
                var offset1 = BitConverter.ToUInt32(mreader.ReadMemory((IntPtr)(offset + ViewOffset1), 4, out bytesOut), 0);
                var offset2 = BitConverter.ToUInt32(mreader.ReadMemory((IntPtr)(offset1 + ViewOffset2), 4, out bytesOut), 0);
                var wtf     = offset2 + ViewOffset3;

                float FViewInput = (float)double.Parse(textBox1.Text);
                mreader.WriteMemory((IntPtr)wtf, BitConverter.GetBytes(FViewInput), out bytesOut);
            }
        }
Exemplo n.º 5
0
 private void btnMaxAmmo_Click(object sender, EventArgs e)
 {
     mReader.WriteMemory((IntPtr)ammooffset, BitConverter.GetBytes(1000), out bytesOut);
 }