tags:

views:

44

answers:

3

I'm using a corporate workstation, and my IT department keeps using programs to restart my PC without my permission. I've asked them to stop, but they don't how how - typical.

Anyway, I figured there must be a way of preventing (malicious?) programs like these from restarting my PC... So how about preventing ExitWindows or ExitWindowsEx from being called? I assume this is what they'll be using, but I'm not sure how to find out.

Is this a good solution, or should I just move to another company?

Update 1:

Just thinking about this from another angle - is it possible to tell which program is making a call to ExitWindows or ExitWindowsEx? This way I can log the process name, and then write a small program to blacklist the offending program (i.e. kill it whenever it appears).

A: 

You can stop it by running shutdown /a on the command-line once you see the System Shutdown dialog.

SLaks
They often schedule the restart in the middle of the night when I'm away from my desk. I have tried using `shutdown /a` when their fruity little count-down dialogue appears, but it seems that they're not using the shutdown command to schedule shutdowns. I think the actual application it's self (anti virus maybe?) is making a call to shutdown via the winapi.
nbolton
A: 

If you have the appropriate rights, use shutdown -a to abort a scheduled shutdown; alternatively, write a small program that catches WM_QUERYENDSESSION and answers with zero.

But I think the real problem here is your IT department interrupting your work. Talk with your manager before you take any other action, and make sure she understands that this is impacting your performance.

lbruder
Management says no dice.
nbolton
+1  A: 

On < Vista, you can handle WM_QUERYENDSESSION, on Vista+, you need to use ShutdownBlockReasonCreate in addition to WM_QUERYENDSESSION.

Anders