Exemplo n.º 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);
        }
Exemplo n.º 2
0
        private int CalculatePointer(int iMemoryAddress, int[] iOffsets)
        {
            int num = iOffsets.Length - 1;

            byte[] bBuffer = new byte[4];
            int    num2    = 0;

            if (num == 0)
            {
                num2 = iMemoryAddress;
            }
            for (int i = 0; i <= num; i++)
            {
                IntPtr ptr;
                if (i == num)
                {
                    MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num2, bBuffer, 4, out ptr);
                    return(this.Dec(this.CreateAddress(bBuffer)) + iOffsets[i]);
                }
                if (i == 0)
                {
                    MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptr);
                    num2 = this.Dec(this.CreateAddress(bBuffer)) + iOffsets[0];
                }
                else
                {
                    MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num2, bBuffer, 4, out ptr);
                    num2 = this.Dec(this.CreateAddress(bBuffer)) + iOffsets[i];
                }
            }
            return(0);
        }
Exemplo n.º 3
0
        public byte[] ReadAOB(int iMemoryAddress, uint iBytesToRead)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[iBytesToRead];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, iBytesToRead, out ptr);
            return(bBuffer);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public float ReadFloat(int iMemoryAddress, int[] iOffsets)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[4];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, 4, out ptr);
            return(BitConverter.ToSingle(bBuffer, 0));
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public ushort ReadShort(int iMemoryAddress, int[] iOffsets)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[2];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, 2, out ptr);
            return(BitConverter.ToUInt16(bBuffer, 0));
        }
Exemplo n.º 12
0
        public long ReadLong(int iMemoryAddress, int[] iOffsets)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[8];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, 8, out ptr);
            return(BitConverter.ToInt64(bBuffer, 0));
        }
Exemplo n.º 13
0
        public byte[] ReadAOB(int iMemoryAddress, int[] iOffsets, uint iBytesToRead)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[iBytesToRead];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, iBytesToRead, out ptr);
            return(bBuffer);
        }
Exemplo n.º 14
0
        public byte ReadByte(int iMemoryAddress, int[] iOffsets)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[1];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, 1, out ptr);
            return(bBuffer[0]);
        }
Exemplo n.º 15
0
        public long ReadLong(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[8];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptr) == 0)
            {
                return(0L);
            }
            return(BitConverter.ToInt64(bBuffer, 0));
        }
Exemplo n.º 16
0
        public float ReadFloat(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[4];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptr) == 0)
            {
                return(0f);
            }
            return(BitConverter.ToSingle(bBuffer, 0));
        }
Exemplo n.º 17
0
        public double ReadDouble(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[8];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptr) == 0)
            {
                return(0.0);
            }
            return(BitConverter.ToDouble(bBuffer, 0));
        }
Exemplo n.º 18
0
        public byte ReadByte(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[1];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptr) == 0)
            {
                return(0);
            }
            return(bBuffer[0]);
        }
Exemplo n.º 19
0
        public uint ReadInt(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[4];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptr) == 0)
            {
                return(0);
            }
            return(BitConverter.ToUInt32(bBuffer, 0));
        }
Exemplo n.º 20
0
        public ushort ReadShort(int iMemoryAddress)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[2];
            if (MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 2, out ptr) == 0)
            {
                return(0);
            }
            return(BitConverter.ToUInt16(bBuffer, 0));
        }
Exemplo n.º 21
0
        public bool NOP(int iMemoryAddress, int iLength)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[iLength];
            for (int i = 0; i < iLength; i++)
            {
                bBuffer[i] = 0x90;
            }
            MAPI.WriteProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)iLength, out ptr);
            return(ptr.ToInt32() == iLength);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
0
        public string ReadString(int iMemoryAddress, uint iTextLength, int iMode = 0)
        {
            IntPtr ptr;

            byte[] bBuffer = new byte[iTextLength];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)iMemoryAddress, bBuffer, iTextLength, out ptr);
            if (iMode == 0)
            {
                return(Encoding.UTF8.GetString(bBuffer));
            }
            if (iMode == 1)
            {
                return(BitConverter.ToString(bBuffer).Replace("-", ""));
            }
            return("");
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
0
        public string ReadText(int iMemoryAddress, int[] iOffsets, uint iStringLength, int iMode = 0)
        {
            IntPtr ptr;
            int    num = this.CalculatePointer(iMemoryAddress, iOffsets);

            byte[] bBuffer = new byte[1];
            MAPI.ReadProcessMemory(this.hReadProcess, (IntPtr)num, bBuffer, iStringLength, out ptr);
            if (iMode == 0)
            {
                return(Encoding.UTF8.GetString(bBuffer));
            }
            if (iMode == 1)
            {
                return(BitConverter.ToString(bBuffer).Replace("-", ""));
            }
            return("");
        }