逐步从exe文件读取数据到内存。 [英] Step by step read data from exe file to memory.
问题描述
大家好。
Hello everyone.
我有exe文件,我想手动映射到内存。
I have exe-file which I want manually map to memory.
我打开一个文件:HANDLE hFile = CreateFileA(" Test.exe",GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
I open a file with: HANDLE hFile = CreateFileA("Test.exe", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
现在我想从exe文件中读取数据内存 一步一步:
Now I want to read data from exe file to memory step by step:
- 使用VirtualAlloc函数分配必要的内存区域
- allocate necessary memory region with VirtualAlloc function
- 使用ReadFile读取文件FILE_HEADER缓冲区(将是来自VirtualAlloc的变量)
- read from file FILE_HEADER using ReadFile to buffer (will be a variable from VirtualAlloc)
- 使用VirtualAlloc函数分配必要的内存区域
- allocate necessary memory region with VirtualAlloc function
- 从文件FILE_SECTIONS读取 使用ReadFile缓冲(将是来自VirtualAlloc的一个变量)
- read from file FILE_SECTIONS using ReadFile to buffer (will be a variable from VirtualAlloc)
据我所知,我应该在代码的某个地方做了一个SectionAlignment,但我不知道怎么做。
As I understand I should somewhere in code made a SectionAlignment, but I don't know how.
请帮忙我用这个简单的代码示例。 谢谢。
Please help me with this simple example of code. Thank you.
推荐答案
谢谢
我我已经阅读了理论,但我对如何在代码中实现它感到困惑。
I already read the theory, but I get confused about how to impletement it in code.
这篇关于逐步从exe文件读取数据到内存。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!