-
August 2nd, 2006, 10:06 PM
#1
How to shutdown the XP system if my program is terminated by someone?
When my program is running and if it is terminated (intentionally) via the Task Manager's Process tab, how can my program force a system shutdown or reboot?
It would be better if there is sample code.
Or are there alternatives to my problem?
Thanks.
Last edited by Kurosan; August 2nd, 2006 at 10:13 PM.
-
August 3rd, 2006, 12:04 AM
#2
Re: How to shutdown the XP system if my program is terminated by someone?
it is eqivalent to condition "you have lock your house door when you are not there " (forget the electronics methods) . A hidden(from taskman) monitor program may be the solution.
-
August 3rd, 2006, 02:09 AM
#3
Re: How to shutdown the XP system if my program is terminated by someone?
You can have one more watch program, which Waits on process handle, You will also need to add handling of watching the 'watch' program from first one. You can have use multiple threads in first program to wait on watch program.
Regards,
Ramkrishna Pawar
-
August 3rd, 2006, 02:10 AM
#4
Re: How to shutdown the XP system if my program is terminated by someone?
Look at this thread for sample.
Cheers
-
August 3rd, 2006, 02:36 AM
#5
Re: How to shutdown the XP system if my program is terminated by someone?
How would my program be notified that it's going to be terminated before shutting down or rebooting the system?
-
August 3rd, 2006, 02:57 AM
#6
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
How would my program be notified that it's going to be terminated before shutting down or rebooting the system?
Look at WM_QUERYENDSESSION message.
Cheers
-
August 3rd, 2006, 03:14 AM
#7
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
When my program is running and if it is terminated (intentionally) via the Task Manager's Process tab, how can my program force a system shutdown or reboot?
Why would one want to restart the system should the user chooses to terminate one's application? I also presume that you would restart your application on system restart. Right?
So, this requirement is as good as - "run my application or stop using your computer" - No?
In general - ExitWindowsEx API does what you want i.e. shut down windows. Fortuntately, if someone chooses to kill your application via TM - there is little you can do about it. Perhaps, have another application that monitors this one... Or... Or... But, no clean way.
Fortunately, so!
Last edited by Siddhartha; August 3rd, 2006 at 03:22 AM.
-
August 3rd, 2006, 03:21 AM
#8
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Siddhartha
Why would one want to restart the system should the user chooses to terminate one's application? I also presume that you would restart your application on system restart. Right?
So, this requirement is as good as - "run my application or stop using your computer" - No?
In general - ExitWindows API does what you want i.e. restart windows. Fortuntately, if someone chooses to kill your application via TM - there is little you can do about it. Perhaps, have another application that monitors this one... Or... Or... But, no clean way.
Fortunately, so!
My program is supposed to prevent users from doing certain activities, so killing the program will circumvent the restrictions.
-
August 3rd, 2006, 03:24 AM
#9
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
My program is supposed to prevent users from doing certain activities, so killing the program will circumvent the restrictions.
What activities are these?
Instead of shutting the computer down just because a user killed your application, you would rather start your application as a service with administrative privileges so that users who are not administrators will not be able to kill it.
This in general would be a better way to doing things.
Shutting Windows down in this situation is absolutely rude.
-
August 5th, 2006, 06:24 PM
#10
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
My program is supposed to prevent users from doing certain activities, so killing the program will circumvent the restrictions.
Your program sounds malicious. Even if it's well-intentioned, it still could be used maliciously. Few here will help you.
-
August 6th, 2006, 02:08 AM
#11
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Siddhartha
What activities are these?
Instead of shutting the computer down just because a user killed your application, you would rather start your application as a service with administrative privileges so that users who are not administrators will not be able to kill it.
This in general would be a better way to doing things.
Shutting Windows down in this situation is absolutely rude.
Agree to you Sid.
OP should instead try using user policies and priviledge restrictions and/or firewall kind of thing.
Regards,
Ramkrishna Pawar
-
August 6th, 2006, 04:41 AM
#12
Re: How to shutdown the XP system if my program is terminated by someone?
You can try these options instead of shutting down the system:
1) Disable Alt + Ctrl + Del.
2) Install a hook to see for Task Manager and then getting a pointer to the list control and emptying the process list.
3) Hooking system functions like NtQuerySystemInformation.
But, others are correct, forcing such things may not be what the user expects.
"I rather not play football than wear Nerrazzuri shirt" - Paolo Maldini
FORZA MILAN!!!
-
August 6th, 2006, 12:35 PM
#13
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Siddhartha
What activities are these?
Instead of shutting the computer down just because a user killed your application, you would rather start your application as a service with administrative privileges so that users who are not administrators will not be able to kill it.
This in general would be a better way to doing things.
Shutting Windows down in this situation is absolutely rude.
Is this still workable as all the users in my company are logging onto their PCs with administrative rights?
-
August 6th, 2006, 01:01 PM
#14
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
Is this still workable as all the users in my company are logging onto their PCs with administrative rights?
If you are or have the blessing of the IT dept, you could create a policy for a service and only give domain admins permission to shut it down. Machine admins won't be able to shut the service down.
-
August 6th, 2006, 01:10 PM
#15
Re: How to shutdown the XP system if my program is terminated by someone?
Originally Posted by Kurosan
My program is supposed to prevent users from doing certain activities, so killing the program will circumvent the restrictions.
I think you're missing the point that Sid and the others have already made. What right does your program have to restrict how people use their own computers? If they want to turn off the restrictions that your program imposed, they have every right to do so.
Of course, if this was some kind of security device (let's say that it prevents them from accessing certain files or directories) the IT dept probably already has tools to handle the situation. If it doesn't, then you should think about writing a service that checks some kind of privileges before allowing the security to be breached. I don't think anyone will thank you for disabling their whole PC whenever they remove your program. As MikeAthon said earlier, your program sounds downright malicious.
Last edited by John E; August 6th, 2006 at 01:13 PM.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|