我必须在我的服务中查找活动用户。是否有任何可能的方法来查找活动用户。该服务是作为本地系统登录。我可以跟踪登录并从服务控件中注销
以下是用于跟踪会话更改的代码块
DWORD WINAPI service_ctrl(DWORD dwCtrlCode, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
{
DWORD dReturn = NO_ERROR;
///////////////////////////////
try
{
switch(dwCtrlCode)
{
case SERVICE_CONTROL_STOP:
break;
case SERVICE_CONTROL_INTERROGATE:
break;
case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_SESSIONCHANGE:
switch(dwEventType)
{
case WTS_CONSOLE_CONNECT:
break;
case WTS_CONSOLE_DISCONNECT:
break;
case WTS_REMOTE_CONNECT:
break;
case WTS_REMOTE_DISCONNECT:
break;
case WTS_SESSION_LOGON:
break;
case WTS_SESSION_LOGOFF:
break;
case WTS_SESSION_LOCK:
break;
case WTS_SESSION_UNLOCK:
break;
default:
break;
}
break;
case SERVICE_CONTROL_POWEREVENT:
}
break;
}
return dReturn;
}