I am adapting a program to run as a service, and the first thing it does is open the local config file, but it doesn't exist because I don't know what the current directory is.
The current working directory is the location of the service executable, unless changed with a win32 API call SetCurrentDirectory
SetCurrentDirectory
The call GetCurrentDirectory to the service entry point returns "C: \ WINDOWS \ system32". After installing it in the executable directory, SetCurrentDirectory everything worked as expected.
GetCurrentDirectory