I have a problem that I am unable to solve at the moment, likely due to some .NET 2.0 features that I do not understand. I have the following code which used to work error free in a .NET 1.1 application. After porting it to 2.0 (Visual Studio 2005) I'm getting a System.ComponentModel.Win3
with NativeErrorCode = 5 for processID = 0, processName = "Idle".
I thougth it's likely a .NET Security problem, because the NativeErrorCode is "Access is denied". I don't believe I am allowed to employ the technique called Impersonation because of the Security implications of encoding a username/password in a program. Has anyone run across this problem before? And if so do you recall the solution? My gut tells me that this is very common.
Process procs = Process.GetProcesses();
foreach (Process proc in procs)
Console.WriteLine("PROC:" + proc.Id + ":" +
Console.WriteLine("EXCEPTION!!!! - " + proc.Id + ":" +
catch (Exception ex)
Console.WriteLine("Other Exception:" + ex.Message);