a) i dont think the compiler will even let you do that.
b) you could do it in terminal, but it would require a little bit of a recursive hack
c) if your using a gui just poll for events and dont let them close on hitting the x
Short answer:
You can't do that - if user is desperate enough to close the program - he will.
Long answer:
You can write a callback handler for SIGTERM signal on Linux and ignore it. Or eventually handle it normally, but before exiting, launch a new instance of the process, detached from the parent. On Windows there is a corresponding message for SIGTERM, but I don't remember its name (WM_something) WM_TERMINATE.
However, you can't block/hook SIGKILL (hard terminate) signal/message this way, neither on Linux nor Windows. So if the user decides to kill your app with kill -9 <pid>, your app will exit, regardless what you do.
This should CHEW their computer with hundreds of this program all outputting
This will only run out of user process limit. Nothing even remotely close to chewing the whole machine (assuming the user is running a real OS, and not Win 95 or DOS)
...but Robin Hood and Friar Tuck were both daemons (on Windows they would be services).
At what kind of privilege level do you think your friends will run this/these program/s?
[edit] Oh, and to add something more substantial... any program that behaves like you suggest would be instantly removed from the infected computer, and if your targets don't come at you with pitchforks, you might still get something nasty in the mail.
People hate software that disobeys them. And they feel a might bit less kindly towards people who write software that disobeys them.
Oh, and to add something more substantial... any program that behaves like you suggest would be instantly removed from the infected computer, and if your targets don't come at you with pitchforks, you might still get something nasty in the mail.
People hate software that disobeys them. And they feel a might bit less kindly towards people who write software that disobeys them.
Another thing that would be cool(or not cool) would be to have a program hidden from the user, and when ever they typed, it would force typos(programmatically press a key).
That would be hilarious to watch someone try to get into a account.