General Topics include: .NET Framework
Note: Most posts can be categorized into one of the forums below, where experts on that topic will be able to help you find a solution to your problem faster and more efficiently.

Go Back  Xtreme .NET Talk > .NET > General > System.ComponentModel.Win32Exception: Access is denied ERROR


Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2003, 02:24 PM
Carly Carly is offline
Newcomer
 
Join Date: Apr 2003
Posts: 3
Carly is on a distinguished road
Question System.ComponentModel.Win32Exception: Access is denied ERROR



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)
Reply With Quote
  #2  
Old 04-04-2003, 02:33 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,172
Volte is on a distinguished road
Default

Does the user that you are logged in as (in Windows) have the
appropriate permissions to do that (as in kill other processes)?
Reply With Quote
  #3  
Old 04-04-2003, 02:53 PM
Carly Carly is offline
Newcomer
 
Join Date: Apr 2003
Posts: 3
Carly is on a distinguished road
Default

Yes, I am an administrator on the Domain.
Reply With Quote
  #4  
Old 04-04-2003, 02:59 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,172
Volte is on a distinguished road
Default

Well, I don't know much about W2K Terminal Server, but it might have
some sort of protection against processes killing other processes.
Reply With Quote
  #5  
Old 04-04-2003, 03:09 PM
Nerseus's Avatar
Nerseus Nerseus is offline
Danner

Preferred language:
C#
 
Join Date: Oct 2002
Location: Arizona, USA
Posts: 2,547
Nerseus is on a distinguished road
Default

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
Reply With Quote
  #6  
Old 04-04-2003, 03:20 PM
Carly Carly is offline
Newcomer
 
Join Date: Apr 2003
Posts: 3
Carly is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 04-06-2003, 09:09 PM
melegant melegant is offline
Regular

Preferred language:
VB.NET
 
Join Date: Feb 2003
Location: NY
Posts: 52
melegant is on a distinguished road
Default

Terminal Server Applications (at least those set to be used by multiple people) run a bit differently than those on a standard W2K box.

http://www.microsoft.com/windows2000...rv_topnode.htm

This may help.

Also, are you able to kill the exe with a standard end task from the task manager?>
Reply With Quote
  #8  
Old 11-19-2004, 07:03 AM
sdevry sdevry is offline
Newcomer
 
Join Date: Nov 2004
Posts: 1
sdevry is on a distinguished road
Default 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
Quote:
Originally Posted by Carly
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)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Denied Error kcwallace Interoperation / Office Integration 1 11-08-2006 08:48 PM
System.UnauthorizedAccessException: Access is denied. pramodgv ASP.NET 1 07-21-2004 09:10 AM
Anoying Access Denied error Doemaarwat Interoperation / Office Integration 1 03-14-2004 01:23 PM
System.UnauthorizedAccessException: Access is denied. Hobbes ASP.NET 3 11-02-2003 03:34 PM
Help...Error! Debugging Access Denied Mykro General 0 10-25-2003 09:29 AM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe