Error 0xc000007b When trying to inject a DLL with detours

1

I'm trying to inject a DLL to a new process using the latests 32 bit Detours library.

http://research.microsoft.com/en-us/projects/detours/

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?

windows
code-injection
32-bit
detours
asked on Stack Overflow Oct 7, 2013 by shoosh • edited Oct 7, 2013 by shoosh

2 Answers

4

It turned out that the problem was the the DLL I was injecting using Detours did have any exports. Once I added a dummy export, everything worked perfectly.

answered on Stack Overflow Oct 7, 2013 by shoosh
0

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.

answered on Stack Overflow Sep 18, 2020 by jeff krueger

User contributions licensed under CC BY-SA 3.0