资源简介

C#游戏辅助helper类[内存多级指针读写 进程操作]

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
//QQ 844125365 青椒科技内存帮助类  C# 千人QQ 群:137 696 483 
namespace 主
{
    public abstract class Helper
    {
        [DllImportAttribute(“kernel32.dll“ EntryPoint = “ReadProcessMemory“)]
        public static extern bool ReadProcessMemory
            (
                IntPtr hProcess
                IntPtr lpbaseAddress
                int[] data
                int nSize
                IntPtr lpNumberOfBytesRead
            );

        [DllImportAttribute(“kernel32.dll“ EntryPoint = “ReadProcessMemory“)]
        public static extern bool ReadProcessMemory
            (
                IntPtr hProcess
                IntPtr lpbaseAddress
                byte[] data
                int nSize
                IntPtr lpNumberOfBytesRead
            );

        [DllImportAttribute(“kernel32.dll“ EntryPoint = “OpenProcess“)]
        public static extern IntPtr OpenProcess
            (
                int dwDesiredAccess
                bool bInheritHandle
                int dwProcessId
            );

        [DllImport(“kernel32.dll“)]
        private static extern void CloseHandle
            (
                IntPtr hobject
            );

        //写内存
        [DllImportAttribute(“kernel32.dll“ EntryPoint = “WriteProcessMemory“)]
        public static extern bool WriteProcessMemory
            (
                IntPtr hProcess
                IntPtr lpbaseAddress
                int[] lpBuffer
                int nSize
                IntPtr lpNumberOfBytesWritten
            );




        [DllImport(“USER32.DLL“)]
        public static extern bool SetForegroundWindow(IntPtr hWnd);

        //获取窗体的进程标识ID
        public static int GetPid(string windowtitle)
        {
            int rs = 0;
            Process[] arrayProcess = Process.GetProcesses();
            foreach (Process p in arrayProcess)
            {
                if (p.MainWindowtitle.IndexOf(windowtitle) != -1)
                {
                    rs = p.Id;
                    break;
                }
            }

            return rs;
        }

        //根据进程名获取PID
        public static int GetPidByProcessName(string processName)
        {
            Process[] arrayProcess = Process.GetProcessesByName(processName);

            foreach (Process p in arrayProcess)
            {
                return p.Id;
            }
            return 0;
        }

        //根据进程名获取句柄
        public static IntPtr FindWindow(string processName)
        {
            Process[] arrayProcess = Process.GetProcessesByName(processName);

            foreach (Process p in arrayProcess)
            {
                return p.MainWindowHandle;
            }
            return IntPtr.Zero;
        }

        //根据进程名获取进程对象
        public static Process GetTa

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       16393  2015-06-12 22:15  ProcessMemoryReader.cs
     文件        6678  2015-06-12 22:18  Helper.cs

评论

共有 条评论