WriteProcessMemory() private method

private WriteProcessMemory ( IntPtr hProcess, IntPtr lpBaseAddress, [ bBuffer, uint size, IntPtr &lpNumberOfBytesWritten ) : int
hProcess System.IntPtr
lpBaseAddress System.IntPtr
bBuffer [
size uint
lpNumberOfBytesWritten System.IntPtr
return int
Example #1
0
        public bool Write(int iMemoryAddress, byte[] bBytesToWrite)
        {
            IntPtr ptr;

            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBytesToWrite, (uint)bBytesToWrite.Length, out ptr);
            return(ptr.ToInt32() == bBytesToWrite.Length);
        }
Example #2
0
        public bool Write(int iMemoryAddress, double iDoubleToWrite)
        {
            byte[] bBuffer = BitConverter.GetBytes(iDoubleToWrite); IntPtr ptrBytesWritten;
            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == 8);
        }
Example #3
0
        //Write to Address
        public bool Write(int iMemoryAddress, byte bByteToWrite)
        {
            byte[] bBuffer = { bByteToWrite }; IntPtr ptrBytesWritten;
            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == 1);
        }
Example #4
0
        public bool Write(int iMemoryAddress, float iFloatToWrite)
        {
            IntPtr ptr;

            byte[] bytes = BitConverter.GetBytes(iFloatToWrite);
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bytes, 4, out ptr);
            return(ptr.ToInt32() == 4);
        }
Example #5
0
        public bool Write(int iMemoryAddress, double iDoubleToWrite)
        {
            IntPtr ptr;

            byte[] bytes = BitConverter.GetBytes(iDoubleToWrite);
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bytes, 8, out ptr);
            return(ptr.ToInt32() == 8);
        }
Example #6
0
        public bool Write(int iMemoryAddress, byte bByteToWrite)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[] { bByteToWrite };
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptr);
            return(ptr.ToInt32() == 1);
        }
Example #7
0
        public bool Write(int iMemoryAddress, int[] iOffsets, byte[] bBytesToWrite)
        {
            int    iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
            IntPtr ptrBytesWritten;

            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBytesToWrite, (uint)bBytesToWrite.Length, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == bBytesToWrite.Length);
        }
Example #8
0
        public bool Write(int iMemoryAddress, int[] iOffsets, byte[] bBytesToWrite)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)num, bBytesToWrite, (uint)bBytesToWrite.Length, out ptr);
            return(ptr.ToInt32() == bBytesToWrite.Length);
        }
Example #9
0
        public bool Write(int iMemoryAddress, int[] iOffsets, float iFloatToWrite)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bytes = BitConverter.GetBytes(iFloatToWrite);
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)num, bytes, 4, out ptr);
            return(ptr.ToInt32() == 4);
        }
Example #10
0
        public bool Write(int iMemoryAddress, int[] iOffsets, double iDoubleToWrite)
        {
            int    iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
            IntPtr ptrBytesWritten;

            byte[] bBuffer = BitConverter.GetBytes(iDoubleToWrite);
            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBuffer, 8, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == 8);
        }
Example #11
0
        public bool Write(int iMemoryAddress, int[] iOffsets, byte bByteToWrite)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[] { bByteToWrite };
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, 1, out ptr);
            return(ptr.ToInt32() == 1);
        }
Example #12
0
        //Write to Pointer
        public bool Write(int iMemoryAddress, int[] iOffsets, byte bByteToWrite)
        {
            int    iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
            IntPtr ptrBytesWritten;

            byte[] bBuffer = new byte[1] {
                bByteToWrite
            };
            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBuffer, 1, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == 1);
        }
Example #13
0
        public bool NOP(int iMemoryAddress, int iLength)
        {
            byte[] bBuffer = new byte[iLength]; IntPtr ptrBytesWritten;
            for (int i = 0; i < iLength; i++)
            {
                bBuffer[i] = 0x90;
            }

            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)iLength, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == iLength);
        }
Example #14
0
        public bool NOP(int iMemoryAddress, int[] iOffsets, int iLength)
        {
            int    iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
            IntPtr ptrBytesWritten; byte[] bBytesToWrite = new byte[iLength];

            for (int i = 0; i < iLength; i++)
            {
                bBytesToWrite[i] = 0x90;
            }
            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBytesToWrite, (uint)iLength, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == bBytesToWrite.Length);
        }
Example #15
0
        public bool NOP(int iMemoryAddress, int[] iOffsets, int iLength)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[iLength];
            for (int i = 0; i < iLength; i++)
            {
                bBuffer[i] = 0x90;
            }
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, (uint)iLength, out ptr);
            return(ptr.ToInt32() == bBuffer.Length);
        }
Example #16
0
        public bool Write(int iMemoryAddress, string sStringToWrite, int iMode = 0)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[1];
            if (iMode == 0)
            {
                bBuffer = this.CreateAOBText(sStringToWrite);
            }
            else if (iMode == 1)
            {
                bBuffer = this.ReverseBytes(this.CreateAOBString(sStringToWrite));
            }
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)bBuffer.Length, out ptr);
            return(ptr.ToInt32() == bBuffer.Length);
        }
Example #17
0
        public bool Write(int iMemoryAddress, int[] iOffsets, string sStringToWrite, int iMode = 0)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[1];
            if (iMode == 0)
            {
                bBuffer = this.CreateAOBText(sStringToWrite);
            }
            else if (iMode == 1)
            {
                bBuffer = this.ReverseBytes(this.CreateAOBString(sStringToWrite));
            }
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, (uint)sStringToWrite.Length, out ptr);
            return(ptr.ToInt32() == sStringToWrite.Length);
        }
Example #18
0
        public bool Write(int iMemoryAddress, string sStringToWrite, int iMode = 0)
        {
            byte[] bBuffer = { 0 }; IntPtr ptrBytesWritten;

            if (iMode == 0)
            {
                bBuffer = CreateAOBText(sStringToWrite);
            }
            else if (iMode == 1)
            {
                bBuffer = ReverseBytes(CreateAOBString(sStringToWrite));
            }

            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)bBuffer.Length, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == bBuffer.Length);
        }
Example #19
0
        public bool Write(int iMemoryAddress, int[] iOffsets, string sStringToWrite, int iMode = 0)
        {
            int    iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
            IntPtr ptrBytesWritten; byte[] bBuffer = { 0 };

            if (iMode == 0)
            {
                bBuffer = CreateAOBText(sStringToWrite);
            }
            else if (iMode == 1)
            {
                bBuffer = ReverseBytes(CreateAOBString(sStringToWrite));
            }

            MAPI.WriteProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBuffer, (uint)sStringToWrite.Length, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == sStringToWrite.Length);
        }