EnumProcessModulesEx and CreateToolhelp32Snapshot fails - whatever 32bit or 64bit

后端 未结 1 1881
既然无缘
既然无缘 2021-01-26 00:37

Edit:

The answer of this question is here:

https://stackoverflow.com/a/27317947/996540

When you create a project in msvc, the option /DYNAMICBASE is defa

相关标签:
1条回答
  • 2021-01-26 01:10

    I have no idea about the unsuccess of EnumProcessModulesEx and CreateToolhelp32Snapshot, let's leave this question to the expert.

    My goal is to get the load address (base address) of the child process, find the entry point and patch it - the reason to patch the entry point is here: https://opcode0x90.wordpress.com/2011/01/15/injecting-dll-into-process-on-load/

    Since DLL injection is the main purpose of mine, I have to reconsider this question. I would use the "CreateRemoteThread & LoadLibrary Technique" http://www.codeproject.com/Articles/4610/Three-Ways-to-Inject-Your-Code-into-Another-Proces#section_2 to do the DLL injection (In fact ASLR is not the barrier of this technique by the way), Although there are so many limits in DLLMain http://msdn.microsoft.com/en-us/library/windows/desktop/dn633971%28v=vs.85%29.aspx , but do a little works is OK: Find the base address of an exe using GetModuleHandleA(NULL), save the HMODULE returned into shared memory, next, the caller process read shared memory and get the HMODULE. Synchronization mechanism is necessary of course.

    So, the answer is IPC. (not every IPC mechanism is safe in DLLMain by the way)

    0 讨论(0)
提交回复
热议问题