Windows Service failes to start with "Path '.' not found"

Disclaimer: the error message is translated from Swedish (and it's a pain to find the exact corresponding error message in English, Microsoft take note...) The error message could also be "Path ' ' not found" or "Path not found". It's a bit unclear due to the Swedish message not enclosing the path in ' '.

This is similar to this question, but not exactly: New Windows Service installed, fails to start: "System error 2 ... system cannot find the file specified"

I have written the service myself. It is an exe written in unmanaged C++ and is using the following external code:

  • libntlm - loaded as dynamic library (libntlm-0.dll placed in same location as executable)
  • OpenSSL - loaded as static library
  • pugixml - compiled directly into code

The problem I'm having is that it doesn't start when Windows starts, but it does start if I manually start it! I am stumped as to what could be wrong. The only thing I can think of is if perhaps the dll can't be found, but I don't know why it wouldn't. Something with the environment variables being different perhaps?

What I have tried:

  • Checked registry, path is correct
  • Path is to local disk
  • Changed to a number of different paths (no change)
  • Made sure there are no spaces in the path
  • Logging at start of program (nothing written to log, so it's not an internal path not found error)
  • Dll is in same path
  • Set to start with my own network account (no change)
  • Tried renaming exe to be the same as service name (no change)
  • Tried registering libntlm-0.dll with regsrv32 but that didn't work
  • Put libntlm-0.dll in System32 (no change)


For posterity it seems like the delayed start suggested by 51k seems to work. I don't know why that should make any difference, but as long as it works I'm happy.

Need Your Help

Applying Coefficient of Restitution in a collision resolution method

c# .net xna physics restitution

I have a collision resolution method in my physics engine, that goes like this: