Exemple #1
0
        public void Deactivate()
        {
            //Write original instructions
            Hack.CopyInstructions(mProcess, mAllocatedMemory + (uint)mNewCode.Length, mAddress, mReplacedInstructionSize);

            //Free the allocated memory
            mProcess.FreeMemory(mAllocatedMemory);
        }
Exemple #2
0
        public void Activate()
        {
            //Backup the old code
            mOldCode = mProcess.GetBytes((int)mAddress, mReplacedInstructionSize);

            //Write the new code
            mProcess.WriteBytes((int)mAddress, mNewCode);

            //Write any additional NOPs
            Hack.WriteNOPs(mProcess, mAddress + (uint)mNewCode.Length, mReplacedInstructionSize - mNewCode.Length);
        }
Exemple #3
0
        public void Activate()
        {
            //Allocate the memory required
            mAllocatedMemory = mProcess.AllocateMemory((uint)(mNewCode.Length + mReplacedInstructionSize + Hack.JMPSize));
            if (mAllocatedMemory == 0)
            {
                throw new Exception();
            }

            //Write the new code in the allocated memory
            mProcess.WriteBytes((int)mAllocatedMemory, mNewCode);

            //Copy the old code
            Hack.CopyInstructions(mProcess, mAddress, mAllocatedMemory + (uint)mNewCode.Length, mReplacedInstructionSize);

            //Write jump at the end of the allocated memory
            Hack.WriteJump(mProcess, mAllocatedMemory + (uint)mNewCode.Length + (uint)mReplacedInstructionSize, mAddress + (uint)mReplacedInstructionSize);

            //Write jump address
            Hack.WriteJump(mProcess, mAddress, mAllocatedMemory);

            //Write nops to be clean
            Hack.WriteNOPs(mProcess, mAddress + Hack.JMPSize, mReplacedInstructionSize - Hack.JMPSize);
        }
Exemple #4
0
 public CodeReplacement(uint address, int replacedInstructionSize) :
     this(address, replacedInstructionSize, Hack.GetArrayNOPs(replacedInstructionSize))
 {
 }