Solved

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

Posted on 2008-06-15
2
252 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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