【问题标题】:How can I get another process base adress in Windows using C#?如何使用 C# 在 Windows 中获取另一个进程基地址?
【发布时间】:2019-06-26 01:25:01
【问题描述】:

当我发现one of Asus old drivers 容易受到物理内存读/写的影响时,我正在浏览exploitdb。有一个完整的 PoC 展示了如何从 RAM 中读取数据。问题是我有一个偏移量(比如说 0x31E4),它指示我在程序内存中需要的值的相对位置,但驱动程序正在返回绝对窗口地址的信息。如何在物理内存中获取基本进程地址(最好在 C# 中)?有没有可能?

示例伪代码:

DWORD offset = 0x31E4; // Offset
int size = sizeof(float); // Size of float
float output = Read(ProgramBase + offset, size); // Read function that read absolute value from RAM, for that I need ProgramBase

【问题讨论】:

标签: c# c++ memory driver ram


【解决方案1】:

如果你想找到内存的起始块和结束块,这段代码应该这样做:

  Process p = Process.GetCurrentProcess();
  IntPtr startMemory= p.MainModule.BaseAddress; 
  IntPtr endMemory= IntPtr.Add(startMemory,p.MainModule.ModuleMemorySize);

当然,除了当前进程,你可以获取任何其他进程,例如:

Process.GetProcessById(processId)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-18
    • 2017-02-23
    • 1970-01-01
    • 1970-01-01
    • 2012-11-18
    • 1970-01-01
    • 2023-03-11
    • 2017-09-01
    相关资源
    最近更新 更多