System.Diagnostics.Process Help
-
Ok I have been having the most trouble with the Process class. It keeps throw Access Is Denied for everything. I stumbled across this.
[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true, Synchronization = true,
ExternalProcessMgmt = true, SelfAffectingProcessMgmt = true)]
[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]Now I have no clue about this but I know your supposed to put above a func, constructor and all that. How can I just give my app all these permissions. Or better yet is there a better way to stop these rediculous exceptions. It happens on HasExited, Kill, Close, etc.
modified on Monday, May 4, 2009 2:03 AM
-
Ok I have been having the most trouble with the Process class. It keeps throw Access Is Denied for everything. I stumbled across this.
[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true, Synchronization = true,
ExternalProcessMgmt = true, SelfAffectingProcessMgmt = true)]
[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]Now I have no clue about this but I know your supposed to put above a func, constructor and all that. How can I just give my app all these permissions. Or better yet is there a better way to stop these rediculous exceptions. It happens on HasExited, Kill, Close, etc.
modified on Monday, May 4, 2009 2:03 AM
Where is the code being launched from and what does your code that uses the Process class look like.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Where is the code being launched from and what does your code that uses the Process class look like.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Declaring
AobotProc = new Process(); AobotProc.StartInfo.FileName = AOPath + "//" + AOExe; AobotProc.StartInfo.Arguments = "-run -hide"; AobotProc.StartInfo.WorkingDirectory = AOPath; AobotProc.EnableRaisingEvents = true; AobotProc.Start(); AobotProc.Exited += new EventHandler(aobot\_proc\_Exited);
and errors wen
if (AobotProc != null && !AobotProc.HasExited) { if (!AobotProc.CloseMainWindow()) AobotProc.Kill(); }
errors at AobotProc.HasExited saying Access Is Denied
-
Declaring
AobotProc = new Process(); AobotProc.StartInfo.FileName = AOPath + "//" + AOExe; AobotProc.StartInfo.Arguments = "-run -hide"; AobotProc.StartInfo.WorkingDirectory = AOPath; AobotProc.EnableRaisingEvents = true; AobotProc.Start(); AobotProc.Exited += new EventHandler(aobot\_proc\_Exited);
and errors wen
if (AobotProc != null && !AobotProc.HasExited) { if (!AobotProc.CloseMainWindow()) AobotProc.Kill(); }
errors at AobotProc.HasExited saying Access Is Denied
What version of the .NET Framework are you using?? Is this code running under Vista??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
What version of the .NET Framework are you using?? Is this code running under Vista??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
The Process class uses the system performance counters, which on Vista, requires an Admin level account to use. You really have no choice but to include a manifest with your app that tells Vista that the app will require an administor account to run. First, watch the video here[^]. Then you can read this[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
The Process class uses the system performance counters, which on Vista, requires an Admin level account to use. You really have no choice but to include a manifest with your app that tells Vista that the app will require an administor account to run. First, watch the video here[^]. Then you can read this[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008I have done that... I have found this ProccessPrileges and it looks like it has fixed my issues