×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Terminate Process

Terminate Process

Terminate Process

(OP)
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.

RE: Terminate Process

Dear belthurgp,

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.

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.

Good luck
-pete

RE: Terminate Process

(OP)
hi pete,

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.

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 ?.

I have another idea, that is , put in a message hook,
and see if task manager is active(FindWindow or EnumWindow),
then trap all SendMessage with ListBox handle and the DataPtr of that message with my window handle. Simply put,
don't let task manager display my window id.

But i am not very sure, bcos, is taskmgr Ring0 application ?. that i need to find out.

thanx.

GuruPrasad Belthur
belthurgp@yahoo.com
My Personal Page
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.

RE: Terminate Process

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.

Karl
kb244@kb244.8m.com

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)

RE: Terminate Process

(OP)
hi karl,

i am not against taking microsoft documentation seriously, but i definielty think twice.

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.

As far as TerminateProcess goes that is what the task manager does to kill it. When u say "End Task", 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.

All I want is my program should not be killed by
Terminateprocess. any ideas.

GuruPrasad Belthur
belthurgp@yahoo.com
My Personal Page
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close