We have an application that needs to know the path that it is executed from (which is always a network path).
We set up part of our configuration based on the path that the application is launched from, and we really want that configuration to use mapped network drive paths instead of the UNC path to the resource.
What we've found is that when we launch our application without UAC elevation, we are able to get the directory that the application launched from using
GetModuleFileName(NULL, buf, sizeof(buf));
But when we launch elevated (which we actually need to do), the buffer returned gives us a UNC based path instead of a drive letter based path.
Note that we always launch from Windows Explorer by navigating into the folder tree of the mapped drive letter.
Does anyone have any suggestions on how to get the drive letter based path of the EXE from a process that is running elevated?