I'm trying to inject a DLL to a new process using the latests 32 bit Detours library.
It worked for me in the past but after a change in the DLL, it stopped working for all processes. When I resume the process I get a message box saying
The application was unable to start correctly (0xc000007b). Click OK to close the application.
I've recreated this with a plain and empty DLL injected that has no dependencies other than kernel32.dll. With other executables it works perfectly.
Any idea why this can happen?
I don't know what the documentation looked like at the time you encountered this but based on a dummy export apparently working around the problem and the current documentation, you probably missed some requirements stated in Detouring 32-bit and 64-bit Processes. Unfortunately it says to do things without explaining how the pieces fit together.
Detours expects your helper DLL to export
DetourFinishHelperProcess with ordinal 1. This isn't a function you define yourself. It will get compiled into your DLL as a result of calling
DetourIsHelperProcess in your
DllMain function as shown in the Using Detours sample.
User contributions licensed under CC BY-SA 3.0