Thread: ASCIIEncoding

Results 1 to 7 of 7
  1. #1
    xxcrusherxx's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    175
    My Mood
    Amused

    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.
    Last edited by MarkHC; 09-25-2012 at 12:39 AM.

  2. #2
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,674
    Reputation
    905
    Thanks
    18,537
    My Mood
    Angelic
    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?

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  3. #3
    xxcrusherxx's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    175
    My Mood
    Amused
    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.

  4. #4
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,674
    Reputation
    905
    Thanks
    18,537
    My Mood
    Angelic
    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);

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  5. The Following User Says Thank You to Jorndel For This Useful Post:

    xxcrusherxx (09-15-2012)

  6. #5
    xxcrusherxx's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    175
    My Mood
    Amused
    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.
    Last edited by xxcrusherxx; 09-15-2012 at 12:03 AM.

  7. #6
    xxcrusherxx's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    175
    My Mood
    Amused
    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?
    Last edited by xxcrusherxx; 09-15-2012 at 08:58 PM.

  8. #7
    xxcrusherxx's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    175
    My Mood
    Amused
    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
    Last edited by xxcrusherxx; 09-18-2012 at 04:29 PM.