Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now