Solved

How do I terminate a process which has a shutdown procedure?

Posted on 2008-06-15
2
250 Views
Last Modified: 2013-12-17
I need to shut down a C# program of mine from another C# program of mine.  Here's the ode I use to shut down proceses:

System.Diagnostics.Process[] process = Process.GetProcessesByName( processName );
if ( process.Length > 0 )
{
     process[0].Kill();
}

the problem is that in order to protect the program from being shut down by a casual operator mistake, I require a password.  But when shutting down automatically, there is no opportunity for a password.

How would I terminate it and have it "know" to bypass the code I included to check for a password?

Thanks for the help,
newbieweb
0
Comment
Question by:newbieweb
2 Comments
 
LVL 4

Accepted Solution

by:
zveljkovic earned 250 total points
ID: 21789951
I think this will help you.
http://articles.techrepublic.com.com/5100-10878_11-6170794.html

Hope that helps,
Zlax
0
 
LVL 16

Assisted Solution

by:CuteBug
CuteBug earned 250 total points
ID: 21790665
You can communicate with the C# application (which has to be shutdown) from your C# application using named pipes. Send it a message say ("SHUTDOWN", "<password>").
Once the C# application receives this message it can check whether the password is correct and then proceed with the shutdown.

Check this link for more details on Inter Process Communication using Named Pipes:
http://blog.paranoidferret.com/index.php/2007/07/25/interprocess-communication-using-named-pipes-in-csharp/
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question