Jump to content
Xtreme .Net Talk

System.ComponentModel.Win32Exception: Access is denied ERROR


Recommended Posts

Posted

I am running a simple VB.NET program that kills a process, winword.exe. It works fine on all machines except a Windows 2000 Terminal Server. I get the error below:

 

Can anyone suggest anything? The code I used is here:

msdn.microsoft.com/library/default.asp?url=/library/en-us/

cpref/html/frlrfsystemdiagnosticsprocessclassgetprocessesbynametopic1.asp

 

 

 

************* Exception Text **************

System.ComponentModel.Win32Exception: Access is denied

at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)

at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)

at System.Diagnostics.Process.get_HasExited()

at WindowsApplication8.Form1.Button1_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  • *Experts*
Posted

Does the user that you are logged in as (in Windows) have the

appropriate permissions to do that (as in kill other processes)?

  • *Experts*
Posted

Well, I don't know much about W2K Terminal Server, but it might have

some sort of protection against processes killing other processes.

  • *Experts*
Posted

Is the machine just a terminal-service enabled computer, or do you mean you are using terminal services to connect remotely to another machine and through that connection, trying to run a program that is trying to kill a process?

 

Did you try the overload that takes the machine name and try and run the program for your client machine and connect to the remote machine (instead of connecting through terminal services and running the program locally on the remote machine)?

 

As long as the user you are connecting as is an admin on that machine, I wouldn't think you'd get an Access Denied message. Is that machine on the same domain as the Domain Admin you're connecting as? Meaning, are you connecting to a machine on another domain? Have you tried logging onto the remote machine as a local admin (local to that machine)?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

It is a Windows 2000 Server running Terminal Services, which has about 30 users running a terminal session.

 

The program is being run from a directory on that machine.

 

I think the problem may be that my program doesnt know which processes are mine and tries to access other users processes.

  • 1 year later...
Posted

Help needed

 

I' m having the same problem like you have and was wondering if you had found a solution to the problem already.

If so could you please post it to me at following adress

steven@quasus.be

Kind regards

Steven

I am running a simple VB.NET program that kills a process, winword.exe. It works fine on all machines except a Windows 2000 Terminal Server. I get the error below:

 

Can anyone suggest anything? The code I used is here:

msdn.microsoft.com/library/default.asp?url=/library/en-us/

cpref/html/frlrfsystemdiagnosticsprocessclassgetprocessesbynametopic1.asp

 

 

 

************* Exception Text **************

System.ComponentModel.Win32Exception: Access is denied

at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)

at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)

at System.Diagnostics.Process.get_HasExited()

at WindowsApplication8.Form1.Button1_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...