Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminate Process

Status
Not open for further replies.

belthurgp

Instructor
Jun 6, 2000
15
IN
I want to make a program of mine not killable under NT. My program should be able to trap TerminateProcess. Any ideas on how to do this.
 
Dear belthurgp,<br><br>If you read the SDK for 'TerminateProcess' it states that the function 'unconditionally' causes a process to exit. Furthermore it warns that it should be used only in extreme circumstances which is why I did not recommend using it in my post to gleason's question.<br><br>I don't believe there is anyway to completely block your process from being terminated. However you can make it more difficult by having your process run under an admin account, or make it a service which will run under the system account.<br><br>Good luck<br>-pete
 
hi pete,<br><br>I really appreciate your views on using TerminateProcess in very rare cases. But my experience tells me not to take Microsoft's advice very seriously. They are very good at discouraging people from interfering into OS internals.<br><br>Regarding my query, what I have in mind is to try if i can hook API functions, but I know it is not easy. Service is an easy way out (comparatively), but MSDN doesn't make my life easier if I have to write a service. I have not written one till now, have u ?.<br><br>I have another idea, that is , put in a message hook, <br>and see if task manager is active(FindWindow or EnumWindow),<br>then trap all SendMessage with ListBox handle and the DataPtr of that message with my window handle. Simply put,<br>don't let task manager display my window id. <br><br>But i am not very sure, bcos, is taskmgr Ring0 application ?. that i need to find out.<br><br>thanx. <p>GuruPrasad Belthur<br><a href=mailto:belthurgp@yahoo.com>belthurgp@yahoo.com</a><br><a href= Personal Page</a><br>Commerce Graduate, but have lived purely on computers. All the work i have done till now is only with computers and I love it. Written lot of programs that are actually small utils. Can crack MS-ACCESS Password.
 
um, his post is correct, the reason is logical, it kills the process, creating memory leaks, preventing data from being saved, locking drivers in memory where you cant get to them, in otherwords, it could just crash your computer, as if some vital process crashed, And I would know because myself and others have gone through the experiements. A thing about microsoft's advise, any functions they give away, they wholeheartly tell you everything thats important about it, its the APIs that they dont show you or dont want you to know is the ones they put hardly any documentation, but if you wont take their advise, least take the advise from a programmer who has tried it. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
hi karl,<br><br>i am not against taking microsoft documentation seriously, but i definielty think twice. <br><br>There are lot of functions which windows uses and is not available for us. those undocumented functions will definitely make our lives a little bit easier, yes we have to be careful while using it. <br><br>As far as TerminateProcess goes that is what the task manager does to kill it. When u say &quot;End Task&quot;, it will send a WM_CLOSE, and if the program refuses to ack, windows will kill it. I know it's a painful procedure, but it works.<br><br>All I want is my program should not be killed by <br>Terminateprocess. any ideas.<br> <p>GuruPrasad Belthur<br><a href=mailto:belthurgp@yahoo.com>belthurgp@yahoo.com</a><br><a href= Personal Page</a><br>Commerce Graduate, but have lived purely on computers. All the work i have done till now is only with computers and I love it. Written lot of programs that are actually small utils. Can crack MS-ACCESS Password.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top