Access denied exception while accessing process.MainModule.FileName
- by Manjoor
I am listing all running processes in system with it full path. My application is running fine in XP but in vista, it gives access denied exception while accessing MainModule.FileName. (Due to UAC, i think).
foreach (Process process in Process.GetProcesses())
{
sProcess = process.ProcessName;
sFullpath = process.MainModule.FileName;
..
..
..
}
I did not find a solution to deal with UAC. Any clue??