Solved C# Trainer Tutorial

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

gnuzim

Jr.Coder
Trump Tier Donator
Dank Tier Donator
Nobleman
Nov 28, 2012
67
1,418
0
Hey someone can give me a little help?
I'm doing a trainer for this game on Steam Torchlight 2...

Everything was ok, until now...

I got all address and offsets to get the hack working but when i restart the game it seems that those base address has changed, but when i do all over again it appears as the same!
It doesn't work until i try to "find what access this address"!
After that the trainer works perfectly!

Any advice?

Thanks
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
C#:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace RakeCSharp
{
    internal class RakeCSMem
    {
        [DllImport("kernel32.dll")]
        private static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processId);

        [DllImport("kernel32.dll", SetLastError = true)]
        private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesRead);

        public static IntPtr FindDMAAddy(IntPtr hProc, IntPtr ptr, int[] offsets)
        {
            var buffer = new byte[IntPtr.Size];
            foreach (int i in offsets)
            {
                ReadProcessMemory(hProc, ptr, buffer, buffer.Length, out var read);

                ptr = (IntPtr.Size == 4)
                ? IntPtr.Add(new IntPtr(BitConverter.ToInt32(buffer, 0)), i)
                : ptr = IntPtr.Add(new IntPtr(BitConverter.ToInt64(buffer, 0)), i);
            }
            return ptr;
        }

        public static IntPtr GetModuleBaseAddress(Process proc, string modName)
        {
            IntPtr addr = IntPtr.Zero;

            foreach (ProcessModule m in proc.Modules)
            {
                if (m.ModuleName == modName)
                {
                        addr = m.BaseAddress;
                        break;
                }
            }
                return addr;
        }

        private static void Main(string[] args)
        {
            Process process;

            process = Process.GetProcessesByName("ac_client")[0];

            var hProc = OpenProcess(0x001F0FFF, false, process.Id);

            var modBase = GetModuleBaseAddress(process, "ac_client.exe");

            var addr = FindDMAAddy(hProc, (IntPtr)0x50f4f4, new int[] { 0x374, 0x14, 0 });

            Console.WriteLine("0x" + addr.ToString("X"));
        }
    }
}





Pointer scanning is not needed to find a pointer to your player class.

There are multiple ways of achieving this.

Here is one:

Search for: "Always Crit" then scroll down a little bit and you will get to the place shown in the picture.



As you can see, I have marked the calls that are responsible for getting a static pointer to your player class :)

Inside the call you will find:



So if we add it all together.

0x28A865C + 0x2C == Player Base
0x28A865C + 0x30 == Pet Base (Does not always work so don't use it)

So, if we take a look at it in the dissect window.



And here is a little gift from me.

Player Base + 0x7D5 = Always Criticals. You need to set it to either 1 or 0 for it to take effect. :)

[HR][/HR]
I am a little bit of a rush. I have to take care of a few things but I think this will help you. :)
 
Last edited:

gnuzim

Jr.Coder
Trump Tier Donator
Dank Tier Donator
Nobleman
Nov 28, 2012
67
1,418
0
Well, i don't think someone could understand me on this!
Anyway, now i used pointer scan, Agent Smith once told me that address like "Torchlight2.exe"+0028F0E0 was easy to solve , "Torchlight2.exe" usually means 00x004000000, adding this to 00x028F0E0 we have 00x4002800 and 5 offsets!
But i can't get that to work :/
 

gnuzim

Jr.Coder
Trump Tier Donator
Dank Tier Donator
Nobleman
Nov 28, 2012
67
1,418
0
It does, but when i close the game and open again seems that addresses has changed, but as soon as i start searching for it again it works!
Usually when i find any address and click in "find what access this address".

I will try to explain with my trainer!

Baseaddress for Health, Mana and Status change is = 0x77b53738!
i've got all offsets, the trainer is working using this address. When i close the game all static address seem to be hidden, i can't write to it anymore, when i start CE and start looking for those values again it appears as the same (0x77b53738) and i can use the trainer again, but if i don't look for it , i can't use the trainer!
I can't edit the pointer after restarting game even with CE.

Unlikely "Torchlight2.exe"+0028F0E0, this address i got using pointer scan, but i can't convert, and make it work!
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods