Process.GetProcesses() and user privilege


I have a VS 2003 C# application that works fine in most environments. It has recently been installed in a corporate environment (WinXP / Server 2003) where the user workstations are pretty well 'tightened-down' from a security point-of-view. The application makes use of the Process.GetProcesses() and it appears that the application throws an exception when this is called due to insufficient privilege. So my question is -- from a security perspective, what changes in groups or policy or whatever need to be made such that Process.GetProcesses() will not throw Obviously, making everyone an admin would solve the problem, but I am looking for something a bit more targeted that will keep their administrator happy.

Thanks!



Answer this question

Process.GetProcesses() and user privilege

  • N. Soltic

    Getting the list of processes requires a FullTrust assembly. Therefore you can't, for example, run the application across the network. In general you can get the list of processes, as a limited user, but accessing certain fields may cause an exception by the underlying OS because the user doesn't have sufficient rights. I know that you can access the process name and ID without problems. Are there other fields you are trying to access

    Michael Taylor - 6/12/06


  • dpechter

    Hi Bob,

    You may take a look at the link below.

    How to get the Process Name with minimal privilege
    http://groups.google.com/group/microsoft.public.dotnet.framework/browse_thread/thread/b4dbe236fca90a46/3c9f7f117d2718d5 lnk=st&q=%22v-phuang%22+process+performance+counter&rnum=2&hl=en#3c9f7f117d2718d5

    The MainWindowHandler will also need the performance counter lib.

    Also you need to full trust the .NET assembly that need to execute the operation.
    Here is a link for your reference.

    How to: Grant Permissions to Folders and Assemblies
    http://msdn2.microsoft.com/en-us/library/zdc263t0.aspx

    If you still have any concern, please feel free to post here.

    Best regards,
    Peter Huang



  • Georges Vidal

     

    As far as I know, it is not being run across the network -- the code looks something like this:

    Process[] aProcesses = Process.GetProcesses();

    for (int i=0; i<=aProcesses.GetUpperBound(0); i++)

    if (aProcessesIdea.MainWindowHandle.ToString() == sMainWinHdlToFind)

    {

    processID = aProcessesIdea.Id;

    break;

    }

     

    return processID;

     

     



  • sandyk

    Ahh. In v1.x the implementation uses performance counters as Peter said. In v2.0 it uses standard Windows APIs (at least initially) and therefore will work for normal users. I am able to enumerate all processes and acquire the ProcessName, Id and MainWindowHandle values as a normal User with v2.0.

    Michael Taylor - 6/13/06


  • Annie C D B

    Hi Bob,

    Have you tried Michael and my suggestion
    Did that work for you

    If you still have any concern, please feel free to post here.

    Best regards,
    Peter Huang



  • Process.GetProcesses() and user privilege