2

I wrote a Windows application that comes with two modules: service and user-mode applications. The service implements its own scheduler and may log-off a user at a predefined time. For that I was using the following call that is triggered from my user-mode module running in a logged-on user session that has to be logged off:

BOOL result = ExitWindowsEx(EWX_LOGOFF, reason);

This works fine, except of the situation when a user's account is locked. In that case that API doesn't seem to do anything at all even through I get 1 returned from it.

So I was curious, is there any other way to log off a user when their account is locked? (One condition I have in this case is that if that user had any unsaved documents then the log-off should not be forced.)

c00000fd
  • 20,994
  • 29
  • 177
  • 400

1 Answers1

-1

Try this:

DWORD dFlags = EWX_LOGOFF | EWX_FORCE | 0x10200;

BOOL result = ExitWindowsEx(dFlags, reason);
user2120666
  • 579
  • 1
  • 4
  • 16
  • 2
    `0x10200` is some extra flag? Something undocumented? – Mario Dec 01 '13 at 12:33
  • @Mario: Good point. Also, as I said in my original question I can't use `EWX_FORCE` ... unless `0x10200` does something to it. So, user2120666, please explain yourself. – c00000fd Dec 02 '13 at 04:59