Looks as if there's a possible solution in an MSDN article.
What you'd have to do is write a simple Windows application which handles the WM_QUERYENDSESSION
event, and returns FALSE
, then, in theory, as long as that application is running, the system won't log you out. It's possible that just leaving open an instance of notepad.exe
with an unsaved file in it would achieve the same thing.
It, might, however, cause all other applications to terminate, so, if that's undesirable, you'd have to intercept the call to ExitWindows
from softXpand, which is much more complicated.
Some security products like Comodo Internet Security will allow you to run an application in a sandbox, such that you can intercept and deny certain system calls, which might work.
See also: this question.