Condividi tramite


GetCurrentProcess fails on Net 1.1 on Vista

This little snippet compiled with .Net 1.1:

using System;

using System.Diagnostics;

 
 

class Program

{

    static void Main(string[] args)

    {

        try

        {

            Process c = Process.GetCurrentProcess();

 
 

            Process[] p = Process.GetProcessesByName(c.ProcessName);

        }

        catch (Exception e)

        {

            Console.WriteLine(e.Message);

        }

    }

}

 
 

will fail on Vista as standard user and hence filtered admin with this error:

{"Couldn't get process information from remote machine."}

Compiling it under 2.0 will get you passed it.

 
 

Maarten

Comments

  • Anonymous
    July 12, 2007
    One solution for this code to work is to disable the UAC (User Acess Control). I am having this issue to an aplication that I developing right now and looking for altenative solutions without disabling UAC. --- Dan