I'm trying to get the directory where the executable is.
On debian, I know I can get the pid and do a "realpath" on /proc/[pid]/exe in order to have the absolute path. But I'm stuck on windows, because I don't know how to do. I want something usable on Windows 7 and upper.
GetCurrentDirectory doens't give me this information, since if the program is run from command-line, the current directory is not necessarly the rigth one.
My program will be a windows service, so it's even more true.
I can't use command line argument (like argv[0] or else) to determine the program's name or location. edit : My program is not necessarly in $PATH, so I can't use "where".
Is there a Windows API function that I have missed ? Or do I need to search like on Debian ?