this is a bug: Calling ExitWindowsEx() may not completely log off the currently logged on user in a workstation locked state. This happens if the workstation is locked manually by a user and ExitWindowsEx() is called while a screen saver is also running on the system. for more detais,see MSDN articles; BUG: ExitWindowsEx() May Not Logoff in a Workstation Locked State ID: Q229750
More detail!How you lock the machine!
还有一个就是程序的权限问题
OpenProcessToken
AdjustTokenPrivileges
以上是要用到的函数,可以调整程序运行特权
Calling ExitWindowsEx() may not completely log off the currently logged on user in a workstation locked state. This happens if the workstation is locked manually by a user and ExitWindowsEx() is called while a screen saver is also running on the system.
for more detais,see MSDN articles;
BUG: ExitWindowsEx() May Not Logoff in a Workstation Locked State
ID: Q229750