Hey guys,
I tried to get a process handle with the following code snippet:
00 Process[] processes = Process.GetProc esses();
01 if (null != processes && processes.Lengt h 0)
02 {
03 foreach (Process currentProcess in processes)
04 {
05 if (null != currentProcess)
06 {
07 if (currentProcess .Handle !=
Process.GetCurr entProcess().Ha ndle)
08 {
09 if
(currentProcess .MainModule.Fil eName.ToLower() .Contains("proc essname"))
10 {
11 currentProcess. Kill();
12 }
13 }
14 }
15 }
16 }
As soon as I reach line XX the framework will throw a Win32Exception
with the exception message "Access denied". The application should
have all needed user privileges because it runs as a service
application with the SYSTEM account permissions. As of this, I think
that my application will need additional .NET rights. Has somebody any
idea how to get the required permission? Thanks a lot.
Best regards,
Tim
I tried to get a process handle with the following code snippet:
00 Process[] processes = Process.GetProc esses();
01 if (null != processes && processes.Lengt h 0)
02 {
03 foreach (Process currentProcess in processes)
04 {
05 if (null != currentProcess)
06 {
07 if (currentProcess .Handle !=
Process.GetCurr entProcess().Ha ndle)
08 {
09 if
(currentProcess .MainModule.Fil eName.ToLower() .Contains("proc essname"))
10 {
11 currentProcess. Kill();
12 }
13 }
14 }
15 }
16 }
As soon as I reach line XX the framework will throw a Win32Exception
with the exception message "Access denied". The application should
have all needed user privileges because it runs as a service
application with the SYSTEM account permissions. As of this, I think
that my application will need additional .NET rights. Has somebody any
idea how to get the required permission? Thanks a lot.
Best regards,
Tim
Comment