My colleagues are testing our new system (.Net 4) app and running it directly from C:\Windows.
App is executed in each user session within user context (so, with lower rights really).
I've noticed that there is a serious problem with this app. I can't read full filename path of app (from another application) by retrieving it using process class (MainModule.FileName) - Access Denied, nor by using WMI query - here I get empty string. UAC is turned off.
Both methods work fine in developing environment (different paths). Is there any way I can adjust security settings, or I just should give up and change the path to something more neutral?
You should just give up and change the path to "something more neutral". I.e. a proper installation directory in the Program Files
or Program Files (x86)
directory (as appropriate).
Also, it is not clear from your question why you want to retrieve the full file path of the process, but it's likely you're going about that wrong as well. There's really no reason that a program should be forced to run from any specific directory, so if you have a system that is somehow relying on a check of the full file path of the process's executable, that system is probably flawed and should be using some other mechanism for the purpose (e.g. using shared memory, a named pipe, a named mutex, or other similar inter-process communications mechanism).