SolvedASCIIEncoding

Posts 1–7 of 7 · Page 1 of 1
ASCIIEncoding
I have one last question to ask about making this trainer update. I have found away to edit the titles and text so that others can see them in game. I can do the title part on my own, But I need some help with Taking what the user types in the masked textbox and filling in the addresses with it. There are a total of 16 addresses all together. Not all have to be filled in, Say the user only types ^2test, It would only need to fill in 6 of the 16 addresses. If someone is willing to join up with me on this part, it would help a lot. Or just a example of how I would go about doing this.
Quote Originally Posted by xxcrusherxx View Post
I have one last question to ask about making this trainer update. I have found away to edit the titles and text so that others can see them in game. I can do the title part on my own, But I need some help with Taking what the user types in the masked textbox and filling in the addresses with it. There are a total of 16 addresses all together. Not all have to be filled in, Say the user only types ^2test, It would only need to fill in 6 of the 16 addresses. If someone is willing to join up with me on this part, it would help a lot. Or just a example of how I would go about doing this.
So like this:
Code:
public class Memory
    {
        string ProcName;
        public Memory(string ProcessName)
        {
            ProcName = ProcessName.Replace(".exe", "");
        }
        #region DLL Imports
        [DllImport("kernel32.dll")]
        private static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, bool bInheritHandle, int dwProcessId);
	[DllImport("kernel32.dll")]
        private static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
        #endregion

#region Stuff
        private IntPtr Open_Memory()
        {
            if (Process.GetProcessesByName(ProcName).Length != 0)
            {
                return OpenProcess(0x1F0FFF, true, Process.GetProcessesByName(ProcName)[0].Id);
            }
            else return (IntPtr)0x0;
        }

        
        public void WriteString(int Address, string Text)
        {
            byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(Open_Memory(), (IntPtr)Address, Buffer, (UInt32)16, out Zero);
        }
        #endregion
    }
What I do is:
I set the amount of bytes to write to: 16
Means it will write 16 bytes.
Code:
WriteProcessMemory(Open_Memory(), (IntPtr)Address, Buffer, (UInt32)16, out Zero);
And if it doesn't contain any value. it will just be '00'ed out.

Used my 4D1 name "faker" class for writestring.
And rest from: http://www.mpgh.net/forum/604-call-d...inters.html#10


Any questions?
Thanks I'll try it when I get home. Last night I was trying to figure it out and I noticed it would fill in the rest own its own. But I was unable to use text just numbers.
Quote Originally Posted by xxcrusherxx View Post
Thanks I'll try it when I get home. Last night I was trying to figure it out and I noticed it would fill in the rest own its own. But I was unable to use text just numbers.
Code:
public void WriteString(int Address, string Text)
        {
            byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(Open_Memory(), (IntPtr)Address, Buffer, (UInt32)16, out Zero);
        }
Here is the code: byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
Quote Originally Posted by Jorndel View Post


Code:
public void WriteString(int Address, string Text)
        {
            byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(Open_Memory(), (IntPtr)Address, Buffer, (UInt32)16, out Zero);
        }
Here is the code: byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
I'm having some issues with this one, I'm about to upgrade to VS 2010 and see if that will solve my my problems. Edit: Well my net is running slow and taking forever to DL VS, I'll start back on this when I get off work tomorrow and let you know if its fixed. Thanks for the help.
Sorry for the late reply was a busy day. Ok I added the code and

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
That took care of my problems for that part, So for the

Code:
return OpenProcess(0x1F0FFF, true, Process.GetProcessesByName(ProcName)[0].Id);
I change it to:

Code:
return OpenProcess(0x1328D54, true, Process.GetProcessesByName(ProcName)[0].Id);
Then to call it with my button I add

Code:
        //Sets player title and text
        private void button1_Click(object sender, EventArgs e)
        {
            Memory TitleText = new Memory(textBox1.Text);
             
        }
Right?
Sorry for the triple post, wont let me edit my last post. I ended up solving the problem.

Code:
 private void CSet_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process[] myprocesses = System.Diagnostics.Process.GetProcessesByName("iw5m");
            if (myprocesses.Length != 0)
            {
                iw5m.ReadProcess = myprocesses[0];
                iw5m.OpenProcess();
                int write;
                byte[] val1 = { 255 };
                byte[] val2 = new ASCIIEncoding().GetBytes(Clantag.Text);
                iw5m.WriteProcessMemory((IntPtr)0x1328B33, val1, out write);
                iw5m.WriteProcessMemory((IntPtr)0x1328D54, val2, out write);           
            }
            else MessageBox.Show("Error: IW5M must be started first!");
        }
Solved
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us