RE: Access is Denied using System.Diagnostics.Process.GetProcesses()

  • Thread starter Thread starter Rajeev Goel
  • Start date Start date
R

Rajeev Goel

Hi Russell,

Sorry I can't be of any great help here, but I did want to give you one
additional datapoint. I'm running Windows XP Pro, and I am not an Admin on
my machine ... I'm running as a normal User.

I created a simple managed C++ application with the following code:

int _tmain()
{
Process* localAll[] = Process::GetProcesses();
for (int i = 0 ; i < 10 ; i++)
{
Console::WriteLine(localAll->ProcessName);
}

return 0;
}

And it worked correctly for me... listing out the first 10 processes.

All the errors/exceptions you're getting definitely seem to indicate that
it's trying to access some remote machine instead of the local machine.
Any idea why this might be? If you're really calling GetProcesses()
without any parameters, it shouldn't be trying to do any remote calls.

--Rajeev
Visual Studio .NET
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Rajeev:

Thanks for trying this on XP Pro.

I ran your program on my pc and on a co-workers pc (which
has Win2K and the 1.1 framework). It worked on Win2K but
not on 2003. I am now thinking that this is just a
Windows Server 2003 problem.

It appears that Process::GetProcesses() calls the version
that takes a machine name but passes a period (i.e.,
Process::GetProcesses( S"." ) ) which appears to be the
reason why the system is trying to do rpc.

Of course now I can't test my application on my own pc,
but at least I know it is more secure :)

Thanks,

Russell Bennett
 
The reason is that Process class uses performance counter to get information
about processes.
Win2003 doesn't allow normal users to access perf counter information.
There is a new user group called performance counter user. You need to add
the account you used to run your application to that group.
BTW, we are planning to reduce the dependency of process class on perf
counter information.

Thanks,
Gang Peng
[MS]

Russell Bennett said:
Rajeev:

Thanks for trying this on XP Pro.

I ran your program on my pc and on a co-workers pc (which
has Win2K and the 1.1 framework). It worked on Win2K but
not on 2003. I am now thinking that this is just a
Windows Server 2003 problem.

It appears that Process::GetProcesses() calls the version
that takes a machine name but passes a period (i.e.,
Process::GetProcesses( S"." ) ) which appears to be the
reason why the system is trying to do rpc.

Of course now I can't test my application on my own pc,
but at least I know it is more secure :)

Thanks,

Russell Bennett
-----Original Message-----
Hi Russell,

Sorry I can't be of any great help here, but I did want to give you one
additional datapoint. I'm running Windows XP Pro, and I am not an Admin on
my machine ... I'm running as a normal User.

I created a simple managed C++ application with the following code:

int _tmain()
{
Process* localAll[] = Process::GetProcesses();
for (int i = 0 ; i < 10 ; i++)
{
Console::WriteLine(localAll->ProcessName);
}

return 0;
}

And it worked correctly for me... listing out the first 10 processes.

All the errors/exceptions you're getting definitely seem to indicate that
it's trying to access some remote machine instead of the local machine.
Any idea why this might be? If you're really calling GetProcesses()
without any parameters, it shouldn't be trying to do any remote calls.

--Rajeev
Visual Studio .NET
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.

.
 
Back
Top