This is hopefully my last post on DLL injection. See here Injecting a DLL into a process on load time with the ability to hook the process' entrypoint from the DLL for my initial goal and a follow up post.
After reading up on QueueUserAPC I implemented it for the use with pydbg (I use pydbg for other parts so it made sense to do this).
The trick of QueueUserAPC is that the function is called before the application's main thread is started. Basically what you have to do is:dbg.load(exe_name)
injectdll_apc(dbg, dll_name)
dbg.run()
You can download the code for injecdll_apc() here: inject_dll_queueuserapc_pydbg.py.
Now I can finally continue working on my actual project!
your comment...