Hello everyone.
I have exe-file which I want manually map to memory.
I open a file with: HANDLE hFile = CreateFileA("Test.exe", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Now I want to read data from exe file to memory step by step:
- allocate necessary memory region with VirtualAlloc function
- read from file FILE_HEADER using ReadFile to buffer (will be a variable from VirtualAlloc)
- allocate necessary memory region with VirtualAlloc function
- read from file FILE_SECTIONS using ReadFile to buffer (will be a variable from VirtualAlloc)
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.