Access denied exception while accessing process.MainModule.FileName

Posted by Manjoor on Stack Overflow See other posts from Stack Overflow or by Manjoor
Published on 2009-11-20T11:33:36Z Indexed on 2010/06/13 7:02 UTC
Read the original article Hit count: 229

Filed under:

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??

© Stack Overflow or respective owner

Related posts about c#