My question separates two parts:
1. I want to prevent user killing my app.
I use RegisterServiceProcess() on Win9x, it works ok.
I use SetEntriesInAcl() and SetSecurityInfo() to remove the PROCESS_TERMINATE permission from my app, it works on WinNT/2000, but doesn't work on WinXP :-(
2. I want to prevent other apps killing my app.
I have no idea about this now, maybe hook api is a choice, but I want a clean method, if you have thought something, please help me.