Example #1
0
        public static Boolean ReadMemory(IntPtr hProcess, IntPtr BaseAddress, int bufferSize, ByteViewer bv)
        {
            int read;

            byte[] rbuffer = new byte[bufferSize];
            bool   result  = Win32API.ReadProcessMemory(hProcess, BaseAddress, rbuffer, bufferSize, out read);

            if (result == false)
            {
                MessageBox.Show("메모리 읽기 실패", "MyFunc.ReadMemory() Error");
                return(false);
            }
            bv.SetBytes(rbuffer);
            return(true);
        }
Example #2
0
        public static Boolean ReadMemory(IntPtr hProcess, IntPtr BaseAddress, int bufferSize, out string buffer)
        {
            int read;

            byte[] rbuffer = new byte[bufferSize];
            bool   result  = Win32API.ReadProcessMemory(hProcess, BaseAddress, rbuffer, bufferSize, out read);

            buffer = "";
            if (result == false)
            {
                MessageBox.Show("메모리 읽기 실패", "MyFunc.ReadMemory() Error");
                return(false);
            }
            foreach (byte buf in rbuffer)
            {
                buffer += Convert.ToString(buf, 16).PadLeft(2, '0').ToUpper() + " ";
            }
            return(true);
        }
Example #3
0
        public static bool MemoryScanAOB(IntPtr hProcess, int start, int end, string AOB, ref ArrayList al)
        {
            string[] str    = AOB.Split(' ');
            int      strlen = str.Length;

            byte[] src = new byte[strlen];
            byte[] dst = new byte[strlen];
            int    readn;
            bool   result;

            for (int i = 0; i < strlen; i++)
            {
                src[i] = Convert.ToByte(str[i], 16);
            }

            for (int i = start; i < end; i++)
            {
                result = Win32API.ReadProcessMemory(hProcess, (IntPtr)i, dst, strlen, out readn);
                if (result == false)
                {
                    continue;
                }
                for (int j = 0; j < strlen; j++)
                {
                    if (src[j] == dst[j])
                    {
                        if (j == strlen - 1)
                        {
                            al.Add(i);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(true);
        }