C# How to fill memory with NOP's

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Jul 13, 2014

I'm making a C# trainer for AssaultCube.
I already got unlimited health and ammo done but I'm stuck at no recoil.

Well when your in OllyDbg you have to NOP this address 00463781 to 004637A7 this address

Now my question is: How do I NOP this in C# code.

Little source of mz:

if (m.Msg == 0x0312 && m.WParam.ToInt32() == MYACTION_HOTKEY_ID[2])
                    // NO RECOIL

                    myMemory.ReadProcess = myProcess;
                    int pointerAddress = HexToDec(recoilPointer); //00463781
                    //int[] pointerOffset = {0x00};

                    int bytesWritten =5;
                    byte[] nop = { 0x90, 0x90, 0x90, 0x90, 0x90 };
                    for (int i = 0; i < 38; i++) // because 00463781 + 26 = 004637A7  (26 hex = 38 dec)
                        int[] pointerOffset = { (0x00+i) };
                        string writtenAddress = myMemory.PointerWrite((IntPtr)pointerAddress, nop, pointerOffset, out bytesWritten);

Or do you need to make a dll injector?

Thanks in advance
Last edited:


Meme Tier VIP
Aug 19, 2012
for an extern trainer as you wish you dont need an injector.
And why you convert the addy to dec ? Oo
Anyways may it helps you to figure out your solution by reading through the c++ example, may there are any equalities in case of translating it to c# :)

void patchOpcode(uintptr_t addressToWrite, char* valueToWrite, int byteNum)
			unsigned long OldProtection;			
			VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);

			memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
			VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
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