One of my coworkers ran into a nice issue: she has been assigned to take over the work of a developer from another country and she received the sources nicely packed in a Visual Studio solution.

She managed to build the sources, but every time she tried to start the application under Visual Studio debugger the output window would list “invalid instruction” and the application quit; the main function was not hit at all.

When run without the debugger, the application run fine.

She was not able to find out what was happening so she called me (the last C++ expert in the company) to the rescue.

We’ve discussed our options for a good half an hour: try a newer VS version, cut out parts from the application, ask the upper management to coerce the original developer into answering our e-mails …

And then I’ve got it: I’ve seen a .DLL marked with some “enigma” keyword. I’ve configured VS to stop at all exceptions and I’ve run the application with the debugger. Good, the exception was in that DLL!

The coworker got her hands dirty into removing that DLL from the application and then everything worked fine; it’s now clear to us that the original developer had implemented a copy protection in the application and this copy protection included some code sequence that would prevent the application from running under a debugger. It’s not clear why he didn’t warn us upfront, but that’s business as usual – sometimes things work OOB, sometimes you have to dig a little.