Exemplo n.º 1
0
        //////////////////////////////////////////////////
        // This is for use to replace textures in running game process
        // I just used this to test without having to restart game each time ;P
        private void buttonScan_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            DebugTools.SetDebugPrivilege();

            byte[] buffer = new byte[(_fileSize - 0x104)];
            Buffer.BlockCopy(_fileBytes, 0x104, buffer, 0, _fileSize - 0x104);

            string mask = new string('x', buffer.Length);

            Process[] procs = Process.GetProcessesByName("GettingUp");

            if (procs.Length <= 0 || procs[0].HasExited)
            {
                MessageBox.Show("Failed to find game, is it even running?!");
                return;
            }

            Text = "[" + procs[0].Id + "] (" + procs[0].Handle.ToString("X8") + ") " + procs[0].ProcessName;

            // 0F9D2C80
            // 1D6B9850
            // 1F860DC0
            DebugTools.MEMORY_BASIC_INFORMATION mbi = new DebugTools.MEMORY_BASIC_INFORMATION();
            uint base_addr = 0x19050000;// 0x0F000000;
            uint addr = base_addr;
            uint readable = (0x20 | 0x40 | 0x80 | 0x02 | 0x04 | 0x08);

            while (addr < 0x1A000000)
            {
                if (DebugTools.VirtualQuery(ref base_addr, ref mbi, 0x10000000) == 0)
                {
                    MessageBox.Show("VirtualQuery failed!");
                    return;
                }

                addr += (uint)mbi.RegionSize;

                if (mbi.State == 0x1000) // MEM_COMMIT
                {
                    // textBox2.Text += "addr " + addr.ToString("X8") + Environment.NewLine;

                    SigScan scan = new SigScan(procs[0], new IntPtr(addr), (int)mbi.RegionSize);//0x0D000000);
                    IntPtr address = scan.FindPattern(buffer, mask, (int)addr);

                    if (address == IntPtr.Zero)
                    {
                        // textBox2.Text += "Not found" + Environment.NewLine;
                    }
                    else
                    {
                        textBox2.Text += address.ToString("X8") + Environment.NewLine;
                    }
                }

                /*
                textBox2.Text += "mbi.AllocationBase " + mbi.AllocationBase.ToUInt32().ToString("X8") + Environment.NewLine;
                textBox2.Text += "mbi.BaseAddress " + mbi.BaseAddress.ToUInt32().ToString("X8") + Environment.NewLine;

                switch (mbi.AllocationProtect)
                {
                    case 0x01:
                        textBox2.Text += "mbi.AllocationProtect PAGE_NOACCESS" + Environment.NewLine;
                        break;
                    case 0x02:
                        textBox2.Text += "mbi.AllocationProtect PAGE_READONLY" + Environment.NewLine;
                        break;
                    case 0x03:
                        textBox2.Text += "mbi.AllocationProtect PAGE_READWRITE" + Environment.NewLine;
                        break;
                    case 0x04:
                        textBox2.Text += "mbi.AllocationProtect PAGE_WRITECOPY" + Environment.NewLine;
                        break;
                    default:
                        textBox2.Text += "mbi.AllocationProtect " + mbi.AllocationProtect + Environment.NewLine;
                        break;
                }

                textBox2.Text += "mbi.Protect " + mbi.Protect + Environment.NewLine;
                textBox2.Text += "mbi.RegionSize " + mbi.RegionSize + Environment.NewLine;
                */
            }
        }
Exemplo n.º 2
0
        //////////////////////////////////////////////////
        // This is for use to replace textures in running game process
        // I just used this to test without having to restart game each time ;P
        private void buttonScan_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            DebugTools.SetDebugPrivilege();

            byte[] buffer = new byte[(_fileSize - 0x104)];
            Buffer.BlockCopy(_fileBytes, 0x104, buffer, 0, _fileSize - 0x104);

            string mask = new string('x', buffer.Length);

            Process[] procs = Process.GetProcessesByName("GettingUp");

            if (procs.Length <= 0 || procs[0].HasExited)
            {
                MessageBox.Show("Failed to find game, is it even running?!");
                return;
            }

            Text = "[" + procs[0].Id + "] (" + procs[0].Handle.ToString("X8") + ") " + procs[0].ProcessName;

            // 0F9D2C80
            // 1D6B9850
            // 1F860DC0
            DebugTools.MEMORY_BASIC_INFORMATION mbi = new DebugTools.MEMORY_BASIC_INFORMATION();
            uint base_addr = 0x19050000;// 0x0F000000;
            uint addr      = base_addr;
            uint readable  = (0x20 | 0x40 | 0x80 | 0x02 | 0x04 | 0x08);

            while (addr < 0x1A000000)
            {
                if (DebugTools.VirtualQuery(ref base_addr, ref mbi, 0x10000000) == 0)
                {
                    MessageBox.Show("VirtualQuery failed!");
                    return;
                }

                addr += (uint)mbi.RegionSize;

                if (mbi.State == 0x1000) // MEM_COMMIT
                {
                    // textBox2.Text += "addr " + addr.ToString("X8") + Environment.NewLine;

                    SigScan scan    = new SigScan(procs[0], new IntPtr(addr), (int)mbi.RegionSize);//0x0D000000);
                    IntPtr  address = scan.FindPattern(buffer, mask, (int)addr);

                    if (address == IntPtr.Zero)
                    {
                        // textBox2.Text += "Not found" + Environment.NewLine;
                    }
                    else
                    {
                        textBox2.Text += address.ToString("X8") + Environment.NewLine;
                    }
                }

                /*
                 * textBox2.Text += "mbi.AllocationBase " + mbi.AllocationBase.ToUInt32().ToString("X8") + Environment.NewLine;
                 * textBox2.Text += "mbi.BaseAddress " + mbi.BaseAddress.ToUInt32().ToString("X8") + Environment.NewLine;
                 *
                 * switch (mbi.AllocationProtect)
                 * {
                 *  case 0x01:
                 *      textBox2.Text += "mbi.AllocationProtect PAGE_NOACCESS" + Environment.NewLine;
                 *      break;
                 *  case 0x02:
                 *      textBox2.Text += "mbi.AllocationProtect PAGE_READONLY" + Environment.NewLine;
                 *      break;
                 *  case 0x03:
                 *      textBox2.Text += "mbi.AllocationProtect PAGE_READWRITE" + Environment.NewLine;
                 *      break;
                 *  case 0x04:
                 *      textBox2.Text += "mbi.AllocationProtect PAGE_WRITECOPY" + Environment.NewLine;
                 *      break;
                 *  default:
                 *      textBox2.Text += "mbi.AllocationProtect " + mbi.AllocationProtect + Environment.NewLine;
                 *      break;
                 * }
                 *
                 * textBox2.Text += "mbi.Protect " + mbi.Protect + Environment.NewLine;
                 * textBox2.Text += "mbi.RegionSize " + mbi.RegionSize + Environment.NewLine;
                 */
            }
        }