C#:在另一个进程的内存中搜索 byte[] 数组
怎么可能在另一个进程的内存中查找一个byte[]数组,然后得到该byte[]数组所在的地址呢?
我想将一个字节数组写入另一个进程的内存中(WriteProcessMemory())。该调用的参数之一是 uint Address。我想通过在进程中搜索字节数组来获取地址。
例如,我搜索 {0xEB ,0x20,0x68,0x21,0x27,0x65, ??, 0x21,0x64,0xA1}
我们假设该数组仅放置在我想要写入的进程的内存中的一个位置记忆到.
要获取该地址,我必须搜索该字节数组。
可以用C#来完成吗?
编辑: 这适用于本机应用程序,而不是 .NET。 无需否决我的问题,C++ 有一些组件可以执行此操作,我只想在 C# 中执行此操作。
感谢您的理解!
How is it possible to search for a byte[] array in the memory of another process and then get the address at the place where the byte[] array is located?
I want to write a byte array into the memory of another process(WriteProcessMemory()).One of the parameters of that call is uint Address.Well I want to get the address by searching a byte array into the process.
For example I search for {0xEB ,0x20,0x68,0x21,0x27,0x65, ??, 0x21,0x64,0xA1}
We assume that this array is placed only at one place in the memory of the process I'd like to write memory to.
To get that address,I have to search for that byte array.
Is it possible to be done in C#?
EDIT: This is for native applications,NOT .NET. No need to downvote my question,there are components for C++ that do this,I just want to do it in C#.
Thanks for understanding!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
可以用C#来完成吗?
在 C#(或任何其他语言)中一切皆有可能,你只需要找到方法;
此处硬编码:
}
Is it possible to be done in C#?
Everithing is possible in c#(or any other languge), u just need to fiind how;
Hard coding here:
}
我想你可以使用 ReadProcessMemory Windows API称呼。 甚至还有一个预制 P/Invoke 签名,这样您就不需要无需费心手动制作它。 您翻阅流程的内存,搜索您的模式,然后就完成了。
I guess you could use the ReadProcessMemory Windows API call. There's even a premade P/Invoke signature for it so you don't need to bother with manually crafting it. You page through the memory of the process, search through it for your pattern and you're done.
您需要使用这些 API:
pinvoke.net 是一个很棒的工具Windows API 调用的资源。 我为 GTA: Vice City 编写了一个训练器,如果您想查看 代码在sourceforge上。 代码并不漂亮,那是很久以前的事了,我只是把它放在一起,但是有一些帮助器类用于枚举进程的内存区域并搜索某些字节或字符串。
You'll want to use these APIs:
pinvoke.net is a great resource for Windows API calls. I wrote a trainer for GTA: Vice City that uses these calls if you want to check out the code on sourceforge. The code isn't pretty, it was a long time ago and I just threw it together, but there are helper classes for enumerating memory regions for a process and searching for certain bytes or strings.
这可能会帮助您找到正确的方法:
This may help you find the right way:
是的。 但非常难。 对于本机应用程序来说,这很困难,因为没有与您需要使用的进程的非托管视图及其内存映射不匹配的阻抗。
注意事项:
建议:
Yes. But very hard. It is hard from a native application where there is no impedance mismatched with the unmanaged view of processes and their memory maps you will need to use.
Considerations:
Suggestions: