Source Code Small Hook Helper Class

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
Alrighty, So I was smoking some good :kilo: and made a dumb little hook class that can help speedup the process of making and writing to code caves a bit easier.

class Hook
        private IntPtr mSrc;
        private IntPtr mDest;

        private byte[] mData;

        public Hook(IntPtr src, IntPtr dest, byte[] data)
            this.mSrc = src;
            this.mDest = dest;
            mData = data;

        public byte[] CaveData()
            byte[] jmp = BitConverter.GetBytes(mSrc.ToInt32() - mDest.ToInt32() - mData.Length);

            List<byte> buff = new List<byte>();

            foreach (byte b in mData)


            foreach (byte b in jmp)

            return buff.ToArray();

        public byte[] HookJmp()
            List<byte> bytes = new List<byte>();
            byte[] buf = BitConverter.GetBytes(mDest.ToInt32() - mSrc.ToInt32() - 5);

            foreach (byte b in buf)

            return bytes.ToArray();

I also use a patternscan to find code caves programmatically.
This lets me write the hacks in cheat engine, then just copy the bytes into an array and write that to the cave. The Jumps from and to the cave are calculated at run-time so that's something else you don't have to worry about.

It's really simple, nothing crazy but it helps and can be built upon.

The reason I made this is cause I was hacking a game, an old game, making a trainer for a friend and I was pretty sure we had different versions. One of the hacks required a hook and I needed it to work across multiple versions of the game. Came up with this.

Enjoy guise :smile:
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