zoukankan      html  css  js  c++  java
  • 一秒扫雷

    可以直接用CE进行雷总数修改,下面是通过C#直接修改雷总数内存地址

     /// PROCESS_ALL_ACCESS -> (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF)
     public const int PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED| (SYNCHRONIZE | 4095));
    
     /// STANDARD_RIGHTS_REQUIRED -> (0x000F0000L)
     public const int STANDARD_RIGHTS_REQUIRED = 983040;
    
     /// SYNCHRONIZE -> (0x00100000L)
     public const int SYNCHRONIZE = 1048576;
    
     /// https://docs.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess
     /// Return Type: HANDLE->void*
     ///dwDesiredAccess: DWORD->unsigned int
     ///bInheritHandle: BOOL->int
     ///dwProcessId: DWORD->unsigned int
     [System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "OpenProcess")]
     public static extern System.IntPtr OpenProcess(uint dwDesiredAccess, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool bInheritHandle, uint dwProcessId);
    
     /// https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-writeprocessmemory
     /// Return Type: BOOL->int
     ///hProcess: HANDLE->void*
     ///lpBaseAddress: LPVOID->void*
     ///lpBuffer: LPCVOID->void*
     ///nSize: SIZE_T->ULONG_PTR->unsigned int
     ///lpNumberOfBytesWritten: SIZE_T*
     [System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "WriteProcessMemory")]
     [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
     public static extern bool WriteProcessMemory(System.IntPtr hProcess, System.IntPtr lpBaseAddress, System.IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesWritten);
    
    private int GetProcessId(string name)
    {
        var process = Process.GetProcesses().ToList().FirstOrDefault(f => f.ProcessName == name);
        return process.Id;
    }
    
     private void button1_Click(object sender, EventArgs e)
     {
         var pid = GetProcessId("MineSweeper");
         var hProcess = NativeApiCall.OpenProcess(NativeApiCall.PROCESS_ALL_ACCESS, false, (uint)pid);
    
         int address = 0x06241858;// 类总数内存地址
     
         byte[] rBytes = new byte[] { 0x00, 0x00, 0x00, 0x00 };
         uint lpNumberOfBytesWrite = 0;
         var lpBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(rBytes, 0);
         NativeApiCall.WriteProcessMemory(hProcess, (IntPtr)address, lpBuffer, 4, ref lpNumberOfBytesWrite);
     }
    

  • 相关阅读:
    java多线程编程核心技术——第七章补漏拾遗
    java多线程编程核心技术——第六章总结
    第六章:单例模式与多线程序言
    java多线程编程核心技术——第五章总结
    第五章——定时器Timer序言
    我的日志app企划书1.0版本
    du -sh
    安装saltstack使用的shell
    Neo4j社区版配置文件
    挂载磁盘
  • 原文地址:https://www.cnblogs.com/zhuanghamiao/p/MineSweeper.html
Copyright © 2011-2022 走看看